summaryrefslogtreecommitdiff
path: root/wasp/widgets.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-03-09 00:00:13 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-03-09 00:00:13 (GMT)
commit031d139b7c31f83791c8c35cc78624aa1eda6da2 (patch)
tree0322cf93239101571d3e8b1c29a9e0980313abe0 /wasp/widgets.py
parent5413d826d7ffe825b759cd013f9f68e9311aee01 (diff)
wasp: draw565: Refactor to allow apps to focus on the drawable.
Diffstat (limited to 'wasp/widgets.py')
-rw-r--r--wasp/widgets.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/wasp/widgets.py b/wasp/widgets.py
index ee06187..3b2d6e1 100644
--- a/wasp/widgets.py
+++ b/wasp/widgets.py
@@ -11,10 +11,11 @@ class BatteryMeter(object):
def update(self):
icon = icons.battery
+ draw = watch.drawable
if watch.battery.charging():
if self.level != -1:
- watch.display.rleblit(icon, pos=(239-icon[0], 0), fg=0x7bef)
+ draw.rleblit(icon, pos=(239-icon[0], 0), fg=0x7bef)
self.level = -1
else:
level = watch.battery.level()
@@ -33,16 +34,16 @@ class BatteryMeter(object):
if (level > 5) ^ (self.level > 5):
if level > 5:
- watch.display.rleblit(icon, pos=(239-icon[0], 0), fg=0x7bef)
+ draw.rleblit(icon, pos=(239-icon[0], 0), fg=0x7bef)
else:
rgb = 0xf800
- watch.display.rleblit(icon, pos=(239-icon[0], 0), fg=0xf800)
+ draw.rleblit(icon, pos=(239-icon[0], 0), fg=0xf800)
x = 239 - 30
w = 16
if 24 - h:
- watch.display.fill(0, x, 14, w, 24 - h)
+ draw.fill(0, x, 14, w, 24 - h)
if h:
- watch.display.fill(rgb, x, 38 - h, w, h)
+ draw.fill(rgb, x, 38 - h, w, h)
self.level = level