1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00

use __iter__ instead of wait

This commit is contained in:
Jan Pochyla 2016-09-21 17:50:11 +02:00 committed by Pavol Rusnak
parent b8dd8ed90c
commit 6991286f8b
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 6 additions and 8 deletions

View File

@ -57,11 +57,9 @@ async def show_mnemonic(mnemonic):
ui.display.text(45, top, '%s' % word, ui.BOLD, ui.WHITE, ui.BLACK)
if page + 1 == page_count:
# wait for the finish button
finish = Button((0, 240 - 48, 240, 48), 'Finish',
normal_style=CONFIRM_BUTTON,
active_style=CONFIRM_BUTTON_ACTIVE)
await finish.wait()
await Button((0, 240 - 48, 240, 48), 'Finish',
normal_style=CONFIRM_BUTTON,
active_style=CONFIRM_BUTTON_ACTIVE)
else:
await animate_swipe()

View File

@ -113,7 +113,7 @@ class Button():
if in_area(pos, self.area):
return BTN_CLICKED
def wait(self):
def __iter__(self):
while True:
self.render()
event, *pos = yield loop.Select(loop.TOUCH)

View File

@ -33,7 +33,7 @@ class ConfirmDialog():
if self.content is not None:
return self.content.send(event, pos)
def wait(self):
def __iter__(self):
while True:
self.render()
event, *pos = yield loop.Select(loop.TOUCH)

View File

@ -15,6 +15,6 @@ async def confirm(content=None, code=None, **kwargs):
if code is None:
code = Other
ack = await wire.call(ButtonRequest(code=code), ButtonAck)
res = await dialog.wait()
res = await dialog
return res == CONFIRMED