apps.homescreen: display device label
This commit is contained in:
parent
cdc2c9ee08
commit
e111f6338c
|
@ -1,6 +1,7 @@
|
||||||
from trezor import ui, loop, res
|
from trezor import ui, loop, res
|
||||||
from trezor.utils import unimport
|
from trezor.utils import unimport
|
||||||
|
|
||||||
|
|
||||||
async def swipe_to_rotate():
|
async def swipe_to_rotate():
|
||||||
from trezor.ui.swipe import Swipe
|
from trezor.ui.swipe import Swipe
|
||||||
|
|
||||||
|
@ -9,32 +10,34 @@ async def swipe_to_rotate():
|
||||||
ui.display.orientation(degrees)
|
ui.display.orientation(degrees)
|
||||||
|
|
||||||
|
|
||||||
'''
|
|
||||||
async def animate_logo():
|
|
||||||
image = res.load('apps/homescreen/res/trezor.toig')
|
|
||||||
|
|
||||||
def render(fg):
|
|
||||||
ui.display.icon(0, 0, image, fg, ui.BLACK)
|
|
||||||
await ui.animate_pulse(render, ui.WHITE, ui.DARK_GREY, speed=800000)
|
|
||||||
'''
|
|
||||||
|
|
||||||
async def dim_screen():
|
async def dim_screen():
|
||||||
current = ui.display.backlight()
|
current = ui.display.backlight()
|
||||||
|
|
||||||
await loop.Sleep(5*1000000)
|
await loop.Sleep(5 * 1000000)
|
||||||
await ui.backlight_slide(ui.BACKLIGHT_DIM)
|
await ui.backlight_slide(ui.BACKLIGHT_DIM)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
await loop.Sleep(1000000)
|
await loop.Sleep(1000000)
|
||||||
except:
|
finally:
|
||||||
# Return back to original brightness
|
# Return back to original brightness
|
||||||
ui.display.backlight(current)
|
ui.display.backlight(current)
|
||||||
|
|
||||||
@unimport
|
|
||||||
async def layout_homescreen():
|
def display_homescreen():
|
||||||
|
from apps.common import storage
|
||||||
|
|
||||||
image = res.load('apps/homescreen/res/trezor.toig')
|
image = res.load('apps/homescreen/res/trezor.toig')
|
||||||
ui.display.icon(0, 0, image, ui.WHITE, ui.BLACK)
|
ui.display.icon(0, 0, image, ui.WHITE, ui.BLACK)
|
||||||
|
|
||||||
|
ui.display.bar(0, 180, 240, 240, ui.BLACK)
|
||||||
|
|
||||||
|
label = storage.get_label() or 'My TREZOR'
|
||||||
|
ui.display.text_center(120, 210, label, ui.BOLD, ui.WHITE, ui.BLACK)
|
||||||
|
|
||||||
|
|
||||||
|
@unimport
|
||||||
|
async def layout_homescreen():
|
||||||
|
display_homescreen()
|
||||||
ui.display.backlight(ui.BACKLIGHT_NORMAL)
|
ui.display.backlight(ui.BACKLIGHT_NORMAL)
|
||||||
await loop.Wait([swipe_to_rotate(), dim_screen()])
|
await loop.Wait([swipe_to_rotate(), dim_screen()])
|
||||||
|
|
Loading…
Reference in New Issue