1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-25 17:32:34 +00:00

ui.text: type -> normal

This commit is contained in:
Jan Pochyla 2018-07-02 17:10:20 +02:00
parent ec06ccf43f
commit 2b66deb3d6
25 changed files with 70 additions and 70 deletions

View File

@ -14,7 +14,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('Enter passphrase', ui.ICON_CONFIG) text = Text('Enter passphrase', ui.ICON_CONFIG)
text.type('Where to enter your', 'passphrase?') text.normal('Where to enter your', 'passphrase?')
text.render() text.render()
ack = await ctx.call( ack = await ctx.call(
@ -32,7 +32,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('Passphrase entry', ui.ICON_CONFIG) text = Text('Passphrase entry', ui.ICON_CONFIG)
text.type('Please, type passphrase', 'on connected host.') text.normal('Please, type passphrase', 'on connected host.')
text.render() text.render()
req = PassphraseRequest(on_device=on_device) req = PassphraseRequest(on_device=on_device)

View File

@ -17,7 +17,7 @@ async def require_confirm_tx(ctx, to, value, chain_id, token=None, tx_type=None)
to_str = 'new contract?' to_str = 'new contract?'
text = Text('Confirm sending', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm sending', ui.ICON_SEND, icon_color=ui.GREEN)
text.bold(format_ethereum_amount(value, token, chain_id, tx_type)) text.bold(format_ethereum_amount(value, token, chain_id, tx_type))
text.type('to') text.normal('to')
text.mono(*split_address(to_str)) text.mono(*split_address(to_str))
# we use SignTx, not ConfirmOutput, for compatibility with T1 # we use SignTx, not ConfirmOutput, for compatibility with T1
await require_confirm(ctx, text, ButtonRequestType.SignTx) await require_confirm(ctx, text, ButtonRequestType.SignTx)
@ -26,9 +26,9 @@ async def require_confirm_tx(ctx, to, value, chain_id, token=None, tx_type=None)
async def require_confirm_fee(ctx, spending, gas_price, gas_limit, chain_id, token=None, tx_type=None): async def require_confirm_fee(ctx, spending, gas_price, gas_limit, chain_id, token=None, tx_type=None):
text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN)
text.bold(format_ethereum_amount(spending, token, chain_id, tx_type)) text.bold(format_ethereum_amount(spending, token, chain_id, tx_type))
text.type('Gas price:') text.normal('Gas price:')
text.bold(format_ethereum_amount(gas_price, None, chain_id, tx_type)) text.bold(format_ethereum_amount(gas_price, None, chain_id, tx_type))
text.type('Maximum fee:') text.normal('Maximum fee:')
text.bold(format_ethereum_amount(gas_price * gas_limit, None, chain_id, tx_type)) text.bold(format_ethereum_amount(gas_price * gas_limit, None, chain_id, tx_type))
await require_hold_to_confirm(ctx, text, ButtonRequestType.SignTx) await require_hold_to_confirm(ctx, text, ButtonRequestType.SignTx)

View File

@ -38,5 +38,5 @@ async def ethereum_sign_message(ctx, msg):
async def require_confirm_sign_message(ctx, message): async def require_confirm_sign_message(ctx, message):
message = split_message(message) message = split_message(message)
text = Text('Sign ETH message') text = Text('Sign ETH message')
text.type(*message) text.normal(*message)
await require_confirm(ctx, text) await require_confirm(ctx, text)

View File

@ -392,7 +392,7 @@ class ConfirmState:
if bytes(self.app_id) == _BOGUS_APPID: if bytes(self.app_id) == _BOGUS_APPID:
text = Text('U2F mismatch', ui.ICON_WRONG, icon_color=ui.RED) text = Text('U2F mismatch', ui.ICON_WRONG, icon_color=ui.RED)
text.type('Another U2F device', 'was used to register', 'in this application.') text.normal('Another U2F device', 'was used to register', 'in this application.')
text.render() text.render()
await loop.sleep(3 * 1000 * 1000) await loop.sleep(3 * 1000 * 1000)
self.confirmed = True self.confirmed = True

View File

@ -11,22 +11,22 @@ from .helpers import get_vote_tx_text
async def require_confirm_tx(ctx, to, value): async def require_confirm_tx(ctx, to, value):
text = Text('Confirm sending', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm sending', ui.ICON_SEND, icon_color=ui.GREEN)
text.bold(format_amount(value)) text.bold(format_amount(value))
text.type('to') text.normal('to')
text.mono(*split_address(to)) text.mono(*split_address(to))
return await require_confirm(ctx, text, ButtonRequestType.SignTx) return await require_confirm(ctx, text, ButtonRequestType.SignTx)
async def require_confirm_delegate_registration(ctx, delegate_name): async def require_confirm_delegate_registration(ctx, delegate_name):
text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN)
text.type('Do you really want to') text.normal('Do you really want to')
text.type('register a delegate?') text.normal('register a delegate?')
text.bold(*chunks(delegate_name, 20)) text.bold(*chunks(delegate_name, 20))
return await require_confirm(ctx, text, ButtonRequestType.SignTx) return await require_confirm(ctx, text, ButtonRequestType.SignTx)
async def require_confirm_vote_tx(ctx, votes): async def require_confirm_vote_tx(ctx, votes):
text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN)
text.type(*get_vote_tx_text(votes)) text.normal(*get_vote_tx_text(votes))
return await require_confirm(ctx, text, ButtonRequestType.SignTx) return await require_confirm(ctx, text, ButtonRequestType.SignTx)
@ -36,16 +36,16 @@ async def require_confirm_public_key(ctx, public_key):
async def require_confirm_multisig(ctx, multisignature): async def require_confirm_multisig(ctx, multisignature):
text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN)
text.type('Keys group length: %s' % len(multisignature.keys_group)) text.normal('Keys group length: %s' % len(multisignature.keys_group))
text.type('Life time: %s' % multisignature.life_time) text.normal('Life time: %s' % multisignature.life_time)
text.type('Min: %s' % multisignature.min) text.normal('Min: %s' % multisignature.min)
return await require_confirm(ctx, text, ButtonRequestType.SignTx) return await require_confirm(ctx, text, ButtonRequestType.SignTx)
async def require_confirm_fee(ctx, value, fee): async def require_confirm_fee(ctx, value, fee):
text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN)
text.bold(format_amount(value)) text.bold(format_amount(value))
text.type('fee:') text.normal('fee:')
text.bold(format_amount(fee)) text.bold(format_amount(fee))
await require_hold_to_confirm(ctx, text, ButtonRequestType.ConfirmOutput) await require_hold_to_confirm(ctx, text, ButtonRequestType.ConfirmOutput)

