1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00
trezor-firmware/src/trezor/pin.py

41 lines
1.0 KiB
Python
Raw Normal View History

from trezor import ui
def pin_to_int(pin: str) -> int:
2018-07-03 14:20:58 +00:00
return int("1" + pin)
2017-12-15 20:11:46 +00:00
def show_pin_timeout(seconds: int, progress: int, message: str) -> bool:
2018-02-24 20:02:14 +00:00
if progress == 0:
ui.display.bar(0, 0, ui.WIDTH, ui.HEIGHT, ui.BG)
2018-07-03 14:20:58 +00:00
ui.display.text_center(
ui.WIDTH // 2, 37, message, ui.BOLD, ui.FG, ui.BG, ui.WIDTH
2018-07-03 14:20:58 +00:00
)
ui.display.loader(progress, 0, ui.FG, ui.BG)
2018-02-24 20:02:14 +00:00
if seconds == 0:
2018-07-03 14:20:58 +00:00
ui.display.text_center(
ui.WIDTH // 2, ui.HEIGHT - 22, "Done", ui.BOLD, ui.FG, ui.BG, ui.WIDTH
)
elif seconds == 1:
2018-07-03 14:20:58 +00:00
ui.display.text_center(
ui.WIDTH // 2,
ui.HEIGHT - 22,
"1 second left",
ui.BOLD,
ui.FG,
ui.BG,
ui.WIDTH,
)
2018-02-24 20:02:14 +00:00
else:
2018-07-03 14:20:58 +00:00
ui.display.text_center(
ui.WIDTH // 2,
ui.HEIGHT - 22,
"%d seconds left" % seconds,
ui.BOLD,
ui.FG,
ui.BG,
ui.WIDTH,
)
ui.display.refresh()
return False