mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-01 11:01:00 +00:00
40 lines
1.0 KiB
Python
40 lines
1.0 KiB
Python
from trezor import ui, loop, res
|
|
from trezor.utils import unimport
|
|
|
|
|
|
async def swipe_to_rotate():
|
|
from trezor.ui.swipe import Swipe, degrees
|
|
|
|
swipe = await Swipe(absolute=True)
|
|
ui.display.orientation(degrees(swipe))
|
|
|
|
|
|
async def dim_screen():
|
|
await loop.sleep(5 * 1000000)
|
|
await ui.backlight_slide(ui.BACKLIGHT_DIM)
|
|
while True:
|
|
await loop.sleep(10000000)
|
|
|
|
|
|
@ui.layout
|
|
async def display_homescreen():
|
|
from apps.common import storage
|
|
|
|
image = res.load('apps/homescreen/res/homescreen.toif')
|
|
ui.display.bar(0, 0, ui.SCREEN, ui.SCREEN, ui.BG)
|
|
ui.display.avatar((ui.SCREEN - 144) // 2, (ui.SCREEN - 144) // 2 - 10, image, ui.WHITE, ui.BLACK)
|
|
|
|
if not storage.is_initialized():
|
|
label = 'Go to trezor.io/start'
|
|
else:
|
|
label = storage.get_label() or 'My TREZOR'
|
|
ui.display.text_center(ui.SCREEN // 2, ui.SCREEN - 20, label, ui.BOLD, ui.FG, ui.BG)
|
|
|
|
await dim_screen()
|
|
|
|
|
|
@unimport
|
|
async def layout_homescreen():
|
|
while True:
|
|
await loop.wait(swipe_to_rotate(), display_homescreen())
|