summaryrefslogtreecommitdiff
path: root/wasp/apps
diff options
context:
space:
mode:
authorAidan Houlihan <aidandhoulihan@gmail.com>2020-10-31 20:51:28 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-11-29 09:12:03 (GMT)
commit393dfefc86be9b0fe518d4a1421fe642ada9b75e (patch)
treefb2f800eeacf7bd2f02adf616355d4e8011ab51e /wasp/apps
parent4c0120aa1ea93a280824e96e9221b8dbee82121f (diff)
apps: pager: notifications: Added remove all notifications dialog
Signed-off-by: Aidan Houlihan <aidandhoulihan@gmail.com> [daniel@redfelineninja.org.uk: Minor changes to .gitignore] Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/apps')
-rw-r--r--wasp/apps/pager.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/wasp/apps/pager.py b/wasp/apps/pager.py
index db12b3f..416a006 100644
--- a/wasp/apps/pager.py
+++ b/wasp/apps/pager.py
@@ -82,19 +82,40 @@ class NotificationApp(PagerApp):
def __init__(self):
super().__init__('')
+ self.confirmation_view = wasp.widgets.ConfirmationView()
def foreground(self):
notes = wasp.system.notifications
-
- id = next(iter(notes))
- note = notes[id]
- del notes[id]
+ note = notes.pop(next(iter(notes)))
title = note['title'] if 'title' in note else 'Untitled'
body = note['body'] if 'body' in note else ''
self._msg = '{}\n\n{}'.format(title, body)
+ wasp.system.request_event(wasp.EventMask.TOUCH)
super().foreground()
+ def swipe(self, event):
+ if event[0] == wasp.EventType.DOWN:
+ self.confirmation_view.active = True
+ self._draw()
+ super().swipe(event)
+
+
+ def _draw(self):
+ if self.confirmation_view.active:
+ self.confirmation_view.draw('clear notifications?')
+ else:
+ super()._draw()
+
+ def touch(self, event):
+ if self.confirmation_view.active:
+ is_confirmed = self.confirmation_view.touch(event)
+ if is_confirmed:
+ wasp.system.notifications = {}
+ wasp.system.navigate(wasp.EventType.BACK)
+ self.confirmation_view.active = False
+
+
class CrashApp():
"""Crash handler application.