2016-09-21 12:21:18 +00:00
|
|
|
from trezor import ui, loop, res
|
2016-09-26 14:11:38 +00:00
|
|
|
from trezor.utils import unimport
|
2016-04-30 13:57:08 +00:00
|
|
|
|
2016-08-05 10:34:47 +00:00
|
|
|
async def swipe_to_rotate():
|
2016-09-26 14:11:38 +00:00
|
|
|
from trezor.ui.swipe import Swipe
|
|
|
|
|
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-10-08 09:47:28 +00:00
|
|
|
'''
|
2016-08-05 10:34:47 +00:00
|
|
|
async def animate_logo():
|
2016-09-27 15:41:04 +00:00
|
|
|
image = res.load('apps/homescreen/res/trezor.toig')
|
|
|
|
|
|
|
|
def render(fg):
|
|
|
|
ui.display.icon(0, 0, image, fg, ui.BLACK)
|
2016-10-08 09:47:28 +00:00
|
|
|
await ui.animate_pulse(render, ui.WHITE, ui.DARK_GREY, speed=800000)
|
|
|
|
'''
|
|
|
|
|
|
|
|
async def dim_screen():
|
|
|
|
current = ui.display.backlight()
|
|
|
|
|
|
|
|
await loop.Sleep(5*1000000)
|
|
|
|
await ui.backlight_slide(ui.BACKLIGHT_DIM)
|
2016-05-25 12:27:22 +00:00
|
|
|
|
2016-10-08 09:47:28 +00:00
|
|
|
try:
|
|
|
|
while True:
|
|
|
|
await loop.Sleep(1000000)
|
|
|
|
except:
|
|
|
|
# Return back to original brightness
|
|
|
|
ui.display.backlight(current)
|
2016-05-25 12:27:22 +00:00
|
|
|
|
2016-09-26 14:11:38 +00:00
|
|
|
@unimport
|
2016-09-21 12:21:18 +00:00
|
|
|
async def layout_homescreen():
|
2016-10-08 09:47:28 +00:00
|
|
|
image = res.load('apps/homescreen/res/trezor.toig')
|
|
|
|
ui.display.icon(0, 0, image, ui.WHITE, ui.BLACK)
|
|
|
|
|
|
|
|
ui.display.backlight(ui.BACKLIGHT_NORMAL)
|
|
|
|
await loop.Wait([swipe_to_rotate(), dim_screen()])
|