1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 05:28:40 +00:00

apps: use {app}.layout for common layouts

This commit is contained in:
Jan Pochyla 2018-08-27 12:13:38 +02:00
parent 8421fa4fdb
commit c1b284cdfa
24 changed files with 35 additions and 35 deletions

View File

@ -3,7 +3,7 @@ from trezor.crypto import bip32
from trezor.messages.CardanoAddress import CardanoAddress
from .address import derive_address_and_node
from .ui import show_swipable_with_confirmation
from .layout import confirm_with_pagination
from apps.common import storage
@ -22,7 +22,7 @@ async def cardano_get_address(ctx, msg):
root_node = None
if msg.show_display:
if not await show_swipable_with_confirmation(
if not await confirm_with_pagination(
ctx, address, "Export address", icon=ui.ICON_SEND, icon_color=ui.GREEN
):
raise wire.ActionCancelled("Exporting cancelled")

View File

@ -7,7 +7,7 @@ from trezor.messages.HDNodeType import HDNodeType
from .address import _derive_hd_passphrase, derive_address_and_node
from apps.common import seed, show, storage
from apps.common import layout, seed, storage
async def cardano_get_public_key(ctx, msg):
@ -24,7 +24,7 @@ async def cardano_get_public_key(ctx, msg):
root_node = None
if msg.show_display:
await show.show_pubkey(ctx, key.node.public_key)
await layout.show_pubkey(ctx, key.node.public_key)
return key

View File

@ -9,7 +9,7 @@ from trezor.ui.text import Text
from trezor.utils import chunks
async def show_swipable_with_confirmation(
async def confirm_with_pagination(
ctx, content, title: str, icon=ui.ICON_RESET, icon_color=ui.ORANGE
):
first_page = const(0)

View File

@ -4,7 +4,7 @@ from trezor.crypto.curve import ed25519
from trezor.messages.CardanoMessageSignature import CardanoMessageSignature
from .address import _break_address_n_to_lines, derive_address_and_node
from .ui import show_swipable_with_confirmation
from .layout import confirm_with_pagination
from apps.common import seed, storage
@ -22,12 +22,12 @@ async def cardano_sign_message(ctx, msg):
mnemonic = None
root_node = None
if not await show_swipable_with_confirmation(
if not await confirm_with_pagination(
ctx, msg.message, "Signing message", ui.ICON_RECEIVE, ui.GREEN
):
raise wire.ActionCancelled("Signing cancelled")
if not await show_swipable_with_confirmation(
if not await confirm_with_pagination(
ctx,
_break_address_n_to_lines(msg.address_n),
"With address",

View File

@ -7,7 +7,7 @@ from trezor.messages.MessageType import CardanoTxAck
from trezor.ui.text import BR
from .address import _break_address_n_to_lines, derive_address_and_node
from .ui import progress, show_swipable_with_confirmation
from .ui import confirm_with_pagination, progress
from apps.cardano import cbor
from apps.common import seed, storage
@ -24,18 +24,18 @@ async def show_tx(
tx_size: float,
) -> bool:
lines = ("%s ADA" % _micro_ada_to_ada(fee), BR, "Tx size:", "%s bytes" % tx_size)
if not await show_swipable_with_confirmation(
if not await confirm_with_pagination(
ctx, lines, "Confirm fee", ui.ICON_SEND, ui.GREEN
):
return False
for index, output in enumerate(outputs):
if not await show_swipable_with_confirmation(
if not await confirm_with_pagination(
ctx, output, "Confirm output", ui.ICON_SEND, ui.GREEN
):
return False
if not await show_swipable_with_confirmation(
if not await confirm_with_pagination(
ctx,
"%s ADA" % _micro_ada_to_ada(outcoins[index]),
"Confirm amount",
@ -45,7 +45,7 @@ async def show_tx(
return False
for index, change in enumerate(change_derivation_paths):
if not await show_swipable_with_confirmation(
if not await confirm_with_pagination(
ctx,
_break_address_n_to_lines(change),
"Confirm change",
@ -54,7 +54,7 @@ async def show_tx(
):
return False
if not await show_swipable_with_confirmation(
if not await confirm_with_pagination(
ctx,
"%s ADA" % _micro_ada_to_ada(change_coins[index]),
"Confirm amount",

View File

@ -5,7 +5,7 @@ from trezor.crypto.curve import ed25519
from trezor.messages.Failure import Failure
from trezor.messages.Success import Success
from .ui import show_swipable_with_confirmation
from .layout import confirm_with_pagination
async def cardano_verify_message(ctx, msg):
@ -19,12 +19,12 @@ async def cardano_verify_message(ctx, msg):
if not res:
return Failure(message="Invalid signature")
if not await show_swipable_with_confirmation(
if not await confirm_with_pagination(
ctx, msg.message, "Verifying message", ui.ICON_RECEIVE, ui.GREEN
):
raise wire.ActionCancelled("Verifying cancelled")
if not await show_swipable_with_confirmation(
if not await confirm_with_pagination(
ctx, hexlify(msg.public_key), "With public key", ui.ICON_RECEIVE, ui.GREEN
):
raise wire.ActionCancelled("Verifying cancelled")

View File

@ -1,4 +1,4 @@
from apps.common.show import show_address, show_qr
from apps.common.layout import show_address, show_qr
from apps.ethereum import networks

View File

@ -6,7 +6,7 @@ from trezor.ui.text import Text
from trezor.utils import chunks, format_amount
from apps.common.confirm import require_confirm, require_hold_to_confirm
from apps.common.show import split_address
from apps.common.layout import split_address
from apps.ethereum import networks, tokens
from apps.ethereum.get_address import _ethereum_address_hex

View File

@ -6,7 +6,7 @@ from trezor.messages.Success import Success
from trezor.ui.text import Text
from apps.common.confirm import require_confirm
from apps.common.show import split_address
from apps.common.layout import split_address
from apps.common.signverify import split_message
from apps.ethereum.sign_message import message_digest

View File

@ -3,7 +3,7 @@ from trezor.messages.LiskAddress import LiskAddress
from .helpers import LISK_CURVE, get_address_from_public_key
from apps.common import seed
from apps.common.show import show_address, show_qr
from apps.common.layout import show_address, show_qr
async def get_address(ctx, msg):

View File

@ -2,7 +2,7 @@ from trezor.messages.LiskPublicKey import LiskPublicKey
from .helpers import LISK_CURVE
from apps.common import seed, show
from apps.common import layout, seed
async def get_public_key(ctx, msg):
@ -13,6 +13,6 @@ async def get_public_key(ctx, msg):
pubkey = pubkey[1:] # skip ed25519 pubkey marker
if msg.show_display:
await show.show_pubkey(ctx, pubkey)
await layout.show_pubkey(ctx, pubkey)
return LiskPublicKey(public_key=pubkey)

View File

@ -6,7 +6,7 @@ from trezor.utils import chunks
from .helpers import get_vote_tx_text
from apps.common.confirm import require_confirm, require_hold_to_confirm
from apps.common.show import show_pubkey, split_address
from apps.common.layout import show_pubkey, split_address
async def require_confirm_tx(ctx, to, value):

View File

@ -4,7 +4,7 @@ from .helpers import NEM_CURVE, get_network_str
from .validators import validate_network
from apps.common import seed
from apps.common.show import show_address, show_qr
from apps.common.layout import show_address, show_qr
async def get_address(ctx, msg):

View File

@ -22,7 +22,7 @@ from ..layout import (
trim,
)
from apps.common.show import split_address
from apps.common.layout import split_address
async def ask_mosaic_creation(

View File

@ -16,7 +16,7 @@ from ..layout import (
require_confirm_text,
)
from apps.common.show import split_address
from apps.common.layout import split_address
async def ask_multisig(ctx, msg: NEMSignTx):

View File

@ -20,7 +20,7 @@ from ..layout import require_confirm_final, require_confirm_text
from ..mosaic.helpers import get_mosaic_definition, is_nem_xem_mosaic
from apps.common.confirm import require_confirm
from apps.common.show import split_address
from apps.common.layout import split_address
async def ask_transfer(

View File

@ -4,7 +4,7 @@ from trezor.messages.RippleGetAddress import RippleGetAddress
from . import helpers
from apps.common import seed
from apps.common.show import show_address, show_qr
from apps.common.layout import show_address, show_qr
async def get_address(ctx, msg: RippleGetAddress):

View File

@ -6,7 +6,7 @@ from trezor.utils import format_amount
from . import helpers
from apps.common.confirm import require_confirm, require_hold_to_confirm
from apps.common.show import split_address
from apps.common.layout import split_address
async def require_confirm_fee(ctx, fee):

View File

@ -2,7 +2,7 @@ from trezor.messages.StellarAddress import StellarAddress
from trezor.messages.StellarGetAddress import StellarGetAddress
from apps.common import seed
from apps.common.show import show_address, show_qr
from apps.common.layout import show_address, show_qr
from apps.stellar import helpers

View File

@ -2,7 +2,7 @@ from trezor.messages import InputScriptType
from trezor.messages.Address import Address
from apps.common import coins, seed
from apps.common.show import show_address, show_qr
from apps.common.layout import show_address, show_qr
from apps.wallet.sign_tx import addresses

View File

@ -1,7 +1,7 @@
from trezor.messages.HDNodeType import HDNodeType
from trezor.messages.PublicKey import PublicKey
from apps.common import coins, seed, show
from apps.common import coins, layout, seed
async def get_public_key(ctx, msg):
@ -26,6 +26,6 @@ async def get_public_key(ctx, msg):
)
if msg.show_display:
await show.show_pubkey(ctx, pubkey)
await layout.show_pubkey(ctx, pubkey)
return PublicKey(node=node_type, xpub=node_xpub)

View File

@ -6,7 +6,7 @@ from trezor.ui.text import Text
from apps.common import coins
from apps.common.confirm import require_confirm
from apps.common.show import split_address
from apps.common.layout import split_address
from apps.common.signverify import message_digest, split_message
from apps.wallet.sign_tx.addresses import (
address_p2wpkh,