diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-11-29 12:27:57 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-11-29 19:14:31 (GMT) |
| commit | 39c9344b14e22822845254445f35ff598e702fda (patch) | |
| tree | 32ced29e177f9b45fa4a49ba9390fdc72b253eb0 /wasp/apps | |
| parent | 707c4e2fa7fc2d1d79db737ead90d84a1453161b (diff) | |
apps: alarm: Fix touch handling when the alarm is ringing
Currently the widgets react to touch when the alarm is ringing (and they
are invisible. For now we fix this by disabling the alarm on a touch
event. Maybe the app should reject touch events since they could acidentally
dismiss the alarm... but we already disable the alarm if we get a swipe
event so this doesn't make things much worse than they already are!
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/apps')
| -rw-r--r-- | wasp/apps/alarm.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/wasp/apps/alarm.py b/wasp/apps/alarm.py index 6bc855f..9b666ff 100644 --- a/wasp/apps/alarm.py +++ b/wasp/apps/alarm.py @@ -60,8 +60,7 @@ class AlarmApp(): """Activate the application.""" self._draw() wasp.system.request_event(wasp.EventMask.TOUCH) - if self.ringing: - wasp.system.request_tick(1000) + wasp.system.request_tick(1000) wasp.system.cancel_alarm(self.current_alarm, self._alert) def background(self): @@ -74,13 +73,21 @@ class AlarmApp(): def tick(self, ticks): """Notify the application that its periodic tick is due.""" - wasp.watch.vibrator.pulse(duty=50, ms=500) - wasp.system.keep_awake() + if self.ringing: + wasp.watch.vibrator.pulse(duty=50, ms=500) + wasp.system.keep_awake() def touch(self, event): """Notify the application of a touchscreen touch event.""" draw = wasp.watch.drawable - if event[1] in range(90, 150) and event[2] in range(180,240): + if self.ringing: + mute = wasp.watch.display.mute + self.ringing = False + mute(True) + self._draw() + mute(False) + + elif event[1] in range(90, 150) and event[2] in range(180,240): self.active = not self.active elif event[1] in range(30,90): @@ -128,7 +135,7 @@ class AlarmApp(): draw.fill() draw.string("Alarm", 0, 150, width=240) draw.blit(icon, 73, 50) - + def _update(self): """Update the dynamic parts of the application display.""" draw = wasp.watch.drawable @@ -136,7 +143,7 @@ class AlarmApp(): draw.fill(0x001f, 102, 192, 36, 36) else: draw.fill(0x0000, 102, 192, 36, 36) - + if self.hours < 10: draw.string("0"+str(self.hours), 10, 100, width=100) else: |
