2016-06-06 15:53:33 +00:00
|
|
|
from trezor import ui, dispatcher, loop, res, wire
|
2016-05-17 16:37:26 +00:00
|
|
|
from trezor.ui.swipe import Swipe
|
2016-05-25 12:27:22 +00:00
|
|
|
from trezor.utils import unimport_gen
|
2016-04-30 13:57:08 +00:00
|
|
|
|
2016-04-28 21:43:34 +00:00
|
|
|
|
2016-08-05 10:34:47 +00:00
|
|
|
async def swipe_to_rotate():
|
2016-05-17 16:37:26 +00:00
|
|
|
while True:
|
2016-08-05 10:34:47 +00:00
|
|
|
degrees = await Swipe(absolute=True)
|
2016-05-17 16:37:26 +00:00
|
|
|
ui.display.orientation(degrees)
|
|
|
|
|
|
|
|
|
2016-08-05 10:34:47 +00:00
|
|
|
async def animate_logo():
|
2016-08-08 12:53:42 +00:00
|
|
|
# def func(foreground):
|
|
|
|
# ui.display.icon(0, 0, res.load(
|
|
|
|
# 'apps/homescreen/res/trezor.toig'), foreground, ui.BLACK)
|
|
|
|
# await ui.animate_pulse(func, ui.WHITE, ui.GREY, speed=400000)
|
|
|
|
|
|
|
|
async for fg in ui.pulse_animation(ui.WHITE, ui.GREY, speed=400000):
|
|
|
|
icon = res.load('apps/homescreen/res/trezor.toig')
|
|
|
|
ui.display.icon(0, 0, icon, fg, ui.BLACK)
|
2016-05-25 12:27:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
@unimport_gen
|
2016-08-05 10:34:47 +00:00
|
|
|
async def layout_homescreen(initialize_msg=None):
|
2016-05-25 12:27:22 +00:00
|
|
|
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
|
2016-06-01 13:06:00 +00:00
|
|
|
features.initialized = False
|
2016-05-25 12:27:22 +00:00
|
|
|
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'
|
2016-08-05 10:34:47 +00:00
|
|
|
await wire.write(features)
|
|
|
|
await loop.Wait([dispatcher.dispatch(),
|
2016-05-25 12:27:22 +00:00
|
|
|
swipe_to_rotate(),
|
|
|
|
animate_logo()])
|