mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-31 18:40:56 +00:00
apps.wallet: add qr code to get_address
TODO: the widget system clearly needs some work
This commit is contained in:
parent
3ef56d84e2
commit
4ab469d02d
@ -29,12 +29,14 @@ async def layout_get_address(session_id, msg):
|
|||||||
async def _show_address(session_id, address):
|
async def _show_address(session_id, address):
|
||||||
from trezor.messages.ButtonRequestType import Address
|
from trezor.messages.ButtonRequestType import Address
|
||||||
from trezor.ui.text import Text
|
from trezor.ui.text import Text
|
||||||
|
from trezor.ui.qr import Qr
|
||||||
|
from trezor.ui.container import Container
|
||||||
from ..common.confirm import require_confirm
|
from ..common.confirm import require_confirm
|
||||||
|
|
||||||
# TODO: qr code
|
lines = _split_address(address)
|
||||||
|
content = Container(
|
||||||
content = Text('Confirm address', ui.ICON_RESET,
|
Qr(address, (76, 90), 3),
|
||||||
ui.MONO, *_split_address(address))
|
Text('Confirm address', ui.ICON_RESET, ui.MONO, *lines))
|
||||||
await require_confirm(session_id, content, code=Address)
|
await require_confirm(session_id, content, code=Address)
|
||||||
|
|
||||||
|
|
||||||
|
15
src/trezor/ui/container.py
Normal file
15
src/trezor/ui/container.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
class Container:
|
||||||
|
|
||||||
|
def __init__(self, *children):
|
||||||
|
self.children = children
|
||||||
|
|
||||||
|
def render(self):
|
||||||
|
for child in self.children:
|
||||||
|
child.render()
|
||||||
|
|
||||||
|
def send(self, event, pos):
|
||||||
|
for child in self.children:
|
||||||
|
result = child.send(event, pos)
|
||||||
|
if result is not None:
|
||||||
|
return result
|
15
src/trezor/ui/qr.py
Normal file
15
src/trezor/ui/qr.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from trezor import ui
|
||||||
|
|
||||||
|
|
||||||
|
class Qr:
|
||||||
|
|
||||||
|
def __init__(self, data, pos, scale):
|
||||||
|
self.data = data
|
||||||
|
self.pos = pos
|
||||||
|
self.scale = scale
|
||||||
|
|
||||||
|
def render(self):
|
||||||
|
ui.display.qrcode(self.pos[0], self.pos[1], self.data, self.scale)
|
||||||
|
|
||||||
|
def send(self, event, pos):
|
||||||
|
pass
|
Loading…
Reference in New Issue
Block a user