View File

@ -40,5 +40,5 @@ async def lisk_sign_message(ctx, msg):
async def require_confirm_sign_message(ctx, message): async def require_confirm_sign_message(ctx, message):
text = Text('Sign Lisk message') text = Text('Sign Lisk message')
text.type(*split_message(message)) text.normal(*split_message(message))
await require_confirm(ctx, text) await require_confirm(ctx, text)

View File

@ -34,22 +34,22 @@ async def apply_settings(ctx, msg):
async def require_confirm_change_homescreen(ctx): async def require_confirm_change_homescreen(ctx):
text = Text('Change homescreen', ui.ICON_CONFIG) text = Text('Change homescreen', ui.ICON_CONFIG)
text.type('Do you really want to', 'change homescreen?') text.normal('Do you really want to', 'change homescreen?')
await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall) await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall)
async def require_confirm_change_label(ctx, label): async def require_confirm_change_label(ctx, label):
text = Text('Change label', ui.ICON_CONFIG) text = Text('Change label', ui.ICON_CONFIG)
text.type('Do you really want to', 'change label to') text.normal('Do you really want to', 'change label to')
text.bold('%s?' % label) text.bold('%s?' % label)
await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall) await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall)
async def require_confirm_change_passphrase(ctx, use): async def require_confirm_change_passphrase(ctx, use):
text = Text('Enable passphrase' if use else 'Disable passphrase', ui.ICON_CONFIG) text = Text('Enable passphrase' if use else 'Disable passphrase', ui.ICON_CONFIG)
text.type('Do you really want to') text.normal('Do you really want to')
text.type('enable passphrase' if use else 'disable passphrase') text.normal('enable passphrase' if use else 'disable passphrase')
text.type('encryption?') text.normal('encryption?')
await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall) await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall)
@ -61,6 +61,6 @@ async def require_confirm_change_passphrase_source(ctx, source):
else: else:
desc = 'ASK' desc = 'ASK'
text = Text('Passphrase source', ui.ICON_CONFIG) text = Text('Passphrase source', ui.ICON_CONFIG)
text.type('Do you really want to', 'change the passphrase', 'source to') text.normal('Do you really want to', 'change the passphrase', 'source to')
text.bold('ALWAYS %s?' % desc) text.bold('ALWAYS %s?' % desc)
await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall) await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall)

