1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-29 09:38:08 +00:00
trezor-firmware/src/apps/homescreen/homescreen.py

39 lines
946 B
Python
Raw Normal View History

from trezor import ui, loop, res
from trezor.utils import unimport
2016-04-30 13:57:08 +00:00
2016-12-14 10:10:01 +00:00
async def swipe_to_rotate():
from trezor.ui.swipe import Swipe
degrees = await Swipe(absolute=True)
ui.display.orientation(degrees)
2016-05-17 16:37:26 +00:00
async def dim_screen():
2017-09-16 13:00:31 +00:00
await loop.sleep(5 * 1000000)
2017-03-30 15:35:15 +00:00
await ui.backlight_slide(ui.BACKLIGHT_DIM)
while True:
2017-09-16 13:00:31 +00:00
await loop.sleep(1000000)
2016-12-14 10:10:01 +00:00
def display_homescreen():
from apps.common import storage
2017-01-20 14:50:12 +00:00
image = res.load('apps/homescreen/res/trezor_logo.toig')
ui.display.icon(0, 0, image, ui.WHITE, ui.BLACK)
if not storage.is_initialized():
label = 'Go to trezor.io/start'
else:
label = storage.get_label()
if not label:
label = 'My TREZOR'
2016-12-14 10:10:01 +00:00
ui.display.text_center(120, 210, label, ui.BOLD, ui.WHITE, ui.BLACK)
@unimport
async def layout_homescreen():
while True:
display_homescreen()
2017-09-16 13:00:31 +00:00
await loop.wait(swipe_to_rotate(), dim_screen())