1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-01 11:01:00 +00:00
trezor-firmware/src/apps/homescreen/layout_homescreen.py

46 lines
1.4 KiB
Python
Raw Normal View History

2016-04-28 21:43:34 +00:00
from trezor import ui
2016-05-17 16:37:26 +00:00
from trezor.ui.swipe import Swipe
from trezor.utils import unimport_gen
2016-05-27 12:12:44 +00:00
from trezor.res import loadres
from trezor import dispatcher
from trezor import loop
from trezor import wire
2016-04-30 13:57:08 +00:00
2016-04-28 21:43:34 +00:00
def swipe_to_rotate():
2016-05-17 16:37:26 +00:00
while True:
degrees = yield from Swipe(absolute=True).wait()
2016-05-17 16:37:26 +00:00
ui.display.orientation(degrees)
def animate_logo():
2016-05-02 14:06:08 +00:00
def func(foreground):
2016-05-27 12:12:44 +00:00
ui.display.icon(0, 0, loadres('apps/homescreen/res/trezor.toig'), foreground, ui.BLACK)
yield from ui.animate_pulse(func, ui.WHITE, ui.GREY, speed=400000)
@unimport_gen
def layout_homescreen(initialize_msg=None):
if initialize_msg is not None:
from trezor.messages.Features import Features
features = Features()
features.revision = 'deadbeef'
features.bootloader_hash = 'deadbeef'
features.device_id = 'DEADBEEF'
features.coins = []
features.imported = False
features.initialized = False
features.label = 'My TREZOR'
features.major_version = 2
features.minor_version = 0
features.patch_version = 0
features.pin_cached = False
features.pin_protection = True
features.passphrase_cached = False
features.passphrase_protection = False
features.vendor = 'bitcointrezor.com'
wire.write(features)
yield loop.Wait([dispatcher.dispatch(),
swipe_to_rotate(),
animate_logo()])