1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

src/trezor/ui: use ICON_DEFAULT by default, not ICON_RESET

This commit is contained in:
Pavol Rusnak 2018-02-26 23:00:50 +01:00
parent 081dcdd98f
commit b97e5b7a55
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
13 changed files with 24 additions and 23 deletions

View File

@ -13,7 +13,7 @@ from apps.common.cache import get_state
@ui.layout @ui.layout
async def request_passphrase_entry(ctx): async def request_passphrase_entry(ctx):
text = Text( text = Text(
'Enter passphrase', ui.ICON_RESET, 'Enter passphrase', ui.ICON_DEFAULT,
'Where to enter your', 'passphrase?') 'Where to enter your', 'passphrase?')
text.render() text.render()
@ -31,7 +31,7 @@ async def request_passphrase_entry(ctx):
async def request_passphrase_ack(ctx, on_device): async def request_passphrase_ack(ctx, on_device):
if not on_device: if not on_device:
text = Text( text = Text(
'Passphrase entry', ui.ICON_RESET, 'Passphrase entry', ui.ICON_DEFAULT,
'Please, type passphrase', 'on connected host.') 'Please, type passphrase', 'on connected host.')
text.render() text.render()

View File

@ -32,7 +32,7 @@ async def _show_address(ctx, address):
lines = _split_address(address) lines = _split_address(address)
content = Container( content = Container(
Qr(address, (120, 135), 3), 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) await require_confirm(ctx, content, code=Address)

View File

@ -9,7 +9,7 @@ from . import networks
async def confirm_tx(ctx, to, value, chain_id, token=None): # TODO: wording async def confirm_tx(ctx, to, value, chain_id, token=None): # TODO: wording
str_to = '0x' + hexlify(to).decode() # TODO: use ethereum address format 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.BOLD, format_ethereum_amount(value, token, chain_id),
ui.NORMAL, 'to', ui.NORMAL, 'to',
ui.MONO, *split_address(str_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 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), 'Sending: %s' % format_ethereum_amount(spending, token, chain_id),
'Gas: %s' % format_ethereum_amount(gas_price, token, chain_id), 'Gas: %s' % format_ethereum_amount(gas_price, token, chain_id),
'Limit: %s' % format_ethereum_amount(gas_limit, 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 async def confirm_data(ctx, data, data_total): # TODO: wording
str_data = hexlify(data[:8]).decode() + '..' str_data = hexlify(data[:8]).decode() + '..'
content = Text('Confirm data:', ui.ICON_RESET, content = Text('Confirm data:', ui.ICON_DEFAULT,
ui.MONO, str_data, ui.MONO, str_data,
'Total: ', str(data_total) + 'B') 'Total: ', str(data_total) + 'B')
return await confirm(ctx, content, ButtonRequestType.SignTx) # we use SignTx, not ConfirmOutput, for compatibility with T1 return await confirm(ctx, content, ButtonRequestType.SignTx) # we use SignTx, not ConfirmOutput, for compatibility with T1

View File

@ -431,7 +431,7 @@ class ConfirmContent(ui.Widget):
header = 'U2F Register' header = 'U2F Register'
else: else:
header = 'U2F Authenticate' 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.image((240 - 64) // 2, 90, self.app_icon)
ui.display.text_center(120, 185, self.app_name, ui.MONO, ui.FG, ui.BG) ui.display.text_center(120, 185, self.app_name, ui.MONO, ui.FG, ui.BG)

View File

@ -47,7 +47,7 @@ async def respond_Pong(ctx, msg):
from trezor.messages.ButtonRequestType import ProtectCall from trezor.messages.ButtonRequestType import ProtectCall
from trezor.ui.text import Text from trezor.ui.text import Text
from trezor import ui 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: if msg.passphrase_protection:
from apps.common.request_passphrase import protect_by_passphrase from apps.common.request_passphrase import protect_by_passphrase

View File

@ -13,25 +13,25 @@ async def layout_apply_settings(ctx, msg):
if msg.homescreen is not None: if msg.homescreen is not None:
await require_confirm(ctx, Text( await require_confirm(ctx, Text(
'Change homescreen', ui.ICON_RESET, 'Change homescreen', ui.ICON_DEFAULT,
'Do you really want to', 'change homescreen?')) 'Do you really want to', 'change homescreen?'))
if msg.label is not None: if msg.label is not None:
await require_confirm(ctx, Text( await require_confirm(ctx, Text(
'Change label', ui.ICON_RESET, 'Change label', ui.ICON_DEFAULT,
'Do you really want to', 'change label to', '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 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: if msg.language is not None:
await require_confirm(ctx, Text( await require_confirm(ctx, Text(
'Change language', ui.ICON_RESET, 'Change language', ui.ICON_DEFAULT,
'Do you really want to', 'change language to', '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 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: if msg.use_passphrase is not None:
await require_confirm(ctx, Text( await require_confirm(ctx, Text(
'Enable passphrase' if msg.use_passphrase else 'Disable passphrase', 'Enable passphrase' if msg.use_passphrase else 'Disable passphrase',
ui.ICON_RESET, ui.ICON_DEFAULT,
'Do you really want to', 'Do you really want to',
'enable passphrase' if msg.use_passphrase else 'disable passphrase', 'enable passphrase' if msg.use_passphrase else 'disable passphrase',
'encryption?')) 'encryption?'))

View File

@ -34,19 +34,19 @@ def confirm_change_pin(ctx, msg):
if msg.remove and has_pin: # removing pin if msg.remove and has_pin: # removing pin
return require_confirm(ctx, Text( return require_confirm(ctx, Text(
'Remove PIN', ui.ICON_RESET, 'Remove PIN', ui.ICON_DEFAULT,
'Do you really want to', ui.BOLD, 'Do you really want to', ui.BOLD,
'remove current PIN?')) 'remove current PIN?'))
if not msg.remove and has_pin: # changing pin if not msg.remove and has_pin: # changing pin
return require_confirm(ctx, Text( return require_confirm(ctx, Text(
'Change PIN', ui.ICON_RESET, 'Change PIN', ui.ICON_DEFAULT,
'Do you really want to', ui.BOLD, 'Do you really want to', ui.BOLD,
'change current PIN?')) 'change current PIN?'))
if not msg.remove and not has_pin: # setting new pin if not msg.remove and not has_pin: # setting new pin
return require_confirm(ctx, Text( return require_confirm(ctx, Text(
'Change PIN', ui.ICON_RESET, 'Change PIN', ui.ICON_DEFAULT,
'Do you really want to', ui.BOLD, 'Do you really want to', ui.BOLD,
'set new PIN?')) 'set new PIN?'))

View File

@ -20,7 +20,7 @@ async def layout_load_device(ctx, msg):
raise wire.FailureError(ProcessError, 'Mnemonic is not valid') raise wire.FailureError(ProcessError, 'Mnemonic is not valid')
await require_confirm(ctx, Text( await require_confirm(ctx, Text(
'Loading seed', ui.ICON_RESET, 'Loading seed', ui.ICON_DEFAULT,
ui.BOLD, 'Loading private seed', 'is not recommended.', ui.BOLD, 'Loading private seed', 'is not recommended.',
ui.NORMAL, 'Continue only if you', 'know what you are doing!')) ui.NORMAL, 'Continue only if you', 'know what you are doing!'))

View File

@ -32,7 +32,7 @@ async def _show_address(ctx, address):
from ..common.confirm import confirm from ..common.confirm import confirm
lines = _split_address(address) 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) 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( content = Container(
Qr(address, (qr_x, qr_y), qr_coef), 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) return await confirm(ctx, content, code=Address, cancel='Address', cancel_style=ui.BTN_KEY)

View File

@ -19,7 +19,7 @@ async def _show_entropy(ctx):
from ..common.confirm import require_confirm from ..common.confirm import require_confirm
await require_confirm(ctx, Text( 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.BOLD, 'Do you really want', 'to send entropy?',
ui.NORMAL, 'Continue only if you', 'know what you are doing!'), ui.NORMAL, 'Continue only if you', 'know what you are doing!'),
code=ProtectCall) code=ProtectCall)

View File

@ -20,7 +20,7 @@ async def confirm_output(ctx, output, coin):
address = 'OP_RETURN' # TODO: handle OP_RETURN correctly address = 'OP_RETURN' # TODO: handle OP_RETURN correctly
else: else:
address = output.address 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.BOLD, format_coin_amount(output.amount, coin),
ui.NORMAL, 'to', ui.NORMAL, 'to',
ui.MONO, *split_address(address)) ui.MONO, *split_address(address))
@ -28,13 +28,13 @@ async def confirm_output(ctx, output, coin):
async def confirm_total(ctx, spending, fee, 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), 'Sending: %s' % format_coin_amount(spending, coin),
'Fee: %s' % format_coin_amount(fee, coin)) 'Fee: %s' % format_coin_amount(fee, coin))
return await hold_to_confirm(ctx, content, ButtonRequestType.SignTx) return await hold_to_confirm(ctx, content, ButtonRequestType.SignTx)
async def confirm_feeoverthreshold(ctx, fee, coin): 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)) ui.BOLD, format_coin_amount(fee, coin))
return await confirm(ctx, content, ButtonRequestType.FeeOverThreshold) return await confirm(ctx, content, ButtonRequestType.FeeOverThreshold)

View File

@ -123,7 +123,7 @@ def layout(f):
def header(title: str, def header(title: str,
icon: bytes=ICON_RESET, icon: bytes=ICON_DEFAULT,
fg: int=BG, fg: int=BG,
bg: int=BG, bg: int=BG,
ifg: int=BG): ifg: int=BG):

View File

@ -45,6 +45,7 @@ BG = BLACK
FG = WHITE FG = WHITE
# icons # icons
ICON_DEFAULT = 'trezor/res/header_icons/reset.toig'
ICON_RESET = 'trezor/res/header_icons/reset.toig' ICON_RESET = 'trezor/res/header_icons/reset.toig'
ICON_WIPE = 'trezor/res/header_icons/wipe.toig' ICON_WIPE = 'trezor/res/header_icons/wipe.toig'
ICON_RECOVERY = 'trezor/res/recovery.toig' ICON_RECOVERY = 'trezor/res/recovery.toig'