mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-04 13:52:35 +00:00
21 lines
605 B
Python
21 lines
605 B
Python
from trezor import loop, ui
|
|
|
|
if False:
|
|
from typing import Iterable
|
|
|
|
|
|
class Popup(ui.Layout):
|
|
def __init__(self, content: ui.Control, time_ms: int = 0) -> None:
|
|
self.content = content
|
|
self.time_ms = time_ms
|
|
|
|
def dispatch(self, event: int, x: int, y: int) -> None:
|
|
self.content.dispatch(event, x, y)
|
|
|
|
def create_tasks(self) -> Iterable[loop.Task]:
|
|
return self.handle_input(), self.handle_rendering(), self.handle_timeout()
|
|
|
|
def handle_timeout(self) -> loop.Task: # type: ignore
|
|
yield loop.sleep(self.time_ms * 1000)
|
|
raise ui.Result(None)
|