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:
parent
7504366a02
commit
5192387060
@ -2,17 +2,6 @@ from trezor import res
|
|||||||
from trezor import ui
|
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):
|
class PinCancelled(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from trezor import ui
|
from trezor import ui
|
||||||
from trezor import config
|
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
|
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.Success import Success
|
||||||
from trezor.messages.Failure import Failure
|
from trezor.messages.Failure import Failure
|
||||||
from trezor.messages.FailureType import PinInvalid
|
from trezor.messages.FailureType import PinInvalid
|
||||||
from apps.common.request_pin import show_pin_timeout
|
|
||||||
|
|
||||||
await confirm_change_pin(ctx, msg)
|
await confirm_change_pin(ctx, msg)
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
from trezor import config
|
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 loop
|
||||||
from trezor import ui
|
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():
|
async def unlock_layout():
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
from trezor import config
|
|
||||||
from trezor import log
|
|
||||||
|
|
||||||
|
|
||||||
def pin_to_int(pin):
|
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()
|
||||||
|
Loading…
Reference in New Issue
Block a user