Skip to content

Commit 518df7a

Browse files
authored
Merge pull request #12 from brentru/patch-pyportal-compat
Fix incompatibility with PyPortal
2 parents 09d5e7c + 6686f5d commit 518df7a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

adafruit_pyoa.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def __init__(self):
9090
self.backlight_fade(0)
9191
board.DISPLAY.show(self.root_group)
9292
self.touchscreen = None
93+
self.mouse_cursor = None
9394
if hasattr(board, 'TOUCH_XL'):
9495
self.touchscreen = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR,
9596
board.TOUCH_YD, board.TOUCH_YU,
@@ -152,14 +153,16 @@ def load_game(self, game_directory):
152153

153154
def _fade_to_black(self):
154155
"""Turn down the lights."""
155-
self.mouse_cursor.is_hidden = True
156+
if self.mouse_cursor:
157+
self.mouse_cursor.is_hidden = True
156158
self.backlight_fade(0)
157159
# turn off background so we can render the text
158160
self.set_background(None, with_fade=False)
159161
self.set_text(None, None)
160162
for _ in range(len(self._button_group)):
161163
self._button_group.pop()
162-
self.mouse_cursor.is_hidden = False
164+
if self.mouse_cursor:
165+
self.mouse_cursor.is_hidden = False
163166

164167
def _display_buttons(self, card):
165168
"""Display the buttons of a card.

0 commit comments

Comments
 (0)