mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-18 05:28:40 +00:00
src/apps/management: add link to ToS to reset_device
This commit is contained in:
parent
a96d1f78d0
commit
5a79f318a4
@ -31,8 +31,16 @@ async def reset_device(ctx, msg):
|
|||||||
if storage.is_initialized():
|
if storage.is_initialized():
|
||||||
raise wire.UnexpectedMessage("Already initialized")
|
raise wire.UnexpectedMessage("Already initialized")
|
||||||
|
|
||||||
text = Text("Create a new wallet", ui.ICON_RESET)
|
text = Text("Create a new wallet", ui.ICON_RESET, new_lines=False)
|
||||||
text.normal("Do you really want to", "create a new wallet?", "")
|
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)
|
await require_confirm(ctx, text, code=ButtonRequestType.ResetDevice)
|
||||||
|
|
||||||
|
@ -4,11 +4,13 @@ from trezor import ui
|
|||||||
|
|
||||||
TEXT_HEADER_HEIGHT = const(48)
|
TEXT_HEADER_HEIGHT = const(48)
|
||||||
TEXT_LINE_HEIGHT = const(26)
|
TEXT_LINE_HEIGHT = const(26)
|
||||||
|
TEXT_LINE_HEIGHT_HALF = const(13)
|
||||||
TEXT_MARGIN_LEFT = const(14)
|
TEXT_MARGIN_LEFT = const(14)
|
||||||
TEXT_MAX_LINES = const(5)
|
TEXT_MAX_LINES = const(5)
|
||||||
|
|
||||||
# needs to be different from all colors and font ids
|
# needs to be different from all colors and font ids
|
||||||
BR = const(-256)
|
BR = const(-256)
|
||||||
|
BR_HALF = const(-257)
|
||||||
|
|
||||||
|
|
||||||
def render_text(words: list, new_lines: bool, max_lines: int) -> None:
|
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
|
has_next_word = word_index < len(words) - 1
|
||||||
|
|
||||||
if isinstance(word, int):
|
if isinstance(word, int):
|
||||||
if word == BR:
|
if word in [BR, BR_HALF]:
|
||||||
# line break
|
# line break or half-line break
|
||||||
if offset_y >= OFFSET_Y_MAX:
|
if offset_y >= OFFSET_Y_MAX:
|
||||||
ui.display.text(offset_x, offset_y, "...", ui.BOLD, ui.GREY, bg)
|
ui.display.text(offset_x, offset_y, "...", ui.BOLD, ui.GREY, bg)
|
||||||
return
|
return
|
||||||
offset_x = TEXT_MARGIN_LEFT
|
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:
|
elif word in FONTS:
|
||||||
# change of font style
|
# change of font style
|
||||||
font = word
|
font = word
|
||||||
@ -141,6 +143,9 @@ class Text(ui.Widget):
|
|||||||
def br(self):
|
def br(self):
|
||||||
self.content.append(BR)
|
self.content.append(BR)
|
||||||
|
|
||||||
|
def br_half(self):
|
||||||
|
self.content.append(BR_HALF)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
if self.tainted:
|
if self.tainted:
|
||||||
ui.header(
|
ui.header(
|
||||||
|
Loading…
Reference in New Issue
Block a user