1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

src: move show_pin_timeout to trezor.pin

This commit is contained in:
Pavol Rusnak 2017-12-15 21:06:29 +01:00
parent 7504366a02
commit 5192387060
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 11 additions and 20 deletions

View File

@ -2,17 +2,6 @@ from trezor import res
from trezor import ui
def show_pin_timeout(wait, total):
ui.display.bar(0, 0, ui.SCREEN, ui.SCREEN, ui.BG)
ui.display.loader(1000 - (1000 * wait // total), -10, ui.FG, ui.BG)
if wait == 1:
s = 'Waiting for 1 second'
else:
s = 'Waiting for %d seconds' % wait
ui.display.text_center(ui.SCREEN // 2, ui.SCREEN - 20, s, ui.BOLD, ui.FG, ui.BG)
ui.display.refresh()
class PinCancelled(Exception):
pass

View File

@ -1,6 +1,6 @@
from trezor import ui
from trezor import config
from trezor.pin import pin_to_int
from trezor.pin import pin_to_int, show_pin_timeout
from trezor.utils import unimport
@ -53,7 +53,6 @@ async def layout_change_pin(ctx, msg):
from trezor.messages.Success import Success
from trezor.messages.Failure import Failure
from trezor.messages.FailureType import PinInvalid
from apps.common.request_pin import show_pin_timeout
await confirm_change_pin(ctx, msg)

View File

@ -1,9 +1,9 @@
from trezor import config
from trezor.pin import pin_to_int
from trezor.pin import pin_to_int, show_pin_timeout
from trezor import loop
from trezor import ui
from apps.common.request_pin import request_pin, show_pin_timeout
from apps.common.request_pin import request_pin
async def unlock_layout():

View File

@ -1,6 +1,9 @@
from trezor import config
from trezor import log
def pin_to_int(pin):
return int('1'+pin)
return int('1' + pin)
def show_pin_timeout(wait, total):
from trezor import ui
ui.display.bar(0, 0, ui.SCREEN, ui.SCREEN, ui.BG)
ui.display.loader(1000 - (1000 * wait // total), -10, ui.FG, ui.BG)
ui.display.text_center(ui.SCREEN // 2, ui.SCREEN - 20, 'Waiting for %d s' % wait, ui.BOLD, ui.FG, ui.BG)
ui.display.refresh()