View File

@ -43,19 +43,19 @@ def require_confirm_change_pin(ctx, msg):
if msg.remove and has_pin: # removing pin if msg.remove and has_pin: # removing pin
text = Text('Remove PIN', ui.ICON_CONFIG) text = Text('Remove PIN', ui.ICON_CONFIG)
text.type('Do you really want to') text.normal('Do you really want to')
text.bold('remove current PIN?') text.bold('remove current PIN?')
return require_confirm(ctx, text) return require_confirm(ctx, text)
if not msg.remove and has_pin: # changing pin if not msg.remove and has_pin: # changing pin
text = Text('Remove PIN', ui.ICON_CONFIG) text = Text('Remove PIN', ui.ICON_CONFIG)
text.type('Do you really want to') text.normal('Do you really want to')
text.bold('change current PIN?') text.bold('change current PIN?')
return require_confirm(ctx, text) return require_confirm(ctx, text)
if not msg.remove and not has_pin: # setting new pin if not msg.remove and not has_pin: # setting new pin
text = Text('Remove PIN', ui.ICON_CONFIG) text = Text('Remove PIN', ui.ICON_CONFIG)
text.type('Do you really want to') text.normal('Do you really want to')
text.bold('set new PIN?') text.bold('set new PIN?')
return require_confirm(ctx, text) return require_confirm(ctx, text)
@ -80,8 +80,8 @@ async def request_pin_ack(ctx, *args, **kwargs):
@ui.layout @ui.layout
async def pin_mismatch(): async def pin_mismatch():
text = Text('PIN mismatch', ui.ICON_WRONG, icon_color=ui.RED) text = Text('PIN mismatch', ui.ICON_WRONG, icon_color=ui.RED)
text.type('Entered PINs do not', 'match each other.') text.normal('Entered PINs do not', 'match each other.')
text.type('') text.normal('')
text.type('Please, try again...') text.normal('Please, try again...')
text.render() text.render()
await loop.sleep(3 * 1000 * 1000) await loop.sleep(3 * 1000 * 1000)

View File

