async def lockscreen() -> None: label = storage_device.get_label() image = storage_device.get_homescreen() if not label: label = "My Trezor" if not image: image = res.load("apps/homescreen/res/bg.toif") ui.backlight_fade(ui.BACKLIGHT_DIM) ui.display.clear() ui.display.avatar(48, 48, image, ui.TITLE_GREY, ui.BG) ui.display.text_center(ui.WIDTH // 2, 35, label, ui.BOLD, ui.TITLE_GREY, ui.BG) ui.display.bar_radius(40, 100, 160, 40, ui.TITLE_GREY, ui.BG, 4) ui.display.bar_radius(42, 102, 156, 36, ui.BG, ui.TITLE_GREY, 4) ui.display.text_center(ui.WIDTH // 2, 128, "Locked", ui.BOLD, ui.TITLE_GREY, ui.BG) ui.display.text_center(ui.WIDTH // 2 + 10, 220, "Tap to unlock", ui.BOLD, ui.TITLE_GREY, ui.BG) ui.display.icon(45, 202, res.load(ui.ICON_CLICK), ui.TITLE_GREY, ui.BG) ui.backlight_fade(ui.BACKLIGHT_NORMAL) await ui.click()
def _start_progress() -> None: workflow.closedefault() ui.backlight_fade(ui.BACKLIGHT_DIM) ui.display.clear() ui.header("Please wait") ui.display.refresh() ui.backlight_fade(ui.BACKLIGHT_NORMAL)
async def homescreen() -> None: # render homescreen in dimmed mode and fade back in ui.backlight_fade(ui.BACKLIGHT_DIM) display_homescreen() ui.backlight_fade(ui.BACKLIGHT_NORMAL) # loop forever, never return touch = loop.wait(io.TOUCH) while True: await touch
def _start_progress() -> None: # Because we are drawing to the screen manually, without a layout, we # should make sure that no other layout is running. At this point, only # the homescreen should be on, so shut it down. workflow.close_default() ui.backlight_fade(ui.BACKLIGHT_DIM) ui.display.clear() ui.header("Please wait") ui.display.refresh() ui.backlight_fade(ui.BACKLIGHT_NORMAL)
def _before_render(self) -> None: # Clear the screen of any leftovers. ui.backlight_fade(ui.style.BACKLIGHT_DIM) ui.display.clear() if __debug__ and self.should_notify_layout_change: from apps.debug import notify_layout_change # notify about change and do not notify again until next await. # (handle_rendering might be called multiple times in a single await, # because of the endless loop in __iter__) self.should_notify_layout_change = False notify_layout_change(self) # Turn the brightness on again. ui.backlight_fade(self.BACKLIGHT_LEVEL)
ui.display.text_center(ui.WIDTH // 2, 128, "Locked", ui.BOLD, ui.TITLE_GREY, ui.BG) ui.display.text_center(ui.WIDTH // 2 + 10, 220, "Tap to unlock", ui.BOLD, ui.TITLE_GREY, ui.BG) ui.display.icon(45, 202, res.load(ui.ICON_CLICK), ui.TITLE_GREY, ui.BG) ui.backlight_fade(ui.BACKLIGHT_NORMAL) await ui.click() if utils.EMULATOR: # Ensure the emulated SD card is FAT32 formatted. sd = io.SDCard() sd.power(True) fs = io.FatFS() try: fs.mount() except OSError: fs.mkfs() else: fs.unmount() sd.power(False) ui.display.backlight(ui.BACKLIGHT_NONE) ui.backlight_fade(ui.BACKLIGHT_NORMAL) config.init(show_pin_timeout) loop.schedule(bootscreen()) loop.run()
def _start_progress(): ui.backlight_fade(ui.BACKLIGHT_DIM) ui.display.clear() ui.header("Please wait") ui.display.refresh() ui.backlight_fade(ui.BACKLIGHT_NORMAL)