diff --git a/src/apps/__init__.py b/src/apps/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/apps/homescreen/__init__.py b/src/apps/homescreen/__init__.py new file mode 100644 index 000000000..678a799dc --- /dev/null +++ b/src/apps/homescreen/__init__.py @@ -0,0 +1,15 @@ +# Every application is supposed to have two entry points: +# +# boot() is called during device boot time and it should prepare +# all global things necessary to run. +# +# dispatch() is called once event subscribed in boot() is received. + +def dispatch(): + # Callback for HID messages + print("Dispatch homescreen") + +def boot(): + # Initilize app on boot time. + # This should hookup HID message types dispatcher() wants to receive. + print("Boot homescreen") diff --git a/src/apps/homescreen/layout_homescreen.py b/src/apps/homescreen/layout_homescreen.py new file mode 100644 index 000000000..b67b443d2 --- /dev/null +++ b/src/apps/homescreen/layout_homescreen.py @@ -0,0 +1,19 @@ +from trezor import ui +from trezor import loop +from trezor import layout + +def layout_homescreen(): + print("Homescreen layout!") + + from apps import playground + loop.call_later(5 * 1000000, layout.change(playground.layout_tap_to_confirm('1BitkeyP2nDd5oa64x7AjvBbbwST54W5Zmx2', 110.126967, 'BTC'))) + + ui.display.bar(0, 0, 240, 240, ui.WHITE) + + f = open('apps/homescreen/trezor.toig', 'r') + + def func(foreground): + f.seek(0) + ui.display.icon(0, 0, f.read(), foreground, ui.BLACK) + + yield from ui.animate_pulse(func, SPEED=400000, BASE_COLOR=(0xff, 0xff, 0xff), MIN_COLOR=0xaa, MAX_COLOR=0xff) diff --git a/src/apps/homescreen/trezor.toig b/src/apps/homescreen/trezor.toig new file mode 100644 index 000000000..8ab461e3b Binary files /dev/null and b/src/apps/homescreen/trezor.toig differ diff --git a/src/apps/playground/__init__.py b/src/apps/playground/__init__.py new file mode 100644 index 000000000..cb8146e50 --- /dev/null +++ b/src/apps/playground/__init__.py @@ -0,0 +1,59 @@ +from trezor import loop +from trezor import layout +from trezor import ui +from trezor.utils import unimport_func + +def layout_tap_to_confirm(address, amount, currency): + + from trezor.main import _main_layout + loop.call_later(5 * 1000000, layout.change(_main_layout())) + + ui.display.bar(0, 0, 240, 40, ui.GREEN) + ui.display.bar(0, 40, 240, 200, ui.WHITE) + + ui.display.text(10, 28, 'Sending', ui.BOLD, ui.WHITE, ui.GREEN) + ui.display.text(10, 80, '%f %s' % (amount, currency), ui.BOLD, ui.BLACK, ui.WHITE) + ui.display.text(10, 110, 'to this address:', ui.NORMAL, ui.BLACK, ui.WHITE) + 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', 'r') + _background = ui.rgbcolor(255, 255, 255) + + def func(foreground): + ui.display.text(68, 212, 'TAP TO CONFIRM', 2, foreground, _background) + + f.seek(0) + ui.display.icon(3, 170, f.read(), _background, foreground) + + yield from ui.animate_pulse(func) # , DELAY=10000) + +@unimport_func +def zprava(): + from _io import BytesIO + + from trezor.messages.GetAddress import GetAddress + + m = GetAddress() + m.address_n = [1, 2, 3] + m.show_display = True + + print(m.__dict__) + f = BytesIO() + m.dump(f) + data = f.getvalue() + f.close() + print(data) + # m2 = GetAddress.load(BytesIO(data)) + # print(m2.__dict__) + +def dispatch(): + # Callback for HID messages + print("Dispatch playground") + +def boot(): + # Initilize app on boot time. + # This should hookup HID message types dispatcher() wants to receive. + print("Boot playground") + + zprava() diff --git a/src/apps/playground/tap_64.png b/src/apps/playground/tap_64.png new file mode 100644 index 000000000..8736ab5cd Binary files /dev/null and b/src/apps/playground/tap_64.png differ diff --git a/src/apps/playground/tap_64.toig b/src/apps/playground/tap_64.toig new file mode 100644 index 000000000..1bd987bd0 Binary files /dev/null and b/src/apps/playground/tap_64.toig differ