@ -20,7 +20,7 @@ async def load_device(ctx, msg):
text = Text('Loading seed') text = Text('Loading seed')
text.bold('Loading private seed', 'is not recommended.') text.bold('Loading private seed', 'is not recommended.')
text.type('Continue only if you', 'know what you are doing!') text.normal('Continue only if you', 'know what you are doing!')
await require_confirm(ctx, text) await require_confirm(ctx, text)
storage.load_mnemonic( storage.load_mnemonic(

View File

@ -62,7 +62,7 @@ async def request_wordcount(ctx):
await ctx.call(ButtonRequest(code=MnemonicWordCount), ButtonAck) await ctx.call(ButtonRequest(code=MnemonicWordCount), ButtonAck)
text = Text('Device recovery', ui.ICON_RECOVERY) text = Text('Device recovery', ui.ICON_RECOVERY)
text.type('Number of words?') text.normal('Number of words?')
count = await ctx.wait(WordSelector(text)) count = await ctx.wait(WordSelector(text))
return count return count

View File

@ -89,7 +89,7 @@ def generate_mnemonic(strength: int,
async def show_warning(ctx): async def show_warning(ctx):
text = Text('Backup your seed', ui.ICON_NOCOPY) text = Text('Backup your seed', ui.ICON_NOCOPY)
text.type( text.normal(
'Never make a digital', 'Never make a digital',
'copy of your recovery', 'copy of your recovery',
'seed and never upload', 'seed and never upload',
@ -104,7 +104,7 @@ async def show_warning(ctx):
async def show_wrong_entry(ctx): async def show_wrong_entry(ctx):
text = Text('Wrong entry!', ui.ICON_WRONG, icon_color=ui.RED) text = Text('Wrong entry!', ui.ICON_WRONG, icon_color=ui.RED)
text.type( text.normal(
'You have entered', 'You have entered',
'wrong seed word.', 'wrong seed word.',
'Please check again.') 'Please check again.')
@ -118,7 +118,7 @@ async def show_wrong_entry(ctx):
async def show_success(ctx): async def show_success(ctx):
text = Text('Backup is done!', ui.ICON_CONFIRM, icon_color=ui.GREEN) text = Text('Backup is done!', ui.ICON_CONFIRM, icon_color=ui.GREEN)
text.type( text.normal(
'Never make a digital', 'Never make a digital',
'copy of your recovery', 'copy of your recovery',
'seed and never upload', 'seed and never upload',

View File

@ -11,7 +11,7 @@ async def set_u2f_counter(ctx, msg):
raise wire.ProcessError('No value provided') raise wire.ProcessError('No value provided')
text = Text('Set U2F counter', ui.ICON_CONFIG) text = Text('Set U2F counter', ui.ICON_CONFIG)
text.type('Do you really want to', 'set the U2F counter') text.normal('Do you really want to', 'set the U2F counter')
text.bold('to %d?' % msg.u2f_counter) text.bold('to %d?' % msg.u2f_counter)
await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall) await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall)

View File

@ -9,7 +9,7 @@ from apps.common.confirm import require_hold_to_confirm
async def wipe_device(ctx, msg): async def wipe_device(ctx, msg):
text = Text('Wipe device', ui.ICON_WIPE, icon_color=ui.RED) text = Text('Wipe device', ui.ICON_WIPE, icon_color=ui.RED)
text.type('Do you really want to', 'wipe the device?', '') text.normal('Do you really want to', 'wipe the device?', '')
text.bold('All data will be lost.') text.bold('All data will be lost.')
await require_hold_to_confirm(ctx, text, await require_hold_to_confirm(ctx, text,

View File

@ -31,6 +31,6 @@ async def get_address(ctx, msg):
async def _show_address(ctx, address: str, network: int): async def _show_address(ctx, address: str, network: int):
lines = split_address(address) lines = split_address(address)
text = Text('Confirm address', ui.ICON_RECEIVE, icon_color=ui.GREEN) text = Text('Confirm address', ui.ICON_RECEIVE, icon_color=ui.GREEN)
text.type('%s network' % get_network_str(network)) text.normal('%s network' % get_network_str(network))
text.mono(*lines) text.mono(*lines)
return await confirm(ctx, text, code=ButtonRequestType.Address, cancel='QR', cancel_style=ui.BTN_KEY) return await confirm(ctx, text, code=ButtonRequestType.Address, cancel='QR', cancel_style=ui.BTN_KEY)

View File

@ -23,15 +23,15 @@ async def require_confirm_fee(ctx, action: str, fee: int):
async def require_confirm_content(ctx, headline: str, content: list): async def require_confirm_content(ctx, headline: str, content: list):
text = Text(headline, ui.ICON_SEND, icon_color=ui.GREEN) text = Text(headline, ui.ICON_SEND, icon_color=ui.GREEN)
text.type(*content) text.normal(*content)
await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput) await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput)
async def require_confirm_final(ctx, fee: int): async def require_confirm_final(ctx, fee: int):
text = Text('Final confirm', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Final confirm', ui.ICON_SEND, icon_color=ui.GREEN)
text.type('Sign this transaction') text.normal('Sign this transaction')
text.bold('and pay %s XEM' % format_amount(fee, NEM_MAX_DIVISIBILITY)) text.bold('and pay %s XEM' % format_amount(fee, NEM_MAX_DIVISIBILITY))
text.type('for network fee?') text.normal('for network fee?')
# we use SignTx, not ConfirmOutput, for compatibility with T1 # we use SignTx, not ConfirmOutput, for compatibility with T1
await require_hold_to_confirm(ctx, text, ButtonRequestType.SignTx) await require_hold_to_confirm(ctx, text, ButtonRequestType.SignTx)

View File

@ -72,7 +72,7 @@ def _get_mosaic_properties(definition: NEMMosaicDefinition):
if definition.description: if definition.description:
t = Text('Confirm properties', ui.ICON_SEND) t = Text('Confirm properties', ui.ICON_SEND)
t.bold('Description:') t.bold('Description:')
t.type(*split_words(trim(definition.description, 70), 22)) t.normal(*split_words(trim(definition.description, 70), 22))
properties.append(t) properties.append(t)
# transferable # transferable
@ -82,7 +82,7 @@ def _get_mosaic_properties(definition: NEMMosaicDefinition):
transferable = 'No' transferable = 'No'
t = Text('Confirm properties', ui.ICON_SEND) t = Text('Confirm properties', ui.ICON_SEND)
t.bold('Transferable?') t.bold('Transferable?')
t.type(transferable) t.normal(transferable)
properties.append(t) properties.append(t)
# mutable_supply # mutable_supply
@ -93,11 +93,11 @@ def _get_mosaic_properties(definition: NEMMosaicDefinition):
if definition.supply: if definition.supply:
t = Text('Confirm properties', ui.ICON_SEND) t = Text('Confirm properties', ui.ICON_SEND)
t.bold('Initial supply:') t.bold('Initial supply:')
t.type(str(definition.supply), imm) t.normal(str(definition.supply), imm)
else: else:
t = Text('Confirm properties', ui.ICON_SEND) t = Text('Confirm properties', ui.ICON_SEND)
t.bold('Initial supply:') t.bold('Initial supply:')
t.type(imm) t.normal(imm)
properties.append(t) properties.append(t)
# levy # levy
@ -110,16 +110,16 @@ def _get_mosaic_properties(definition: NEMMosaicDefinition):
t = Text('Confirm properties', ui.ICON_SEND) t = Text('Confirm properties', ui.ICON_SEND)
t.bold('Levy fee:') t.bold('Levy fee:')
t.type(str(definition.fee)) t.normal(str(definition.fee))
t.bold('Levy divisibility:') t.bold('Levy divisibility:')
t.type(str(definition.divisibility)) t.normal(str(definition.divisibility))
properties.append(t) properties.append(t)
t = Text('Confirm properties', ui.ICON_SEND) t = Text('Confirm properties', ui.ICON_SEND)
t.bold('Levy namespace:') t.bold('Levy namespace:')
t.type(definition.levy_namespace) t.normal(definition.levy_namespace)
t.bold('Levy mosaic:') t.bold('Levy mosaic:')
t.type(definition.levy_mosaic) t.normal(definition.levy_mosaic)
properties.append(t) properties.append(t)
if definition.levy == NEMMosaicLevy.MosaicLevy_Absolute: if definition.levy == NEMMosaicLevy.MosaicLevy_Absolute:
@ -128,7 +128,7 @@ def _get_mosaic_properties(definition: NEMMosaicDefinition):
levy_type = 'percentile' levy_type = 'percentile'
t = Text('Confirm properties', ui.ICON_SEND) t = Text('Confirm properties', ui.ICON_SEND)
t.bold('Levy type:') t.bold('Levy type:')
t.type(levy_type) t.normal(levy_type)
properties.append(t) properties.append(t)
return properties return properties

View File

@ -43,6 +43,6 @@ async def ask_aggregate_modification(ctx, common: NEMTransactionCommon, mod: NEM
async def _require_confirm_address(ctx, action: str, address: str): async def _require_confirm_address(ctx, action: str, address: str):
text = Text('Confirm address', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm address', ui.ICON_SEND, icon_color=ui.GREEN)
text.type(action) text.normal(action)
text.mono(*split_address(address)) text.mono(*split_address(address))
await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput) await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput)

View File

@ -31,29 +31,29 @@ async def ask_transfer_mosaic(ctx, common: NEMTransactionCommon, transfer: NEMTr
if definition: if definition:
msg = Text('Confirm mosaic', ui.ICON_SEND, icon_color=ui.GREEN) msg = Text('Confirm mosaic', ui.ICON_SEND, icon_color=ui.GREEN)
msg.type('Confirm transfer of') msg.normal('Confirm transfer of')
msg.bold(format_amount(mosaic_quantity, definition['divisibility']) + definition['ticker']) msg.bold(format_amount(mosaic_quantity, definition['divisibility']) + definition['ticker'])
msg.type('of') msg.normal('of')
msg.bold(definition['name']) msg.bold(definition['name'])
await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput) await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput)
if 'levy' in definition and 'fee' in definition: if 'levy' in definition and 'fee' in definition:
levy_msg = _get_levy_msg(definition, mosaic_quantity, common.network) levy_msg = _get_levy_msg(definition, mosaic_quantity, common.network)
msg = Text('Confirm mosaic', ui.ICON_SEND, icon_color=ui.GREEN) msg = Text('Confirm mosaic', ui.ICON_SEND, icon_color=ui.GREEN)
msg.type('Confirm mosaic', 'levy fee of') msg.normal('Confirm mosaic', 'levy fee of')
msg.bold(levy_msg) msg.bold(levy_msg)
await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput) await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput)
else: else:
msg = Text('Confirm mosaic', ui.ICON_SEND, icon_color=ui.RED) msg = Text('Confirm mosaic', ui.ICON_SEND, icon_color=ui.RED)
msg.bold('Unknown mosaic!') msg.bold('Unknown mosaic!')
msg.type(*split_words('Divisibility and levy cannot be shown for unknown mosaics', 22)) msg.normal(*split_words('Divisibility and levy cannot be shown for unknown mosaics', 22))
await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput) await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput)
msg = Text('Confirm mosaic', ui.ICON_SEND, icon_color=ui.GREEN) msg = Text('Confirm mosaic', ui.ICON_SEND, icon_color=ui.GREEN)
msg.type('Confirm transfer of') msg.normal('Confirm transfer of')
msg.bold('%s raw units' % mosaic_quantity) msg.bold('%s raw units' % mosaic_quantity)
msg.type('of') msg.normal('of')
msg.bold('%s.%s' % (mosaic.namespace, mosaic.mosaic)) msg.bold('%s.%s' % (mosaic.namespace, mosaic.mosaic))
await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput) await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput)
@ -97,7 +97,7 @@ async def ask_importance_transfer(ctx, common: NEMTransactionCommon, imp: NEMImp
async def _require_confirm_transfer(ctx, recipient, value): async def _require_confirm_transfer(ctx, recipient, value):
text = Text('Confirm transfer', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm transfer', ui.ICON_SEND, icon_color=ui.GREEN)
text.bold('Send %s XEM' % format_amount(value, NEM_MAX_DIVISIBILITY)) text.bold('Send %s XEM' % format_amount(value, NEM_MAX_DIVISIBILITY))
text.type('to') text.normal('to')
text.mono(*split_address(recipient)) text.mono(*split_address(recipient))
await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput) await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput)
@ -110,9 +110,9 @@ async def _require_confirm_payload(ctx, payload: bytes, encrypt=False):
if encrypt: if encrypt:
text = Text('Confirm payload', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm payload', ui.ICON_SEND, icon_color=ui.GREEN)
text.bold('Encrypted:') text.bold('Encrypted:')
text.type(*split_words(payload, 22)) text.normal(*split_words(payload, 22))
else: else:
text = Text('Confirm payload', ui.ICON_SEND, icon_color=ui.RED) text = Text('Confirm payload', ui.ICON_SEND, icon_color=ui.RED)
text.bold('Unencrypted:') text.bold('Unencrypted:')
text.type(*split_words(payload, 22)) text.normal(*split_words(payload, 22))
await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput) await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput)

