From 910033d71c301327f0f45ae6970eb0f8e22f430e Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Wed, 8 Feb 2017 16:19:33 +0100 Subject: [PATCH] trezor.ui: add Widget --- src/trezor/ui/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/trezor/ui/__init__.py b/src/trezor/ui/__init__.py index fec90b89eb..a244a15a7a 100644 --- a/src/trezor/ui/__init__.py +++ b/src/trezor/ui/__init__.py @@ -121,3 +121,20 @@ def rotate_coords(pos: tuple) -> tuple: return (240 - x, 240 - y) if r == 270: return (240 - y, x) + + +class Widget: + + def render(self): + pass + + def touch(self, event, pos): + pass + + def __iter__(self): + while True: + self.render() + event, *pos = yield loop.Select(loop.TOUCH) + result = self.touch(event, pos) + if result is not None: + return result