mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-02 12:52:34 +00:00

this involves some changes to the workflow defaults: * workflow.start_default() takes no arguments * workflow.set_default() (originally replace_default) configures the default that will be started by next call to start_default(). The intended usecase is to set_default() first and then start it separately. * apps.base.set_homescreen() factors out the logic originally in main.py, that decides which homescreen should be launched. This uses set_default() call. start_default() is then used explicitly in main.py
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from trezor import res, ui
|
|
|
|
from . import HomescreenBase
|
|
|
|
|
|
async def lockscreen() -> None:
|
|
from apps.common.request_pin import can_lock_device
|
|
from apps.base import unlock_device
|
|
|
|
if can_lock_device():
|
|
await Lockscreen()
|
|
|
|
await unlock_device()
|
|
|
|
|
|
class Lockscreen(HomescreenBase):
|
|
def __init__(self, lock_label: str = "Locked") -> None:
|
|
self.lock_label = lock_label
|
|
super().__init__()
|
|
|
|
def render_lock(self) -> None:
|
|
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, self.lock_label, 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)
|
|
|
|
def on_render(self) -> None:
|
|
self.render_homescreen()
|
|
self.render_lock()
|
|
|
|
def on_touch_end(self, x: int, y: int) -> None:
|
|
raise ui.Result(None)
|