mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
introduce trezor.res module
This commit is contained in:
parent
bf4d1bdea3
commit
0b54ae9124
Before Width: | Height: | Size: 887 B After Width: | Height: | Size: 887 B |
@ -1,6 +1,7 @@
|
||||
from trezor import ui
|
||||
from trezor.ui.swipe import Swipe
|
||||
from trezor import loop
|
||||
from trezor.res import loadres
|
||||
|
||||
|
||||
def swipe_to_change_orientation():
|
||||
@ -12,11 +13,8 @@ def swipe_to_change_orientation():
|
||||
def layout_homescreen():
|
||||
print("Homescreen layout!")
|
||||
|
||||
f = open('apps/homescreen/trezor.toig', 'rb')
|
||||
|
||||
def func(foreground):
|
||||
f.seek(0)
|
||||
ui.display.icon(0, 0, f.read(), foreground, ui.BLACK)
|
||||
ui.display.icon(0, 0, loadres('apps/homescreen/res/trezor.toig'), foreground, ui.BLACK)
|
||||
|
||||
orientation = swipe_to_change_orientation()
|
||||
animation = ui.animate_pulse(func, ui.WHITE, ui.GREY, speed=400000)
|
||||
|
@ -3,6 +3,7 @@ from trezor import ui
|
||||
from trezor import msg
|
||||
from trezor.ui.pin import PinDialog, PIN_CONFIRMED, PIN_CANCELLED
|
||||
from trezor.utils import unimport_func
|
||||
from trezor.res import loadres
|
||||
|
||||
|
||||
@unimport_func
|
||||
@ -17,14 +18,12 @@ def layout_tap_to_confirm(address, amount, currency):
|
||||
# ui.display.text(10, 140, address[:18], ui.MONO, ui.BLACK, ui.WHITE)
|
||||
# ui.display.text(10, 160, address[18:], ui.MONO, ui.BLACK, ui.WHITE)
|
||||
|
||||
# f = open('apps/playground/tap_64.toig', 'rb')
|
||||
# bg = ui.WHITE
|
||||
# style = ui.NORMAL
|
||||
|
||||
# def func(fg):
|
||||
# ui.display.text(68, 212, 'TAP TO CONFIRM', style, fg, bg)
|
||||
# f.seek(0)
|
||||
# ui.display.icon(3, 170, f.read(), bg, fg)
|
||||
# ui.display.icon(3, 170, loadres('apps/playground/res/tap_64.toig'), bg, fg)
|
||||
|
||||
# animation = ui.animate_pulse(func, ui.BLACK, ui.GREY, speed=200000)
|
||||
|
||||
|
BIN
src/apps/playground/res/tap_64.toig
Normal file
BIN
src/apps/playground/res/tap_64.toig
Normal file
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
from trezor import ui
|
||||
from trezor import loop
|
||||
from trezor.res import loadres
|
||||
|
||||
f = open('apps/playground_stick/fingerprint.toig', 'rb')
|
||||
c = ui.rgbcolor(0x20, 0x98, 0xD1)
|
||||
|
||||
def layout_homescreen():
|
||||
@ -12,8 +12,7 @@ def layout_homescreen():
|
||||
p = 0
|
||||
|
||||
def func(foreground):
|
||||
f.seek(0)
|
||||
ui.display.loader(p, c, 0, f.read(), foreground)
|
||||
ui.display.loader(p, c, 0, loadres('apps/playground_stick/res/fingerprint.toig'), foreground)
|
||||
p = (p + 10) % 1000
|
||||
|
||||
animation = ui.animate_pulse(func, ui.WHITE, ui.GREY, speed=400000)
|
||||
|
3
src/trezor/res/__init__.py
Normal file
3
src/trezor/res/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
def loadres(name):
|
||||
with open(name, 'rb') as f:
|
||||
return f.read()
|
Loading…
Reference in New Issue
Block a user