introduce trezor.res module

This commit is contained in:
Pavol Rusnak 2016-05-27 14:12:44 +02:00
parent bf4d1bdea3
commit 0b54ae9124
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
9 changed files with 9 additions and 10 deletions

View File

Before

Width:  |  Height:  |  Size: 887 B

After

Width:  |  Height:  |  Size: 887 B

View File

@ -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)

View File

@ -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)

Binary file not shown.

View File

@ -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)

View File

@ -0,0 +1,3 @@
def loadres(name):
with open(name, 'rb') as f:
return f.read()