1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-04 21:48:17 +00:00
trezor-firmware/src/trezor/workflow.py

44 lines
861 B
Python
Raw Normal View History

from trezor import log
from trezor import loop
from trezor import ui
started = []
default = None
default_handler = None
def onstart(w):
closedefault()
started.append(w)
ui.display.backlight(ui.BACKLIGHT_NORMAL)
log.debug(__name__, 'onstart: %s', w)
def onclose(w):
started.remove(w)
log.debug(__name__, 'onclose: %s', w)
2016-10-06 10:35:05 +00:00
if not started and default_handler:
startdefault(default_handler)
def closedefault():
global default
if default:
default.close()
default = None
log.debug(__name__, 'closedefault')
def startdefault(handler):
global default
global default_handler
if not default:
default_handler = handler
default = handler()
2017-09-16 13:00:31 +00:00
loop.schedule(default)
ui.display.backlight(ui.BACKLIGHT_NORMAL)
2017-09-02 21:10:54 +00:00
log.debug(__name__, 'startdefault')