View File

@ -21,7 +21,7 @@ async def cipher_key_value(ctx, msg):
else: else:
title = 'Decrypt value' title = 'Decrypt value'
text = Text(title) text = Text(title)
text.type(msg.key) text.normal(msg.key)
await require_confirm(ctx, text) await require_confirm(ctx, text)
node = await seed.derive_node(ctx, msg.address_n) node = await seed.derive_node(ctx, msg.address_n)

View File

@ -10,7 +10,7 @@ async def get_entropy(ctx, msg):
text = Text('Confirm entropy') text = Text('Confirm entropy')
text.bold('Do you really want', 'to send entropy?') text.bold('Do you really want', 'to send entropy?')
text.type('Continue only if you', 'know what you are doing!') text.normal('Continue only if you', 'know what you are doing!')
await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall) await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall)
size = min(msg.size, 1024) size = min(msg.size, 1024)

View File

@ -54,7 +54,7 @@ async def require_confirm_sign_identity(ctx, identity, challenge_visual):
proto = identity.proto.upper() if identity.proto else 'identity' proto = identity.proto.upper() if identity.proto else 'identity'
text = Text('Sign %s' % proto) text = Text('Sign %s' % proto)
text.type(*lines) text.normal(*lines)
await require_confirm(ctx, text) await require_confirm(ctx, text)

