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

apps.wallet: add qr code to get_address

TODO: the widget system clearly needs some work
This commit is contained in:
Jan Pochyla 2017-01-18 17:59:11 +01:00
parent 3ef56d84e2
commit 4ab469d02d
3 changed files with 36 additions and 4 deletions

View File

@ -29,12 +29,14 @@ async def layout_get_address(session_id, msg):
async def _show_address(session_id, address):
from trezor.messages.ButtonRequestType import Address
from trezor.ui.text import Text
from trezor.ui.qr import Qr
from trezor.ui.container import Container
from ..common.confirm import require_confirm
# TODO: qr code
content = Text('Confirm address', ui.ICON_RESET,
ui.MONO, *_split_address(address))
lines = _split_address(address)
content = Container(
Qr(address, (76, 90), 3),
Text('Confirm address', ui.ICON_RESET, ui.MONO, *lines))
await require_confirm(session_id, content, code=Address)

View 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
View 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