summaryrefslogtreecommitdiff
path: root/wasp/apps
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-03-08 23:16:30 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-03-08 23:16:30 (GMT)
commit5413d826d7ffe825b759cd013f9f68e9311aee01 (patch)
treeb4d111931455dffc8a3ea7e4bab219ad856072c3 /wasp/apps
parent24438ad05daae80c4d27c6e8d0345bfd61d5578b (diff)
wasp: Re-factor how Draw565 is used.
Moving it from applications into the watch is useful for two reasons. Firstly it means applications don't need to know as much about the display color depth and secondly it makes it easier to replace the drawing routines with wasptool.
Diffstat (limited to 'wasp/apps')
-rw-r--r--wasp/apps/clock.py4
-rw-r--r--wasp/apps/flashlight.py2
-rw-r--r--wasp/apps/testapp.py7
3 files changed, 3 insertions, 10 deletions
diff --git a/wasp/apps/clock.py b/wasp/apps/clock.py
index 5de6271..cde39a2 100644
--- a/wasp/apps/clock.py
+++ b/wasp/apps/clock.py
@@ -3,8 +3,6 @@ import watch
import widgets
import manager
-from draw565 import Draw565
-
DIGITS = (
digits.clock_0,
digits.clock_1,
@@ -86,7 +84,7 @@ class ClockApp(object):
display.rleblit(DIGITS[now[3] // 10], pos=(0*48, 80), fg=0xbdb6)
self.on_screen = now
- draw = Draw565(display)
+ draw = watch.drawable
month = now[1] - 1
month = MONTH[month*3:(month+1)*3]
draw.string('{} {} {}'.format(now[2], month, now[0]),
diff --git a/wasp/apps/flashlight.py b/wasp/apps/flashlight.py
index d71342b..f1f9418 100644
--- a/wasp/apps/flashlight.py
+++ b/wasp/apps/flashlight.py
@@ -1,8 +1,6 @@
import watch
import manager
-from draw565 import Draw565
-
class FlashlightApp(object):
"""Trivial flashlight application.
diff --git a/wasp/apps/testapp.py b/wasp/apps/testapp.py
index 7bbfc2c..56a3853 100644
--- a/wasp/apps/testapp.py
+++ b/wasp/apps/testapp.py
@@ -3,8 +3,6 @@ import widgets
import manager
import machine
-from draw565 import Draw565
-
class TestApp():
"""Simple test application.
"""
@@ -12,7 +10,6 @@ class TestApp():
def __init__(self):
self.tests = ('Touch', 'String')
self.test = self.tests[0]
- self.drawable = Draw565(watch.display)
def foreground(self, system, effect=None):
"""Activate the application."""
@@ -36,7 +33,7 @@ class TestApp():
self.draw()
def touch(self, event):
- draw = self.drawable
+ draw = watch.drawable
if self.test == 'Touch':
draw.string('({}, {})'.format(event[1], event[2]),
0, 108, width=240)
@@ -60,6 +57,6 @@ class TestApp():
"""Redraw the display from scratch."""
watch.display.mute(True)
watch.display.fill(0)
- self.drawable.string('{} test'.format(self.test),
+ watch.drawable.string('{} test'.format(self.test),
0, 6, width=240)
watch.display.mute(False)