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

refactor(core): remove upper() calls in mercury

[no changelog]
This commit is contained in:
obrusvit 2024-05-14 00:17:12 +02:00 committed by Martin Milata
parent 03cd4fe363
commit 63945ab86f
5 changed files with 24 additions and 35 deletions

View File

@ -250,11 +250,6 @@ async def confirm_action(
exc: ExceptionType = ActionCancelled,
br_code: ButtonRequestType = BR_TYPE_OTHER,
) -> None:
if verb is not None:
verb = verb.upper()
if verb_cancel is not None:
verb_cancel = verb_cancel.upper()
if description is not None and description_param is not None:
description = description.format(description_param)
@ -262,7 +257,7 @@ async def confirm_action(
interact(
RustLayout(
trezorui2.confirm_action(
title=title.upper(),
title=title,
action=action,
description=description,
verb=verb,
@ -286,8 +281,6 @@ async def confirm_single(
description_param: str | None = None,
verb: str | None = None,
) -> None:
if verb is not None:
verb = verb.upper()
description_param = description_param or ""
# Placeholders are coming from translations in form of {0}
@ -300,7 +293,7 @@ async def confirm_single(
interact(
RustLayout(
trezorui2.confirm_emphasized(
title=title.upper(),
title=title,
items=(begin, (True, description_param), end),
verb=verb,
)
@ -461,7 +454,7 @@ def show_pubkey(
mismatch_title = mismatch_title or TR.addr_mismatch__key_mismatch # def_arg
return show_address(
address=pubkey,
title=title.upper(),
title=title,
account=account,
path=path,
br_type=br_type,
@ -484,7 +477,7 @@ async def show_error_and_raise(
trezorui2.show_error(
title=subheader or "",
description=content,
button=button.upper(),
button=button,
allow_cancel=False,
)
),
@ -508,7 +501,7 @@ async def show_warning(
trezorui2.show_warning(
title=content,
description=subheader or "",
button=button.upper(),
button=button,
)
),
br_type,
@ -564,7 +557,7 @@ async def confirm_output(
result = await interact(
RustLayout(
trezorui2.confirm_value(
title=recipient_title.upper(),
title=recipient_title,
subtitle=address_label,
description=None,
value=address,
@ -583,7 +576,7 @@ async def confirm_output(
result = await interact(
RustLayout(
trezorui2.confirm_value(
title=amount_title.upper(),
title=amount_title,
subtitle=None,
description=None,
value=amount,
@ -652,10 +645,10 @@ async def should_show_more(
result = await interact(
RustLayout(
trezorui2.confirm_with_info(
title=title.upper(),
title=title,
items=para,
button=confirm.upper(),
info_button=button_text.upper(),
button=confirm,
info_button=button_text,
)
),
br_type,
@ -723,7 +716,6 @@ async def confirm_blob(
chunkify: bool = False,
) -> None:
verb = verb or TR.buttons__confirm # def_arg
title = title.upper()
layout = RustLayout(
trezorui2.confirm_blob(
title=title,
@ -823,9 +815,6 @@ def confirm_value(
if not verb and not hold:
raise ValueError("Either verb or hold=True must be set")
if verb:
verb = verb.upper()
info_items = info_items or []
info_layout = RustLayout(
trezorui2.show_info_with_cancel(
@ -839,7 +828,7 @@ def confirm_value(
with_info(
RustLayout(
trezorui2.confirm_value(
title=title.upper(),
title=title,
subtitle=subtitle,
description=description,
value=value,
@ -870,7 +859,7 @@ async def confirm_properties(
interact(
RustLayout(
trezorui2.confirm_properties(
title=title.upper(),
title=title,
items=items,
hold=hold,
)
@ -927,7 +916,7 @@ async def confirm_summary(
total_layout = RustLayout(
trezorui2.confirm_total(
title=title.upper(),
title=title,
items=items,
info_button=bool(info_items),
)
@ -935,7 +924,7 @@ async def confirm_summary(
info_items = info_items or []
info_layout = RustLayout(
trezorui2.show_info_with_cancel(
title=info_title.upper() if info_title else TR.words__title_information,
title=info_title if info_title else TR.words__title_information,
items=info_items,
)
)
@ -975,7 +964,7 @@ if not utils.BITCOIN_ONLY:
# Allowing going back and forth between recipient and summary/details
await confirm_blob(
br_type,
TR.words__recipient.upper(),
TR.words__recipient,
recipient,
verb=TR.buttons__continue,
chunkify=chunkify,
@ -1086,11 +1075,11 @@ async def confirm_metadata(
verb = verb or TR.buttons__continue # def_arg
await confirm_action(
br_type,
title=title.upper(),
title=title,
action="",
description=content,
description_param=param,
verb=verb.upper(),
verb=verb,
hold=hold,
br_code=br_code,
)
@ -1099,7 +1088,7 @@ async def confirm_metadata(
async def confirm_replacement(title: str, txid: str) -> None:
await confirm_blob(
"confirm_replacement",
title.upper(),
title,
txid,
TR.send__transaction_id,
TR.buttons__continue,
@ -1186,7 +1175,7 @@ async def confirm_modify_fee(
) -> None:
fee_layout = RustLayout(
trezorui2.confirm_modify_fee(
title=title.upper(),
title=title,
sign=sign,
user_fee_change=user_fee_change,
total_fee_new=total_fee_new,
@ -1444,7 +1433,7 @@ async def confirm_set_new_pin(
interact(
RustLayout(
trezorui2.confirm_emphasized(
title=title.upper(),
title=title,
items=(
(True, description + "\n\n"),
information,

View File

@ -56,7 +56,7 @@ async def confirm_fido(
"""Webauthn confirmation for one or more credentials."""
confirm = _RustFidoLayout(
trezorui2.confirm_fido(
title=header.upper(),
title=header,
app_name=app_name,
icon_name=icon_name,
accounts=accounts,

View File

@ -39,7 +39,7 @@ def progress(
message = message or TR.progress__please_wait # def_arg
return RustProgress(
layout=trezorui2.show_progress(
title=message.upper(),
title=message,
indeterminate=indeterminate,
description=description or "",
)

View File

@ -132,7 +132,7 @@ async def continue_recovery(
trezorui2.confirm_recovery(
title=text,
description=description,
button=button_label.upper(),
button=button_label,
info_button=info_func is not None,
dry_run=dry_run,
)

View File

@ -139,7 +139,7 @@ async def _prompt_number(
) -> int:
num_input = RustLayout(
trezorui2.request_number(
title=title.upper(),
title=title,
description=description,
count=count,
min_count=min_count,