1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-20 05:18:08 +00:00

apps/management/reset_device: improve visuals

This commit is contained in:
Peter Jensen 2018-01-19 14:54:39 +01:00 committed by Jan Pochyla
parent acf9d789c7
commit 5701e57b48

View File

@ -69,25 +69,33 @@ async def layout_reset_device(ctx, msg):
# ask for random number to check correctness # ask for random number to check correctness
words = list(enumerate(mnemonic.split())) words = list(enumerate(mnemonic.split()))
index = random.uniform(len(words)) index = random.uniform(len(words))
word = words[index] word = words[index][1]
board = MnemonicKeyboard() board = MnemonicKeyboard()
board.prompt = ('Type %s. word' % (index + 1)) board.prompt = ('Type %s. word' % (index + 1))
res = await board res = await board
# TBD if res != word:
if res is not word: fail_content = Text('Wrong entry!', ui.ICON_CLEAR, ui.NORMAL,
fail_content = Text('Failed!', ui.ICON_NOCOPY, ui.NORMAL,
'You have entered', 'You have entered',
'wrong seed word.', 'wrong seed word.',
'Please, reconnect', 'Please, reconnect',
'device and try again.') 'device and try again.', icon_color=ui.RED)
# todo redesign dialog to single cancel button with text 'Reconnect' or something else (no icon)
await require_confirm(ctx, fail_content, ButtonRequestType.ResetDevice) await require_confirm(ctx, fail_content, ButtonRequestType.ResetDevice)
if curpin != newpin: if curpin != newpin:
config.change_pin(curpin, newpin) config.change_pin(curpin, newpin)
storage.load_settings(label=msg.label, storage.load_settings(label=msg.label,
use_passphrase=msg.passphrase_protection) use_passphrase=msg.passphrase_protection)
storage.load_mnemonic(mnemonic) storage.load_mnemonic(mnemonic)
fail_content = Text('Backup is done!', ui.ICON_CONFIRM, ui.NORMAL,
'Never make a digital',
'copy of your recovery',
'seed and never upload',
'it online!', icon_color=ui.GREEN)
# todo redesign dialog to single cancel button with text 'Finish?' or something else (no icon)
await require_confirm(ctx, fail_content, ButtonRequestType.ResetDevice)
return Success(message='Initialized') return Success(message='Initialized')
@ -148,5 +156,6 @@ async def show_mnemonic_page(page, page_count, mnemonic):
'Finalize', 'Finalize',
normal_style=ui.BTN_CONFIRM, normal_style=ui.BTN_CONFIRM,
active_style=ui.BTN_CONFIRM_ACTIVE) active_style=ui.BTN_CONFIRM_ACTIVE)
ui.display.clear()
else: else:
await animate_swipe() await animate_swipe()