|
|
|
@ -1,28 +1,29 @@
|
|
|
|
|
from micropython import const
|
|
|
|
|
from trezor import loop
|
|
|
|
|
from trezor import ui, res
|
|
|
|
|
from trezor import ui
|
|
|
|
|
from trezor.ui import Widget
|
|
|
|
|
from trezor.ui.button import Button, BTN_CLICKED, BTN_STARTED, BTN_ACTIVE
|
|
|
|
|
from trezor.ui.button import Button, BTN_CLICKED
|
|
|
|
|
|
|
|
|
|
_W12 = const(12)
|
|
|
|
|
_W15 = const(15)
|
|
|
|
|
_W18 = const(18)
|
|
|
|
|
_W24 = const(24)
|
|
|
|
|
|
|
|
|
|
W12 = '12'
|
|
|
|
|
W15 = '15'
|
|
|
|
|
W18 = '18'
|
|
|
|
|
W24 = '24'
|
|
|
|
|
|
|
|
|
|
class WordSelector(Widget):
|
|
|
|
|
|
|
|
|
|
def __init__(self, content):
|
|
|
|
|
self.content = content
|
|
|
|
|
self.w12 = Button((6, 135, 114, 51), W12,
|
|
|
|
|
self.w12 = Button(ui.grid(8, n_y=4, n_x=4, cells_x=2), str(_W12),
|
|
|
|
|
normal_style=ui.BTN_KEY,
|
|
|
|
|
active_style=ui.BTN_KEY_ACTIVE)
|
|
|
|
|
self.w15 = Button((120, 135, 114, 51), W15,
|
|
|
|
|
self.w15 = Button(ui.grid(10, n_y=4, n_x=4, cells_x=2), str(_W15),
|
|
|
|
|
normal_style=ui.BTN_KEY,
|
|
|
|
|
active_style=ui.BTN_KEY_ACTIVE)
|
|
|
|
|
self.w18 = Button((6, 186, 114, 51), W18,
|
|
|
|
|
self.w18 = Button(ui.grid(12, n_y=4, n_x=4, cells_x=2), str(_W18),
|
|
|
|
|
normal_style=ui.BTN_KEY,
|
|
|
|
|
active_style=ui.BTN_KEY_ACTIVE)
|
|
|
|
|
self.w24 = Button((120, 186, 114, 51), W24,
|
|
|
|
|
self.w24 = Button(ui.grid(14, n_y=4, n_x=4, cells_x=2), str(_W24),
|
|
|
|
|
normal_style=ui.BTN_KEY,
|
|
|
|
|
active_style=ui.BTN_KEY_ACTIVE)
|
|
|
|
|
|
|
|
|
@ -34,20 +35,13 @@ class WordSelector(Widget):
|
|
|
|
|
|
|
|
|
|
def touch(self, event, pos):
|
|
|
|
|
if self.w12.touch(event, pos) == BTN_CLICKED:
|
|
|
|
|
return W12
|
|
|
|
|
return _W12
|
|
|
|
|
if self.w15.touch(event, pos) == BTN_CLICKED:
|
|
|
|
|
return W15
|
|
|
|
|
return _W15
|
|
|
|
|
if self.w18.touch(event, pos) == BTN_CLICKED:
|
|
|
|
|
return W18
|
|
|
|
|
return _W18
|
|
|
|
|
if self.w24.touch(event, pos) == BTN_CLICKED:
|
|
|
|
|
return W24
|
|
|
|
|
return _W24
|
|
|
|
|
|
|
|
|
|
async def __iter__(self):
|
|
|
|
|
return await loop.wait(super().__iter__(), self.content)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_STARTED = const(-1)
|
|
|
|
|
_STOPPED = const(-2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|