Skip to content

Commit 2060842

Browse files
committed
Rename page to card
1 parent 2997860 commit 2060842

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

adafruit_pyoa.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def _wait_for_press(self, card):
197197
198198
:param card: The active card
199199
200-
Return the id of the destination page.
200+
Return the id of the destination card.
201201
"""
202202
button01_text = card.get('button01_text', None)
203203
button02_text = card.get('button02_text', None)
@@ -209,25 +209,25 @@ def _wait_for_press(self, card):
209209
# showing only middle button
210210
if self._middle_button.contains(point_touched):
211211
print("Middle button")
212-
return card.get('button01_goto_page_id', None)
212+
return card.get('button01_goto_card_id', None)
213213
if button01_text and button02_text:
214214
if self._left_button.contains(point_touched):
215215
print("Left button")
216-
return card.get('button01_goto_page_id', None)
216+
return card.get('button01_goto_card_id', None)
217217
if self._right_button.contains(point_touched):
218218
print("Right button")
219-
return card.get('button02_goto_page_id', None)
219+
return card.get('button02_goto_card_id', None)
220220

221221
def display_card(self, card_num):
222-
"""Display and handle input on a page.
222+
"""Display and handle input on a card.
223223
224224
:param card_num: the index of the card to process
225225
226226
"""
227227
card = self._game[card_num]
228228
print(card)
229229
print("*"*32)
230-
print('****{:^24s}****'.format(card['page_id']))
230+
print('****{:^24s}****'.format(card['card_id']))
231231
print("*"*32)
232232

233233
self._fade_to_black()
@@ -248,14 +248,14 @@ def display_card(self, card_num):
248248
time.sleep(auto_adv)
249249
return card_num+1
250250

251-
destination_page_id = self._wait_for_press(card)
251+
destination_card_id = self._wait_for_press(card)
252252

253253
self.play_sound(None) # stop playing any sounds
254-
for page_number, page_struct in enumerate(self._game):
255-
if page_struct.get('page_id', None) == destination_page_id:
256-
return page_number # found the matching card!
254+
for card_number, card_struct in enumerate(self._game):
255+
if card_struct.get('card_id', None) == destination_card_id:
256+
return card_number # found the matching card!
257257
# eep if we got here something went wrong
258-
raise RuntimeError("Could not find card with matching 'page_id': ", destination_page_id)
258+
raise RuntimeError("Could not find card with matching 'card_id': ", destination_card_id)
259259

260260
def play_sound(self, filename, *, wait_to_finish=True, loop=False):
261261
"""Play a sound

0 commit comments

Comments
 (0)