1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

refactor(core): convert parts of apps.monero to layouts

This commit is contained in:
Martin Milata 2021-02-15 23:19:34 +01:00
parent 6668921a4f
commit 2a5f5c1c20

View File

@ -3,6 +3,7 @@ from ubinascii import hexlify
from trezor import ui, wire
from trezor.messages import ButtonRequestType
from trezor.ui.components.tt.text import Text
from trezor.ui.layouts import confirm_action, require
from trezor.ui.popup import Popup
from trezor.utils import chunks
@ -22,34 +23,63 @@ if False:
async def require_confirm_watchkey(ctx):
content = Text("Confirm export", ui.ICON_SEND, ui.GREEN)
content.normal("Do you really want to", "export watch-only", "credentials?")
await require_confirm(ctx, content, ButtonRequestType.SignTx)
await require(
confirm_action(
ctx,
"get_watchkey",
"Confirm export",
description="Do you really want to export watch-only credentials?",
icon=ui.ICON_SEND,
icon_color=ui.GREEN,
br_code=ButtonRequestType.SignTx,
)
)
async def require_confirm_keyimage_sync(ctx):
content = Text("Confirm ki sync", ui.ICON_SEND, ui.GREEN)
content.normal("Do you really want to", "sync key images?")
await require_confirm(ctx, content, ButtonRequestType.SignTx)
await require(
confirm_action(
ctx,
"key_image_sync",
"Confirm ki sync",
description="Do you really want to\nsync key images?",
icon=ui.ICON_SEND,
icon_color=ui.GREEN,
br_code=ButtonRequestType.SignTx,
)
)
async def require_confirm_live_refresh(ctx):
content = Text("Confirm refresh", ui.ICON_SEND, ui.GREEN)
content.normal("Do you really want to", "start refresh?")
await require_confirm(ctx, content, ButtonRequestType.SignTx)
await require(
confirm_action(
ctx,
"live_refresh",
"Confirm refresh",
description="Do you really want to\nstart refresh?",
icon=ui.ICON_SEND,
icon_color=ui.GREEN,
br_code=ButtonRequestType.SignTx,
)
)
async def require_confirm_tx_key(ctx, export_key=False):
content = Text("Confirm export", ui.ICON_SEND, ui.GREEN)
txt = ["Do you really want to"]
if export_key:
txt.append("export tx_key?")
description = "Do you really want to export tx_key?"
else:
txt.append("export tx_der")
txt.append("for tx_proof?")
content.normal(*txt)
await require_confirm(ctx, content, ButtonRequestType.SignTx)
description = "Do you really want to export tx_der\nfor tx_proof?"
await require(
confirm_action(
ctx,
"export_tx_key",
"Confirm export",
description=description,
icon=ui.ICON_SEND,
icon_color=ui.GREEN,
br_code=ButtonRequestType.SignTx,
)
)
async def require_confirm_transaction(