You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/core/src/apps/homescreen/lockscreen.py

39 lines
1.1 KiB

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)