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/trezor/ui/popup.py

22 lines
701 B

from trezor import loop, ui, utils
class Popup(ui.Layout):
def __init__(self, content: ui.Component, time_ms: int = 0) -> None:
super().__init__()
self.content = content
if utils.DISABLE_ANIMATION:
self.time_ms = 0
else:
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) -> tuple[loop.Task, ...]:
return self.handle_input(), self.handle_rendering(), self.handle_timeout()
def handle_timeout(self) -> loop.Task: # type: ignore [awaitable-is-generator]
yield loop.sleep(self.time_ms)
raise ui.Result(None)