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/widgets.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/widgets.py')
| -rw-r--r-- | wasp/widgets.py | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/wasp/widgets.py b/wasp/widgets.py index 5d8cc9a..2fcac9e 100644 --- a/wasp/widgets.py +++ b/wasp/widgets.py @@ -9,10 +9,11 @@ shared between applications. """ import icons +import wasp import watch from micropython import const -class BatteryMeter(object): +class BatteryMeter: """Battery meter widget. A simple battery meter with a charging indicator, will draw at the @@ -69,7 +70,33 @@ class BatteryMeter(object): self.level = level -class ScrollIndicator(): +class Notifier: + """Show if there are pending notifications.""" + def __init__(self, x=8, y=8): + self._pos = (x, y) + + def draw(self): + """Update the notification widget. + + For this simple widget :py:meth:`~.draw` is simply a synonym for + :py:meth:`~.update`. + """ + self.update() + + def update(self): + """Update the widget. + + For this simple widget :py:meth:~.update` does nothing! + """ + draw = watch.drawable + (x, y) = self._pos + + if wasp.system.notifications: + draw.blit(icons.notification, x, y, fg=0x7bef) + else: + draw.fill(0, x, y, 32, 32) + +class ScrollIndicator: """Scrolling indicator. A simple battery meter with a charging indicator, will draw at the |
