From 63945ab86f1bf7b4ca44916cc596459e3d6149c2 Mon Sep 17 00:00:00 2001 From: obrusvit Date: Tue, 14 May 2024 00:17:12 +0200 Subject: [PATCH] refactor(core): remove upper() calls in mercury [no changelog] --- .../src/trezor/ui/layouts/mercury/__init__.py | 51 ++++++++----------- core/src/trezor/ui/layouts/mercury/fido.py | 2 +- .../src/trezor/ui/layouts/mercury/progress.py | 2 +- .../src/trezor/ui/layouts/mercury/recovery.py | 2 +- core/src/trezor/ui/layouts/mercury/reset.py | 2 +- 5 files changed, 24 insertions(+), 35 deletions(-) diff --git a/core/src/trezor/ui/layouts/mercury/__init__.py b/core/src/trezor/ui/layouts/mercury/__init__.py index 71675f7a35..7b013089fc 100644 --- a/core/src/trezor/ui/layouts/mercury/__init__.py +++ b/core/src/trezor/ui/layouts/mercury/__init__.py @@ -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, diff --git a/core/src/trezor/ui/layouts/mercury/fido.py b/core/src/trezor/ui/layouts/mercury/fido.py index 9dc42c152f..f4f628e469 100644 --- a/core/src/trezor/ui/layouts/mercury/fido.py +++ b/core/src/trezor/ui/layouts/mercury/fido.py @@ -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, diff --git a/core/src/trezor/ui/layouts/mercury/progress.py b/core/src/trezor/ui/layouts/mercury/progress.py index 472e6d30ee..63e6acc25c 100644 --- a/core/src/trezor/ui/layouts/mercury/progress.py +++ b/core/src/trezor/ui/layouts/mercury/progress.py @@ -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 "", ) diff --git a/core/src/trezor/ui/layouts/mercury/recovery.py b/core/src/trezor/ui/layouts/mercury/recovery.py index 410434d107..fd61afaecc 100644 --- a/core/src/trezor/ui/layouts/mercury/recovery.py +++ b/core/src/trezor/ui/layouts/mercury/recovery.py @@ -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, ) diff --git a/core/src/trezor/ui/layouts/mercury/reset.py b/core/src/trezor/ui/layouts/mercury/reset.py index 0ad630ecad..a614ddc8b4 100644 --- a/core/src/trezor/ui/layouts/mercury/reset.py +++ b/core/src/trezor/ui/layouts/mercury/reset.py @@ -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,