# re-export constants from modtrezorui NORMAL = Display.FONT_NORMAL BOLD = Display.FONT_BOLD MONO = Display.FONT_MONO MONO_BOLD = Display.FONT_MONO_BOLD SIZE = Display.FONT_SIZE WIDTH = Display.WIDTH HEIGHT = Display.HEIGHT # viewport margins VIEWX = const(6) VIEWY = const(9) # channel used to cancel layouts, see `Cancelled` exception layout_chan = loop.chan() # allow only one alert at a time to avoid alerts overlapping _alert_in_progress = False # in debug mode, display an indicator in top right corner if __debug__: from apps.debug import screenshot def refresh() -> None: if not screenshot(): display.bar(Display.WIDTH - 8, 0, 8, 8, 0xF800) display.refresh() else: refresh = display.refresh
from trezor.messages.Success import Success if False: from typing import List, Optional from trezor.messages.DebugLinkDecision import DebugLinkDecision from trezor.messages.DebugLinkGetState import DebugLinkGetState from trezor.messages.DebugLinkRecordScreen import DebugLinkRecordScreen from trezor.messages.DebugLinkReseedRandom import DebugLinkReseedRandom from trezor.messages.DebugLinkState import DebugLinkState from trezor.messages.DebugLinkEraseSdCard import DebugLinkEraseSdCard save_screen = False save_screen_directory = "." reset_internal_entropy = None # type: Optional[bytes] reset_current_words = loop.chan() reset_word_index = loop.chan() confirm_chan = loop.chan() swipe_chan = loop.chan() input_chan = loop.chan() confirm_signal = confirm_chan.take swipe_signal = swipe_chan.take input_signal = input_chan.take debuglink_decision_chan = loop.chan() layout_change_chan = loop.chan() current_content = None # type: Optional[List[str]] def screenshot() -> bool:
from trezor import loop if False: from trezor import ui from typing import List, Callable, Optional workflows = [] # type: List[loop.Task] layouts = [] # type: List[ui.Layout] layout_signal = loop.chan() default = None # type: Optional[loop.Task] default_layout = None # type: Optional[Callable[[], loop.Task]] def onstart(w: loop.Task) -> None: workflows.append(w) def onclose(w: loop.Task) -> None: workflows.remove(w) if not layouts and default_layout: startdefault(default_layout) if __debug__: import micropython from trezor import utils if utils.LOG_MEMORY: micropython.mem_info() def closedefault() -> None: