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

View File

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

View File

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

View File

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

View File

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