summaryrefslogtreecommitdiff
path: root/wasp/testapp.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-03-08 10:18:08 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-03-08 10:18:08 (GMT)
commitb5b96bd7760f76d9bb476eb835f49b3c9586ca5c (patch)
tree2c9f5e9d4682a1efc870754d2e37d680f33925a2 /wasp/testapp.py
parent753a1e68f114772cd0fce765c7ec4770c8e34036 (diff)
wasp: Integrate the touch driver
At this point we are starting to bring an event model for applications but there's still a long way to go!
Diffstat (limited to 'wasp/testapp.py')
-rw-r--r--wasp/testapp.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/wasp/testapp.py b/wasp/testapp.py
new file mode 100644
index 0000000..2cf3431
--- /dev/null
+++ b/wasp/testapp.py
@@ -0,0 +1,35 @@
+import watch
+import widgets
+import manager
+
+from draw565 import Draw565
+
+class TouchTestApp(object):
+ """Simple application to visualize touch events.
+ """
+
+ def __init__(self):
+ pass
+
+ def foreground(self, system, effect=None):
+ """Activate the application."""
+ self.on_screen = ( -1, -1, -1, -1, -1, -1 )
+ self.draw(effect)
+ system.request_event(manager.EVENT_TOUCH)
+
+ def background(self):
+ """De-activate the application (without losing state)."""
+ pass
+
+ def sleep(self):
+ return False
+
+ def touch(self, event):
+ draw = Draw565(watch.display)
+ draw.string('({}, {})'.format(event[1], event[2]),
+ 0, 180, width=240)
+ return True
+
+ def draw(self, effect=None):
+ """Redraw the display from scratch."""
+ watch.display.fill(0)