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

chore(all): small design fixes

[no changelog]
This commit is contained in:
grdddj 2023-07-11 17:25:44 +02:00 committed by Jiří Musil
parent fb6b96415b
commit 52c69de138
8 changed files with 17 additions and 19 deletions

View File

@ -543,7 +543,7 @@ extern "C" fn new_confirm_modify_output(n_args: usize, args: *const Obj, kwargs:
Paragraph::new(&theme::TEXT_BOLD, "Address:".into()), Paragraph::new(&theme::TEXT_BOLD, "Address:".into()),
Paragraph::new(&theme::TEXT_MONO, address).break_after(), Paragraph::new(&theme::TEXT_MONO, address).break_after(),
Paragraph::new(&theme::TEXT_NORMAL, description.into()), Paragraph::new(&theme::TEXT_NORMAL, description.into()),
Paragraph::new(&theme::TEXT_MONO, amount_change), Paragraph::new(&theme::TEXT_MONO, amount_change).break_after(),
Paragraph::new(&theme::TEXT_BOLD, "New amount:".into()), Paragraph::new(&theme::TEXT_BOLD, "New amount:".into()),
Paragraph::new(&theme::TEXT_MONO, amount_new), Paragraph::new(&theme::TEXT_MONO, amount_new),
]); ]);

View File

@ -230,7 +230,7 @@ async def _require_confirm_change_autolock_delay(delay_ms: int) -> None:
await confirm_action( await confirm_action(
"set_autolock_delay", "set_autolock_delay",
"Auto-lock delay", "Auto-lock delay",
description="Do you really want to auto-lock your device after {}?", description="Auto-lock your Trezor after {} of inactivity?",
description_param=format_duration_ms(delay_ms), description_param=format_duration_ms(delay_ms),
br_code=BRT_PROTECT_CALL, br_code=BRT_PROTECT_CALL,
) )

View File

