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

src/apps/management: add link to ToS to reset_device

This commit is contained in:
Pavol Rusnak 2018-12-10 17:56:54 +01:00
parent a96d1f78d0
commit 5a79f318a4
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 18 additions and 5 deletions

View File

@ -31,8 +31,16 @@ async def reset_device(ctx, msg):
if storage.is_initialized():
raise wire.UnexpectedMessage("Already initialized")
text = Text("Create a new wallet", ui.ICON_RESET)
text.normal("Do you really want to", "create a new wallet?", "")
text = Text("Create a new wallet", ui.ICON_RESET, new_lines=False)
text.normal("Do you really want to")
text.br()
text.normal("create a new wallet?")
text.br()
text.br_half()
text.normal("By continuing you agree")
text.br()
text.normal("to")
text.bold("https://trezor.io/tos")
await require_confirm(ctx, text, code=ButtonRequestType.ResetDevice)

View File

@ -4,11 +4,13 @@ from trezor import ui
TEXT_HEADER_HEIGHT = const(48)
TEXT_LINE_HEIGHT = const(26)
TEXT_LINE_HEIGHT_HALF = const(13)
TEXT_MARGIN_LEFT = const(14)
TEXT_MAX_LINES = const(5)
# needs to be different from all colors and font ids
BR = const(-256)
BR_HALF = const(-257)
def render_text(words: list, new_lines: bool, max_lines: int) -> None:
@ -31,13 +33,13 @@ def render_text(words: list, new_lines: bool, max_lines: int) -> None:
has_next_word = word_index < len(words) - 1
if isinstance(word, int):
if word == BR:
# line break
if word in [BR, BR_HALF]:
# line break or half-line break
if offset_y >= OFFSET_Y_MAX:
ui.display.text(offset_x, offset_y, "...", ui.BOLD, ui.GREY, bg)
return
offset_x = TEXT_MARGIN_LEFT
offset_y += TEXT_LINE_HEIGHT
offset_y += TEXT_LINE_HEIGHT if word == BR else TEXT_LINE_HEIGHT_HALF
elif word in FONTS:
# change of font style
font = word
@ -141,6 +143,9 @@ class Text(ui.Widget):
def br(self):
self.content.append(BR)
def br_half(self):
self.content.append(BR_HALF)
def render(self):
if self.tainted:
ui.header(