View File

@ -40,5 +40,5 @@ async def sign_message(ctx, msg):
async def require_confirm_sign_message(ctx, message): async def require_confirm_sign_message(ctx, message):
message = split_message(message) message = split_message(message)
text = Text('Sign message') text = Text('Sign message')
text.type(*message) text.normal(*message)
await require_confirm(ctx, text) await require_confirm(ctx, text)

View File

@ -32,31 +32,31 @@ async def confirm_output(ctx, output, coin):
address = output.address address = output.address
address_short = addresses.address_short(coin, address) address_short = addresses.address_short(coin, address)
text = Text('Confirm sending', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm sending', ui.ICON_SEND, icon_color=ui.GREEN)
text.type(format_coin_amount(output.amount, coin) + ' to') text.normal(format_coin_amount(output.amount, coin) + ' to')
text.mono(*split_address(address_short)) text.mono(*split_address(address_short))
return await confirm(ctx, text, ButtonRequestType.ConfirmOutput) return await confirm(ctx, text, ButtonRequestType.ConfirmOutput)
async def confirm_total(ctx, spending, fee, coin): async def confirm_total(ctx, spending, fee, coin):
text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('Confirm transaction', ui.ICON_SEND, icon_color=ui.GREEN)
text.type('Total amount:') text.normal('Total amount:')
text.bold(format_coin_amount(spending, coin)) text.bold(format_coin_amount(spending, coin))
text.type('including fee:') text.normal('including fee:')
text.bold(format_coin_amount(fee, coin)) text.bold(format_coin_amount(fee, coin))
return await hold_to_confirm(ctx, text, ButtonRequestType.SignTx) return await hold_to_confirm(ctx, text, ButtonRequestType.SignTx)
async def confirm_feeoverthreshold(ctx, fee, coin): async def confirm_feeoverthreshold(ctx, fee, coin):
text = Text('High fee', ui.ICON_SEND, icon_color=ui.GREEN) text = Text('High fee', ui.ICON_SEND, icon_color=ui.GREEN)
text.type('The fee of') text.normal('The fee of')
text.bold(format_coin_amount(fee, coin)) text.bold(format_coin_amount(fee, coin))
text.type('is unexpectedly high.', 'Continue?') text.normal('is unexpectedly high.', 'Continue?')
return await confirm(ctx, text, ButtonRequestType.FeeOverThreshold) return await confirm(ctx, text, ButtonRequestType.FeeOverThreshold)
async def confirm_foreign_address(ctx, address_n, coin): async def confirm_foreign_address(ctx, address_n, coin):
text = Text('Confirm sending', ui.ICON_SEND, icon_color=ui.RED) text = Text('Confirm sending', ui.ICON_SEND, icon_color=ui.RED)
text.type( text.normal(
'Trying to spend', 'Trying to spend',
'coins from another chain.', 'coins from another chain.',
'Continue?') 'Continue?')

View File

@ -62,5 +62,5 @@ async def require_confirm_verify_message(ctx, address, message):
await require_confirm(ctx, text) await require_confirm(ctx, text)
text = Text('Verify message') text = Text('Verify message')
text.type(*split_message(message)) text.normal(*split_message(message))
await require_confirm(ctx, text) await require_confirm(ctx, text)

View File

@ -112,7 +112,7 @@ class Text(ui.LazyWidget):
self.new_lines = new_lines self.new_lines = new_lines
self.content = [] self.content = []
def type(self, *content): def normal(self, *content):
self.content.extend(content) self.content.extend(content)
def bold(self, *content): def bold(self, *content):