summaryrefslogtreecommitdiff
path: root/wasp/manager.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-03-08 20:48:48 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-03-08 20:48:48 (GMT)
commitcfffeddd774774a14cbb77ad899d047a259f16f3 (patch)
tree075b213655e1b7c82ec03408811ae9c6d52162ee /wasp/manager.py
parenta864a93706aa45e1f104b9710bc47f3b26bc4781 (diff)
wasp: testapp: Extend with a string render test
Diffstat (limited to 'wasp/manager.py')
-rw-r--r--wasp/manager.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/wasp/manager.py b/wasp/manager.py
index d5a4ff9..3dafebe 100644
--- a/wasp/manager.py
+++ b/wasp/manager.py
@@ -3,7 +3,7 @@ import machine
from apps.clock import ClockApp
from apps.flashlight import FlashlightApp
-from apps.testapp import TouchTestApp
+from apps.testapp import TestApp
DOWN = 1
UP = 2
@@ -11,7 +11,9 @@ LEFT = 3
RIGHT = 4
EVENT_TOUCH = 0x0001
-EVENT_BUTTON = 0x0002
+EVENT_SWIPE_LEFTRIGHT = 0x0002
+EVENT_SWIPE_UPDOWN = 0x0004
+EVENT_BUTTON = 0x0008
class Manager(object):
def __init__(self, watch):
@@ -22,7 +24,7 @@ class Manager(object):
self.applications = [
ClockApp(),
FlashlightApp(),
- TouchTestApp()
+ TestApp()
]
self.watch.display.poweron()
@@ -79,8 +81,15 @@ class Manager(object):
def handle_event(self, event):
self.sleep_at = self.watch.rtc.uptime + 15
+ event_mask = self.event_mask
if event[0] < 5:
- self.navigate(event[0])
+ updown = event[0] == 1 or event[0] == 2
+ if (bool(event_mask & EVENT_SWIPE_UPDOWN) and updown) or \
+ (bool(event_mask & EVENT_SWIPE_LEFTRIGHT) and not updown):
+ if not self.app.swipe(event):
+ self.navigate(event[0])
+ else:
+ self.navigate(event[0])
elif event[0] == 5 and self.event_mask & EVENT_TOUCH:
self.app.touch(event)