diff --git a/src/apps/seed/__init__.py b/src/apps/seed/__init__.py new file mode 100644 index 0000000000..6d4fadc1c4 --- /dev/null +++ b/src/apps/seed/__init__.py @@ -0,0 +1,17 @@ +from trezor.dispatcher import register +from trezor.utils import unimport_func + + +@unimport_func +def dispatch_Initialize(mtype, mbuf): + from trezor.messages.Initialize import Initialize + + message = Initialize.loads(mbuf) + + from .layout_seed import layout_seed + return layout_seed(message) + + +def boot(): + Initialize = 0 + # register(Initialize, dispatch_Initialize) diff --git a/src/apps/seed/layout_seed.py b/src/apps/seed/layout_seed.py new file mode 100644 index 0000000000..7ebdb29787 --- /dev/null +++ b/src/apps/seed/layout_seed.py @@ -0,0 +1,25 @@ +from trezor import ui, dispatcher, loop, res, wire +from trezor.ui.swipe import Swipe +from trezor.utils import unimport_gen + + +def swipe_to_rotate(): + while True: + degrees = yield from Swipe(absolute=True).wait() + ui.display.orientation(degrees) + + +def animate_logo(): + def func(foreground): + ui.display.icon(105, 200, res.load('apps/seed/res/small-arrow.toig'), foreground, ui.BLACK) + yield from ui.animate_pulse(func, ui.WHITE, ui.BLACK, speed=190000) + + +@unimport_gen +def layout_seed(initialize_msg=None): + # header title + ui.display.text(10, 30, 'Write down your seed', ui.BOLD, ui.LIGHT_GREEN, ui.BLACK) + + yield loop.Wait([dispatcher.dispatch(), + swipe_to_rotate(), + animate_logo()]) diff --git a/src/apps/seed/res/small-arrow.png b/src/apps/seed/res/small-arrow.png new file mode 100644 index 0000000000..26a80b8724 Binary files /dev/null and b/src/apps/seed/res/small-arrow.png differ diff --git a/src/apps/seed/res/small-arrow.toig b/src/apps/seed/res/small-arrow.toig new file mode 100644 index 0000000000..7ac29924c5 Binary files /dev/null and b/src/apps/seed/res/small-arrow.toig differ diff --git a/src/main.py b/src/main.py index b9a416f2a8..3a55f0754e 100644 --- a/src/main.py +++ b/src/main.py @@ -6,12 +6,14 @@ from apps import playground from apps import homescreen from apps import management from apps import wallet +from apps import seed # Initialize all applications playground.boot() homescreen.boot() management.boot() wallet.boot() +seed.boot() # just a demo to show how to register USB ifaces msg.setup([(1, 0xF53C), (2, 0xF1D0)])