all clocks: Add a preview() method ready for a watch face chooser
One benefit from wasp-os' dirt simple drawing model is that it is very easy for apps to provide full screen previews of themselves. Add this for all clocks ready for us to add a watch face chooser application. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
3ea061508f
commit
2a1ac32279
6 changed files with 37 additions and 0 deletions
|
@ -50,6 +50,11 @@ class ChronoApp():
|
||||||
"""Periodic callback to update the display."""
|
"""Periodic callback to update the display."""
|
||||||
self._draw()
|
self._draw()
|
||||||
|
|
||||||
|
def preview(self):
|
||||||
|
"""Provide a preview for the watch face selection."""
|
||||||
|
wasp.system.bar.clock = False
|
||||||
|
self._draw(True)
|
||||||
|
|
||||||
def _draw(self, redraw=False):
|
def _draw(self, redraw=False):
|
||||||
"""Draw or lazily update the display.
|
"""Draw or lazily update the display.
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,11 @@ class ClockApp():
|
||||||
"""Periodic callback to update the display."""
|
"""Periodic callback to update the display."""
|
||||||
self._draw()
|
self._draw()
|
||||||
|
|
||||||
|
def preview(self):
|
||||||
|
"""Provide a preview for the watch face selection."""
|
||||||
|
wasp.system.bar.clock = False
|
||||||
|
self._draw(True)
|
||||||
|
|
||||||
def _draw(self, redraw=False):
|
def _draw(self, redraw=False):
|
||||||
"""Draw or lazily update the display.
|
"""Draw or lazily update the display.
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,11 @@ class DualClockApp():
|
||||||
"""Periodic callback to update the display."""
|
"""Periodic callback to update the display."""
|
||||||
self._draw()
|
self._draw()
|
||||||
|
|
||||||
|
def preview(self):
|
||||||
|
"""Provide a preview for the watch face selection."""
|
||||||
|
wasp.system.bar.clock = False
|
||||||
|
self._draw(True)
|
||||||
|
|
||||||
def _draw(self, redraw=False):
|
def _draw(self, redraw=False):
|
||||||
"""Draw or lazily update the display.
|
"""Draw or lazily update the display.
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,11 @@ class FibonacciClockApp():
|
||||||
def tick(self, ticks):
|
def tick(self, ticks):
|
||||||
self._draw()
|
self._draw()
|
||||||
|
|
||||||
|
def preview(self):
|
||||||
|
"""Provide a preview for the watch face selection."""
|
||||||
|
wasp.system.bar.clock = False
|
||||||
|
self._draw(True)
|
||||||
|
|
||||||
def _draw(self, redraw=False):
|
def _draw(self, redraw=False):
|
||||||
"""Draw or lazily update the display."""
|
"""Draw or lazily update the display."""
|
||||||
draw = wasp.watch.drawable
|
draw = wasp.watch.drawable
|
||||||
|
|
|
@ -63,6 +63,18 @@ class TemplateApp():
|
||||||
"""Notify the application the device is waking up."""
|
"""Notify the application the device is waking up."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def preview(self):
|
||||||
|
"""Provide a preview for the watch face selection.
|
||||||
|
|
||||||
|
preview() must be implemented by watch face applications because it
|
||||||
|
is called by the watch face selector. When called the application should
|
||||||
|
redraw the screen as through it was the foreground() application. The
|
||||||
|
application will not be active after the preview.
|
||||||
|
|
||||||
|
Other applications should not implement this entry point.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def press(self, button, state):
|
def press(self, button, state):
|
||||||
"""Notify the application of a button-press event."""
|
"""Notify the application of a button-press event."""
|
||||||
draw = wasp.watch.drawable
|
draw = wasp.watch.drawable
|
||||||
|
|
|
@ -55,6 +55,11 @@ class WordClockApp():
|
||||||
"""Periodic callback to update the display."""
|
"""Periodic callback to update the display."""
|
||||||
self._draw()
|
self._draw()
|
||||||
|
|
||||||
|
def preview(self):
|
||||||
|
"""Provide a preview for the watch face selection."""
|
||||||
|
wasp.system.bar.clock = False
|
||||||
|
self._draw(True)
|
||||||
|
|
||||||
def _draw(self, redraw=False):
|
def _draw(self, redraw=False):
|
||||||
"""Draw or lazily update the display.
|
"""Draw or lazily update the display.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue