diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-07-19 19:50:33 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-07-19 19:50:33 (GMT) |
| commit | a01fb7df573e13a6f6b9fbf2e7688d4e9713df6d (patch) | |
| tree | 5118831a0fa174681ade9aaf850b7613309a2803 /wasp/wasp.py | |
| parent | 6686f17e724b9a22318ff2248ce126a97dd19db4 (diff) | |
Introduction basic notification support
This requires a modified version of Gadgetbridge and currently works by
implementing the BangleJS protocol.
In Gadgetbridge ensure "Sync time" is *not* set and choose "Don't pair"
when adding the PineTime device.
Diffstat (limited to 'wasp/wasp.py')
| -rw-r--r-- | wasp/wasp.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/wasp/wasp.py b/wasp/wasp.py index a9f1a30..5246718 100644 --- a/wasp/wasp.py +++ b/wasp/wasp.py @@ -25,7 +25,7 @@ from apps.clock import ClockApp from apps.flashlight import FlashlightApp from apps.heart import HeartApp from apps.launcher import LauncherApp -from apps.pager import PagerApp, CrashApp +from apps.pager import PagerApp, CrashApp, NotificationApp from apps.settings import SettingsApp from apps.steps import StepCounterApp from apps.stopwatch import StopwatchApp @@ -101,6 +101,8 @@ class Manager(): self.quick_ring = [] self.launcher = LauncherApp() self.launcher_ring = [] + self.notifier = NotificationApp() + self.notifications = {} self.blank_after = 15 @@ -202,13 +204,26 @@ class Manager(): if self.app != app_list[0]: self.switch(app_list[0]) else: - watch.vibrator.pulse() + if len(self.notifications): + self.switch(self.notifier) + else: + # Nothing to notify... we must handle that here + # otherwise the display will flicker. + watch.vibrator.pulse() + elif direction == EventType.HOME or direction == EventType.BACK: if self.app != app_list[0]: self.switch(app_list[0]) else: self.sleep() + def notify(self, id, msg): + self.notifications[id] = msg + + def unnotify(self, id): + if id in self.notifications: + del self.notifications[id] + def request_event(self, event_mask): """Subscribe to events. |