@ -401,7 +401,6 @@ async def confirm_reset_device(
if recovery: if recovery:
await confirm_action( await confirm_action(
ctx,
"recover_device", "recover_device",
title, title,
description="It is safe to eject your Trezor anytime and continue later.", description="It is safe to eject your Trezor anytime and continue later.",
@ -879,6 +878,9 @@ def confirm_value(
if not verb and not hold: if not verb and not hold:
raise ValueError("Either verb or hold=True must be set") raise ValueError("Either verb or hold=True must be set")
if verb:
verb = verb.upper()
return raise_if_not_confirmed( return raise_if_not_confirmed(
interact( interact(
RustLayout( RustLayout(
@ -901,7 +903,7 @@ async def confirm_total(
fee_amount: str, fee_amount: str,
fee_rate_amount: str | None = None, fee_rate_amount: str | None = None,
title: str = "SENDING", title: str = "SENDING",
total_label: str = "TOTAL AMOUNT", total_label: str = "Total amount:",
fee_label: str = "Including fee:", fee_label: str = "Including fee:",
account_label: str | None = None, account_label: str | None = None,
br_type: str = "confirm_total", br_type: str = "confirm_total",
@ -916,7 +918,7 @@ async def confirm_total(
fee_amount=fee_amount, # type: ignore [No parameter named] fee_amount=fee_amount, # type: ignore [No parameter named]
fee_rate_amount=fee_rate_amount, # type: ignore [No parameter named] fee_rate_amount=fee_rate_amount, # type: ignore [No parameter named]
account_label=account_label, # type: ignore [No parameter named] account_label=account_label, # type: ignore [No parameter named]
total_label=total_label.upper(), # type: ignore [No parameter named] total_label=total_label, # type: ignore [No parameter named]
fee_label=fee_label, # type: ignore [No parameter named] fee_label=fee_label, # type: ignore [No parameter named]
) )
), ),

View File

@ -268,7 +268,6 @@ async def show_success_backup() -> None:
async def show_reset_warning( async def show_reset_warning(
ctx: GenericContext,
br_type: str, br_type: str,
content: str, content: str,
subheader: str | None = None, subheader: str | None = None,
@ -276,7 +275,6 @@ async def show_reset_warning(
br_code: ButtonRequestType = ButtonRequestType.Warning, br_code: ButtonRequestType = ButtonRequestType.Warning,
) -> None: ) -> None:
await show_warning( await show_warning(
ctx,
br_type, br_type,
button.upper(), button.upper(),
subheader or "", subheader or "",

View File

@ -143,12 +143,10 @@ def enter_share(
def enter_shares(debug: "DebugLink", shares: list[str]) -> None: def enter_shares(debug: "DebugLink", shares: list[str]) -> None:
layout = debug.read_layout() layout = debug.read_layout()
expected_text = "Enter any share" expected_text = "Enter any share"
remaining = len(shares)
for index, share in enumerate(shares): for index, share in enumerate(shares):
assert expected_text in layout.text_content() assert expected_text in layout.text_content()
layout = enter_share(debug, share, is_first=index == 0) layout = enter_share(debug, share, is_first=index == 0)
remaining -= 1 expected_text = f"{index + 1} of {len(shares)} shares entered"
expected_text = f"{remaining} more share"
assert "Wallet recovered successfully" in layout.text_content() assert "Wallet recovered successfully" in layout.text_content()

View File

@ -63,7 +63,7 @@ def set_autolock_delay(device_handler: "BackgroundDeviceHandler", delay_ms: int)
debug.input("1234") debug.input("1234")
assert ( assert (
f"auto-lock your device after {delay_ms // 1000} seconds" f"Auto-lock your Trezor after {delay_ms // 1000} seconds"
in debug.wait_layout().text_content() in debug.wait_layout().text_content()
) )
layout = go_next(debug, wait=True) layout = go_next(debug, wait=True)
@ -106,7 +106,7 @@ def test_autolock_interrupts_signing(device_handler: "BackgroundDeviceHandler"):
elif debug.model == "R": elif debug.model == "R":
debug.press_right(wait=True) debug.press_right(wait=True)
layout = debug.press_right(wait=True) layout = debug.press_right(wait=True)
assert "TOTAL AMOUNT 0.0039 BTC" in layout.text_content() assert "Total amount: 0.0039 BTC" in layout.text_content()
# wait for autolock to kick in # wait for autolock to kick in
time.sleep(10.1) time.sleep(10.1)
@ -151,7 +151,7 @@ def test_autolock_does_not_interrupt_signing(device_handler: "BackgroundDeviceHa
elif debug.model == "R": elif debug.model == "R":
debug.press_right(wait=True) debug.press_right(wait=True)
layout = debug.press_right(wait=True) layout = debug.press_right(wait=True)
assert "TOTAL AMOUNT 0.0039 BTC" in layout.text_content() assert "Total amount: 0.0039 BTC" in layout.text_content()
def sleepy_filter(msg: MessageType) -> MessageType: def sleepy_filter(msg: MessageType) -> MessageType:
time.sleep(10.1) time.sleep(10.1)
@ -301,7 +301,7 @@ def test_dryrun_locks_at_word_entry(device_handler: "BackgroundDeviceHandler"):
assert layout.main_component() == "MnemonicKeyboard" assert layout.main_component() == "MnemonicKeyboard"
elif debug.model == "R": elif debug.model == "R":
layout = debug.press_right(wait=True) layout = debug.press_right(wait=True)
assert "RECOVER WALLET" in layout.title() assert layout.title() in ("RECOVER WALLET", "BACKUP CHECK")
debug.press_right() debug.press_right()
layout = debug.press_right(wait=True) layout = debug.press_right(wait=True)
assert "Slip39Entry" in layout.all_components() assert "Slip39Entry" in layout.all_components()
@ -338,7 +338,7 @@ def test_dryrun_enter_word_slowly(device_handler: "BackgroundDeviceHandler"):
assert layout.main_component() == "MnemonicKeyboard" assert layout.main_component() == "MnemonicKeyboard"
elif debug.model == "R": elif debug.model == "R":
layout = debug.press_right(wait=True) layout = debug.press_right(wait=True)
assert "RECOVER WALLET" in layout.title() assert layout.title() in ("RECOVER WALLET", "BACKUP CHECK")
debug.press_right() debug.press_right()
layout = debug.press_right(wait=True) layout = debug.press_right(wait=True)
assert "Slip39Entry" in layout.all_components() assert "Slip39Entry" in layout.all_components()

View File

@ -1419,7 +1419,7 @@ def bip39_recovery_possible_pin_tr(
debug.input("654") debug.input("654")
yield yield
assert "re-enter to confirm" in debug.wait_layout().text_content() assert "re-enter PIN to confirm" in debug.wait_layout().text_content()
debug.press_right() debug.press_right()
yield yield
@ -1792,8 +1792,8 @@ class InputFlowResetSkipBackup(InputFlowBase):
self.debug.press_right() self.debug.press_right()
self.debug.press_yes() self.debug.press_yes()
yield # Skip Backup yield # Skip Backup
self.debug.press_no()
yield # Confirm skip backup
if self.debug.model == "R": if self.debug.model == "R":
self.debug.press_right() self.debug.press_right()
self.debug.press_no() self.debug.press_no()
yield # Confirm skip backup
self.debug.press_no()

View File

@ -146,7 +146,7 @@ def test_recovery_on_old_wallet(core_emulator: Emulator):
layout = debug.wait_layout() layout = debug.wait_layout()
# check that we entered the first share successfully # check that we entered the first share successfully
assert "2 more shares" in layout.text_content() assert "1 of 3 shares entered" in layout.text_content()
# try entering the remaining shares # try entering the remaining shares
for share in MNEMONIC_SLIP39_BASIC_20_3of6[1:3]: for share in MNEMONIC_SLIP39_BASIC_20_3of6[1:3]: