From b97e5b7a55e520c03bf5f389e437a1277b1392fb Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 26 Feb 2018 23:00:50 +0100 Subject: [PATCH] src/trezor/ui: use ICON_DEFAULT by default, not ICON_RESET --- src/apps/common/request_passphrase.py | 4 ++-- src/apps/ethereum/get_address.py | 2 +- src/apps/ethereum/layout.py | 6 +++--- src/apps/fido_u2f/__init__.py | 2 +- src/apps/homescreen/__init__.py | 2 +- src/apps/management/apply_settings.py | 8 ++++---- src/apps/management/change_pin.py | 6 +++--- src/apps/management/load_device.py | 2 +- src/apps/wallet/get_address.py | 4 ++-- src/apps/wallet/get_entropy.py | 2 +- src/apps/wallet/sign_tx/layout.py | 6 +++--- src/trezor/ui/__init__.py | 2 +- src/trezor/ui/style.py | 1 + 13 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/apps/common/request_passphrase.py b/src/apps/common/request_passphrase.py index a577aedb95..fd5925767a 100644 --- a/src/apps/common/request_passphrase.py +++ b/src/apps/common/request_passphrase.py @@ -13,7 +13,7 @@ from apps.common.cache import get_state @ui.layout async def request_passphrase_entry(ctx): text = Text( - 'Enter passphrase', ui.ICON_RESET, + 'Enter passphrase', ui.ICON_DEFAULT, 'Where to enter your', 'passphrase?') text.render() @@ -31,7 +31,7 @@ async def request_passphrase_entry(ctx): async def request_passphrase_ack(ctx, on_device): if not on_device: text = Text( - 'Passphrase entry', ui.ICON_RESET, + 'Passphrase entry', ui.ICON_DEFAULT, 'Please, type passphrase', 'on connected host.') text.render() diff --git a/src/apps/ethereum/get_address.py b/src/apps/ethereum/get_address.py index efcab8c5d6..8f7fbc581e 100644 --- a/src/apps/ethereum/get_address.py +++ b/src/apps/ethereum/get_address.py @@ -32,7 +32,7 @@ async def _show_address(ctx, address): lines = _split_address(address) content = Container( Qr(address, (120, 135), 3), - Text('Confirm address', ui.ICON_RESET, ui.MONO, *lines)) + Text('Confirm address', ui.ICON_DEFAULT, ui.MONO, *lines)) await require_confirm(ctx, content, code=Address) diff --git a/src/apps/ethereum/layout.py b/src/apps/ethereum/layout.py index 6e795fb0f5..759ffd6a89 100644 --- a/src/apps/ethereum/layout.py +++ b/src/apps/ethereum/layout.py @@ -9,7 +9,7 @@ from . import networks async def confirm_tx(ctx, to, value, chain_id, token=None): # TODO: wording str_to = '0x' + hexlify(to).decode() # TODO: use ethereum address format - content = Text('Confirm transaction', ui.ICON_RESET, + content = Text('Confirm transaction', ui.ICON_DEFAULT, ui.BOLD, format_ethereum_amount(value, token, chain_id), ui.NORMAL, 'to', ui.MONO, *split_address(str_to)) @@ -17,7 +17,7 @@ async def confirm_tx(ctx, to, value, chain_id, token=None): # TODO: wording async def confirm_fee(ctx, spending, gas_price, gas_limit, chain_id, token=None): # TODO: wording - content = Text('Confirm fee', ui.ICON_RESET, + content = Text('Confirm fee', ui.ICON_DEFAULT, 'Sending: %s' % format_ethereum_amount(spending, token, chain_id), 'Gas: %s' % format_ethereum_amount(gas_price, token, chain_id), 'Limit: %s' % format_ethereum_amount(gas_limit, token, chain_id)) @@ -26,7 +26,7 @@ async def confirm_fee(ctx, spending, gas_price, gas_limit, chain_id, token=None) async def confirm_data(ctx, data, data_total): # TODO: wording str_data = hexlify(data[:8]).decode() + '..' - content = Text('Confirm data:', ui.ICON_RESET, + content = Text('Confirm data:', ui.ICON_DEFAULT, ui.MONO, str_data, 'Total: ', str(data_total) + 'B') return await confirm(ctx, content, ButtonRequestType.SignTx) # we use SignTx, not ConfirmOutput, for compatibility with T1 diff --git a/src/apps/fido_u2f/__init__.py b/src/apps/fido_u2f/__init__.py index c0b99b1510..7d0cc8d026 100644 --- a/src/apps/fido_u2f/__init__.py +++ b/src/apps/fido_u2f/__init__.py @@ -431,7 +431,7 @@ class ConfirmContent(ui.Widget): header = 'U2F Register' else: header = 'U2F Authenticate' - ui.header(header, ui.ICON_RESET, ui.GREEN, ui.BG, ui.GREEN) + ui.header(header, ui.ICON_DEFAULT, ui.GREEN, ui.BG, ui.GREEN) ui.display.image((240 - 64) // 2, 90, self.app_icon) ui.display.text_center(120, 185, self.app_name, ui.MONO, ui.FG, ui.BG) diff --git a/src/apps/homescreen/__init__.py b/src/apps/homescreen/__init__.py index e320fb812b..2e5d61952e 100644 --- a/src/apps/homescreen/__init__.py +++ b/src/apps/homescreen/__init__.py @@ -47,7 +47,7 @@ async def respond_Pong(ctx, msg): from trezor.messages.ButtonRequestType import ProtectCall from trezor.ui.text import Text from trezor import ui - await require_confirm(ctx, Text('Confirm', ui.ICON_RESET), ProtectCall) + await require_confirm(ctx, Text('Confirm', ui.ICON_DEFAULT), ProtectCall) if msg.passphrase_protection: from apps.common.request_passphrase import protect_by_passphrase diff --git a/src/apps/management/apply_settings.py b/src/apps/management/apply_settings.py index c100434fc8..09cd8a0e56 100644 --- a/src/apps/management/apply_settings.py +++ b/src/apps/management/apply_settings.py @@ -13,25 +13,25 @@ async def layout_apply_settings(ctx, msg): if msg.homescreen is not None: await require_confirm(ctx, Text( - 'Change homescreen', ui.ICON_RESET, + 'Change homescreen', ui.ICON_DEFAULT, 'Do you really want to', 'change homescreen?')) if msg.label is not None: await require_confirm(ctx, Text( - 'Change label', ui.ICON_RESET, + 'Change label', ui.ICON_DEFAULT, 'Do you really want to', 'change label to', ui.BOLD, '%s?' % msg.label)) # TODO: split label (bold) and '?' (normal) once we support mixed styles on one line if msg.language is not None: await require_confirm(ctx, Text( - 'Change language', ui.ICON_RESET, + 'Change language', ui.ICON_DEFAULT, 'Do you really want to', 'change language to', ui.BOLD, '%s?' % msg.language)) # TODO: split lang (bold) and '?' (normal) once we support mixed styles on one line if msg.use_passphrase is not None: await require_confirm(ctx, Text( 'Enable passphrase' if msg.use_passphrase else 'Disable passphrase', - ui.ICON_RESET, + ui.ICON_DEFAULT, 'Do you really want to', 'enable passphrase' if msg.use_passphrase else 'disable passphrase', 'encryption?')) diff --git a/src/apps/management/change_pin.py b/src/apps/management/change_pin.py index 823c496ed3..fa67b0ad03 100644 --- a/src/apps/management/change_pin.py +++ b/src/apps/management/change_pin.py @@ -34,19 +34,19 @@ def confirm_change_pin(ctx, msg): if msg.remove and has_pin: # removing pin return require_confirm(ctx, Text( - 'Remove PIN', ui.ICON_RESET, + 'Remove PIN', ui.ICON_DEFAULT, 'Do you really want to', ui.BOLD, 'remove current PIN?')) if not msg.remove and has_pin: # changing pin return require_confirm(ctx, Text( - 'Change PIN', ui.ICON_RESET, + 'Change PIN', ui.ICON_DEFAULT, 'Do you really want to', ui.BOLD, 'change current PIN?')) if not msg.remove and not has_pin: # setting new pin return require_confirm(ctx, Text( - 'Change PIN', ui.ICON_RESET, + 'Change PIN', ui.ICON_DEFAULT, 'Do you really want to', ui.BOLD, 'set new PIN?')) diff --git a/src/apps/management/load_device.py b/src/apps/management/load_device.py index 6bc00465c9..0cb94b06df 100644 --- a/src/apps/management/load_device.py +++ b/src/apps/management/load_device.py @@ -20,7 +20,7 @@ async def layout_load_device(ctx, msg): raise wire.FailureError(ProcessError, 'Mnemonic is not valid') await require_confirm(ctx, Text( - 'Loading seed', ui.ICON_RESET, + 'Loading seed', ui.ICON_DEFAULT, ui.BOLD, 'Loading private seed', 'is not recommended.', ui.NORMAL, 'Continue only if you', 'know what you are doing!')) diff --git a/src/apps/wallet/get_address.py b/src/apps/wallet/get_address.py index aef0b5db8c..c7c3c3fe26 100644 --- a/src/apps/wallet/get_address.py +++ b/src/apps/wallet/get_address.py @@ -32,7 +32,7 @@ async def _show_address(ctx, address): from ..common.confirm import confirm lines = _split_address(address) - content = Text('Confirm address', ui.ICON_RESET, ui.MONO, *lines) + content = Text('Confirm address', ui.ICON_DEFAULT, ui.MONO, *lines) return await confirm(ctx, content, code=Address, cancel='QR', cancel_style=ui.BTN_KEY) @@ -49,7 +49,7 @@ async def _show_qr(ctx, address): content = Container( Qr(address, (qr_x, qr_y), qr_coef), - Text('Confirm address', ui.ICON_RESET, ui.MONO)) + Text('Confirm address', ui.ICON_DEFAULT, ui.MONO)) return await confirm(ctx, content, code=Address, cancel='Address', cancel_style=ui.BTN_KEY) diff --git a/src/apps/wallet/get_entropy.py b/src/apps/wallet/get_entropy.py index 4e6fe2b158..41039d6a90 100644 --- a/src/apps/wallet/get_entropy.py +++ b/src/apps/wallet/get_entropy.py @@ -19,7 +19,7 @@ async def _show_entropy(ctx): from ..common.confirm import require_confirm await require_confirm(ctx, Text( - 'Confirm entropy', ui.ICON_RESET, + 'Confirm entropy', ui.ICON_DEFAULT, ui.BOLD, 'Do you really want', 'to send entropy?', ui.NORMAL, 'Continue only if you', 'know what you are doing!'), code=ProtectCall) diff --git a/src/apps/wallet/sign_tx/layout.py b/src/apps/wallet/sign_tx/layout.py index d93bb70bd8..d96d9c7d41 100644 --- a/src/apps/wallet/sign_tx/layout.py +++ b/src/apps/wallet/sign_tx/layout.py @@ -20,7 +20,7 @@ async def confirm_output(ctx, output, coin): address = 'OP_RETURN' # TODO: handle OP_RETURN correctly else: address = output.address - content = Text('Confirm output', ui.ICON_RESET, + content = Text('Confirm output', ui.ICON_DEFAULT, ui.BOLD, format_coin_amount(output.amount, coin), ui.NORMAL, 'to', ui.MONO, *split_address(address)) @@ -28,13 +28,13 @@ async def confirm_output(ctx, output, coin): async def confirm_total(ctx, spending, fee, coin): - content = Text('Confirm transaction', ui.ICON_RESET, + content = Text('Confirm transaction', ui.ICON_DEFAULT, 'Sending: %s' % format_coin_amount(spending, coin), 'Fee: %s' % format_coin_amount(fee, coin)) return await hold_to_confirm(ctx, content, ButtonRequestType.SignTx) async def confirm_feeoverthreshold(ctx, fee, coin): - content = Text('Confirm high fee:', ui.ICON_RESET, + content = Text('Confirm high fee:', ui.ICON_DEFAULT, ui.BOLD, format_coin_amount(fee, coin)) return await confirm(ctx, content, ButtonRequestType.FeeOverThreshold) diff --git a/src/trezor/ui/__init__.py b/src/trezor/ui/__init__.py index eb2395ae51..189df04971 100644 --- a/src/trezor/ui/__init__.py +++ b/src/trezor/ui/__init__.py @@ -123,7 +123,7 @@ def layout(f): def header(title: str, - icon: bytes=ICON_RESET, + icon: bytes=ICON_DEFAULT, fg: int=BG, bg: int=BG, ifg: int=BG): diff --git a/src/trezor/ui/style.py b/src/trezor/ui/style.py index 41e8076bc0..f810e40e2e 100644 --- a/src/trezor/ui/style.py +++ b/src/trezor/ui/style.py @@ -45,6 +45,7 @@ BG = BLACK FG = WHITE # icons +ICON_DEFAULT = 'trezor/res/header_icons/reset.toig' ICON_RESET = 'trezor/res/header_icons/reset.toig' ICON_WIPE = 'trezor/res/header_icons/wipe.toig' ICON_RECOVERY = 'trezor/res/recovery.toig'