docs: Fix warnings and add a few extra apps to the docs
This commit is contained in:
parent
af1379806c
commit
683c3497e0
4 changed files with 62 additions and 1 deletions
|
@ -19,6 +19,18 @@ Applications
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
|
|
||||||
|
.. automodule:: apps.launcher
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
|
||||||
|
.. automodule:: apps.pager
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
|
||||||
|
.. automodule:: apps.template
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
|
||||||
.. automodule:: apps.testapp
|
.. automodule:: apps.testapp
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
|
|
43
wasp/apps/template.py
Normal file
43
wasp/apps/template.py
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
# Copyright (C) 2020 Daniel Thompson
|
||||||
|
|
||||||
|
import wasp
|
||||||
|
import icons
|
||||||
|
|
||||||
|
class TemplateApp():
|
||||||
|
"""Template application ready to use as a basis for new applications.
|
||||||
|
"""
|
||||||
|
NAME = 'Template'
|
||||||
|
ICON = icons.app
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def foreground(self):
|
||||||
|
"""Activate the application."""
|
||||||
|
self._draw()
|
||||||
|
wasp.system.request_event(wasp.EventMask.TOUCH |
|
||||||
|
wasp.EventMask.SWIPE_UPDOWN |
|
||||||
|
wasp.EventMask.BUTTON)
|
||||||
|
|
||||||
|
def press(self, button, state):
|
||||||
|
draw = wasp.watch.drawable
|
||||||
|
draw.string('Button', 0, 108, width=240)
|
||||||
|
|
||||||
|
def swipe(self, event):
|
||||||
|
draw = wasp.watch.drawable
|
||||||
|
if event[0] == wasp.EventType.UP:
|
||||||
|
draw.string('Swipe up', 0, 108, width=240)
|
||||||
|
else:
|
||||||
|
draw.string('Swipe down', 0, 108, width=240)
|
||||||
|
|
||||||
|
def touch(self, event):
|
||||||
|
draw = wasp.watch.drawable
|
||||||
|
wasp.watch.drawable.string('({}, {})'.format(
|
||||||
|
event[1], event[2]), 0, 108, width=240)
|
||||||
|
|
||||||
|
def _draw(self):
|
||||||
|
"""Draw the display from scratch."""
|
||||||
|
draw = wasp.watch.drawable
|
||||||
|
draw.fill()
|
||||||
|
draw.string('Template', 0, 6, width=240)
|
|
@ -5,3 +5,9 @@ import time
|
||||||
def sleep_ms(ms):
|
def sleep_ms(ms):
|
||||||
time.sleep(ms / 1000)
|
time.sleep(ms / 1000)
|
||||||
time.sleep_ms = sleep_ms
|
time.sleep_ms = sleep_ms
|
||||||
|
|
||||||
|
class Pin():
|
||||||
|
def value(v=None):
|
||||||
|
pass
|
||||||
|
|
||||||
|
button = Pin()
|
||||||
|
|
Loading…
Reference in a new issue