|
41 | 41 | https://github.com/adafruit/circuitpython/releases
|
42 | 42 | """
|
43 | 43 |
|
44 |
| -#pylint: disable=too-many-instance-attributes,no-self-use |
| 44 | +#pylint: disable=too-many-instance-attributes,no-self-use,line-too-long |
45 | 45 |
|
46 | 46 | # imports
|
47 | 47 | import time
|
|
59 | 59 | __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PYOA.git"
|
60 | 60 |
|
61 | 61 | class PYOA_Graphics():
|
| 62 | + """A choose your own adventure game framework.""" |
| 63 | + |
62 | 64 | def __init__(self):
|
63 | 65 | self.root_group = displayio.Group(max_size=15)
|
64 | 66 |
|
@@ -101,7 +103,8 @@ def __init__(self):
|
101 | 103 |
|
102 | 104 | self.touchscreen = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR,
|
103 | 105 | board.TOUCH_YD, board.TOUCH_YU,
|
104 |
| - calibration=((5200, 59000), (5800, 57000)), |
| 106 | + calibration=((5200, 59000), |
| 107 | + (5800, 57000)), |
105 | 108 | size=(320, 240))
|
106 | 109 | self._gamedirectory = None
|
107 | 110 | self._gamefilename = None
|
@@ -131,7 +134,7 @@ def _fade_to_black(self):
|
131 | 134 | # turn off background so we can render the text
|
132 | 135 | self.set_background(None, with_fade=False)
|
133 | 136 | self.set_text(None, None)
|
134 |
| - for i in range(len(self._button_group)): |
| 137 | + for _ in range(len(self._button_group)): |
135 | 138 | self._button_group.pop()
|
136 | 139 |
|
137 | 140 | def _display_buttons(self, card):
|
@@ -251,7 +254,7 @@ def display_card(self, card_num):
|
251 | 254 | if page_struct.get('page_id', None) == destination_page_id:
|
252 | 255 | return page_number # found the matching card!
|
253 | 256 | # eep if we got here something went wrong
|
254 |
| - raise RuntimeError("Could not find card with matching 'page_id': ", goto_page) |
| 257 | + raise RuntimeError("Could not find card with matching 'page_id': ", destination_page_id) |
255 | 258 |
|
256 | 259 | def play_sound(self, filename, *, wait_to_finish=True, loop=False):
|
257 | 260 | """Play a sound
|
@@ -289,6 +292,12 @@ def play_sound(self, filename, *, wait_to_finish=True, loop=False):
|
289 | 292 | self._speaker_enable.value = False
|
290 | 293 |
|
291 | 294 | def set_text(self, text, color):
|
| 295 | + """Display the test for a card. |
| 296 | +
|
| 297 | + :param text: the text to display |
| 298 | + :param color: the text color |
| 299 | +
|
| 300 | + """ |
292 | 301 | if self._text_group:
|
293 | 302 | self._text_group.pop()
|
294 | 303 | if not text or not color:
|
|
0 commit comments