manager: Enable Software by default
Enabling software by default allows us disable several other applications by default because there is now a GUI based route to enable them. This does require a few tweaks to the test suite and allows allows us to remove a lot of boilerplate text from the application library document since it is no longer relavent. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
231f3b6fdd
commit
3813eb2911
5 changed files with 42 additions and 63 deletions
|
@ -25,52 +25,18 @@ Watch faces
|
||||||
|
|
||||||
.. automodule:: apps.chrono
|
.. automodule:: apps.chrono
|
||||||
|
|
||||||
This application is very simple and largely serves as an example of how to
|
|
||||||
implement traditional watch faces.
|
|
||||||
It is not included by default in any image.
|
|
||||||
Instead it can be transferred to the device dynamically using wasptool:
|
|
||||||
|
|
||||||
.. code-block:: sh
|
|
||||||
|
|
||||||
./tools/wasptool --exec wasp/apps/chrono.py --eval 'wasp.system.register(ChronoApp())'
|
|
||||||
|
|
||||||
.. automodule:: apps.fibonacci_clock
|
.. automodule:: apps.fibonacci_clock
|
||||||
|
|
||||||
This app is enabled by default in the simulator.
|
|
||||||
The app is also frozen into the firmware image but it is disabled by
|
|
||||||
default in order to keep RAM available for user developed applications.
|
|
||||||
It can be enabled by modifying ``main.py``.
|
|
||||||
|
|
||||||
Games
|
Games
|
||||||
-----
|
-----
|
||||||
|
|
||||||
.. automodule:: apps.gameoflife
|
.. automodule:: apps.gameoflife
|
||||||
|
|
||||||
This app is enabled by default in the simulator.
|
|
||||||
The app is also frozen into the firmware image but it is disabled by
|
|
||||||
default in order to keep RAM available for user developed applications.
|
|
||||||
It can be enabled by modifying ``main.py``.
|
|
||||||
|
|
||||||
.. automodule:: apps.snake
|
.. automodule:: apps.snake
|
||||||
|
|
||||||
This app is enabled by default in the simulator.
|
|
||||||
The app is also frozen into the firmware image but it is disabled by
|
|
||||||
default in order to keep RAM available for user developed applications.
|
|
||||||
It can be enabled by modifying ``main.py``.
|
|
||||||
|
|
||||||
Integration
|
Integration
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
.. automodule:: apps.alarm
|
.. automodule:: apps.alarm
|
||||||
|
|
||||||
This app is enabled by default in the simulator.
|
|
||||||
The app is also frozen into the firmware image but it is disabled by
|
|
||||||
default in order to keep RAM available for user developed applications.
|
|
||||||
It can be enabled by modifying ``main.py``.
|
|
||||||
|
|
||||||
.. automodule:: apps.musicplayer
|
.. automodule:: apps.musicplayer
|
||||||
|
|
||||||
This app is enabled by default in the simulator.
|
|
||||||
The app is also frozen into the firmware image but it is disabled by
|
|
||||||
default in order to keep RAM available for user developed applications.
|
|
||||||
It can be enabled by modifying ``main.py``.
|
|
||||||
|
|
|
@ -4,19 +4,21 @@
|
||||||
|
|
||||||
manifest = (
|
manifest = (
|
||||||
'apps/alarm.py',
|
'apps/alarm.py',
|
||||||
|
'apps/calc.py',
|
||||||
'apps/clock.py',
|
'apps/clock.py',
|
||||||
|
'apps/chrono.py',
|
||||||
|
'apps/fibonacci_clock.py',
|
||||||
'apps/flashlight.py',
|
'apps/flashlight.py',
|
||||||
'apps/gameoflife.py',
|
'apps/gameoflife.py',
|
||||||
'apps/haiku.py',
|
'apps/haiku.py',
|
||||||
'apps/heart.py',
|
'apps/heart.py',
|
||||||
'apps/musicplayer.py',
|
'apps/musicplayer.py',
|
||||||
'apps/calc.py',
|
|
||||||
'apps/launcher.py',
|
'apps/launcher.py',
|
||||||
'apps/pager.py',
|
'apps/pager.py',
|
||||||
'apps/settings.py',
|
'apps/settings.py',
|
||||||
|
'apps/software.py',
|
||||||
'apps/steps.py',
|
'apps/steps.py',
|
||||||
'apps/stopwatch.py',
|
'apps/stopwatch.py',
|
||||||
'apps/fibonacci_clock.py',
|
|
||||||
'apps/snake.py',
|
'apps/snake.py',
|
||||||
'apps/testapp.py',
|
'apps/testapp.py',
|
||||||
'fonts/__init__.py',
|
'fonts/__init__.py',
|
||||||
|
|
|
@ -3,26 +3,33 @@
|
||||||
|
|
||||||
import wasp
|
import wasp
|
||||||
|
|
||||||
from apps.alarm import AlarmApp
|
# Ensure there's something interesting to look at ;-)
|
||||||
wasp.system.register(AlarmApp())
|
|
||||||
|
|
||||||
from apps.fibonacci_clock import FibonacciClockApp
|
|
||||||
wasp.system.register(FibonacciClockApp())
|
|
||||||
|
|
||||||
from apps.gameoflife import GameOfLifeApp
|
|
||||||
wasp.system.register(GameOfLifeApp())
|
|
||||||
|
|
||||||
from apps.snake import SnakeGameApp
|
|
||||||
wasp.system.register(SnakeGameApp())
|
|
||||||
|
|
||||||
from apps.calc import CalculatorApp
|
|
||||||
wasp.system.register(CalculatorApp())
|
|
||||||
|
|
||||||
from apps.musicplayer import MusicPlayerApp
|
|
||||||
wasp.system.register(MusicPlayerApp())
|
|
||||||
wasp.system.set_music_info({
|
wasp.system.set_music_info({
|
||||||
'track': 'Tasteless Brass Duck',
|
'track': 'Tasteless Brass Duck',
|
||||||
'artist': 'Dreams of Bamboo',
|
'artist': 'Dreams of Bamboo',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# Instantiate the analogue clock application and replace the default
|
||||||
|
# (digital) clock with this alternative.
|
||||||
|
#from chrono import ChronoApp
|
||||||
|
#clock = wasp.system.quick_ring[0]
|
||||||
|
#wasp.system.quick_ring[0] = ChronoApp()
|
||||||
|
#wasp.system.switch(wasp.system.quick_ring[0])
|
||||||
|
#wasp.system.register(clock)
|
||||||
|
|
||||||
|
# Adopt a basic all-orange theme
|
||||||
|
#wasp.system.set_theme(
|
||||||
|
# b'\xff\x00' # ble
|
||||||
|
# b'\xff\x00' # scroll-indicator
|
||||||
|
# b'\xff\x00' # battery
|
||||||
|
# b'\xff\x00' # status-clock
|
||||||
|
# b'\xff\x00' # notify-icon
|
||||||
|
# b'\xff\x00' # bright
|
||||||
|
# b'\xbe\xe0' # mid
|
||||||
|
# b'\xff\x00' # ui
|
||||||
|
# b'\xff\x00' # spot1
|
||||||
|
# b'\xff\x00' # spot2
|
||||||
|
# b'\x00\x0f' # contrast
|
||||||
|
# )
|
||||||
|
|
||||||
wasp.system.run()
|
wasp.system.run()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import pytest
|
import pytest
|
||||||
import time
|
import time
|
||||||
import wasp
|
import wasp
|
||||||
|
import apps.testapp
|
||||||
|
|
||||||
def step():
|
def step():
|
||||||
wasp.system._tick()
|
wasp.system._tick()
|
||||||
|
@ -36,12 +37,11 @@ def test_quick_ring(system):
|
||||||
|
|
||||||
def test_launcher_ring(system):
|
def test_launcher_ring(system):
|
||||||
names = [ x.NAME for x in system.launcher_ring ]
|
names = [ x.NAME for x in system.launcher_ring ]
|
||||||
assert('Self Test' in names)
|
|
||||||
assert('Settings' in names)
|
assert('Settings' in names)
|
||||||
assert('Torch' in names)
|
assert('Software' in names)
|
||||||
|
|
||||||
@pytest.mark.parametrize("name",
|
@pytest.mark.parametrize("name",
|
||||||
('Steps', 'Timer', 'Heart', 'Self Test', 'Settings', 'Torch'))
|
('Steps', 'Timer', 'Heart', 'Settings', 'Software'))
|
||||||
def test_app(system, name):
|
def test_app(system, name):
|
||||||
system.switch(system.apps[name])
|
system.switch(system.apps[name])
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
|
@ -101,7 +101,7 @@ def test_selftests(system):
|
||||||
will do something useful! For example it will run the benchmark for every
|
will do something useful! For example it will run the benchmark for every
|
||||||
one of the benchmark tests.
|
one of the benchmark tests.
|
||||||
"""
|
"""
|
||||||
system.switch(system.apps['Self Test'])
|
system.switch(apps.testapp.TestApp())
|
||||||
system.step()
|
system.step()
|
||||||
|
|
||||||
start_point = system.app.test
|
start_point = system.app.test
|
||||||
|
@ -115,7 +115,7 @@ def test_selftests(system):
|
||||||
assert(start_point == system.app.test)
|
assert(start_point == system.app.test)
|
||||||
|
|
||||||
def test_selftest_crash(system):
|
def test_selftest_crash(system):
|
||||||
system.switch(system.apps['Self Test'])
|
system.switch(apps.testapp.TestApp())
|
||||||
system.step()
|
system.step()
|
||||||
|
|
||||||
def select(name):
|
def select(name):
|
||||||
|
|
14
wasp/wasp.py
14
wasp/wasp.py
|
@ -21,14 +21,13 @@ import watch
|
||||||
import widgets
|
import widgets
|
||||||
|
|
||||||
from apps.clock import ClockApp
|
from apps.clock import ClockApp
|
||||||
from apps.flashlight import FlashlightApp
|
|
||||||
from apps.heart import HeartApp
|
from apps.heart import HeartApp
|
||||||
from apps.launcher import LauncherApp
|
from apps.launcher import LauncherApp
|
||||||
from apps.pager import PagerApp, CrashApp, NotificationApp
|
from apps.pager import PagerApp, CrashApp, NotificationApp
|
||||||
from apps.settings import SettingsApp
|
from apps.settings import SettingsApp
|
||||||
from apps.steps import StepCounterApp
|
from apps.steps import StepCounterApp
|
||||||
|
from apps.software import SoftwareApp
|
||||||
from apps.stopwatch import StopwatchApp
|
from apps.stopwatch import StopwatchApp
|
||||||
from apps.testapp import TestApp
|
|
||||||
|
|
||||||
class EventType():
|
class EventType():
|
||||||
"""Enumerated interface actions.
|
"""Enumerated interface actions.
|
||||||
|
@ -151,9 +150,8 @@ class Manager():
|
||||||
(StepCounterApp, True),
|
(StepCounterApp, True),
|
||||||
(StopwatchApp, True),
|
(StopwatchApp, True),
|
||||||
(HeartApp, True),
|
(HeartApp, True),
|
||||||
(FlashlightApp, False),
|
(SoftwareApp, False),
|
||||||
(SettingsApp, False),
|
(SettingsApp, False) ):
|
||||||
(TestApp, False) ):
|
|
||||||
try:
|
try:
|
||||||
self.register(app(), qr)
|
self.register(app(), qr)
|
||||||
except:
|
except:
|
||||||
|
@ -172,6 +170,12 @@ class Manager():
|
||||||
self.launcher_ring.append(app)
|
self.launcher_ring.append(app)
|
||||||
self.launcher_ring.sort(key = _key_app)
|
self.launcher_ring.sort(key = _key_app)
|
||||||
|
|
||||||
|
def unregister(self, cls):
|
||||||
|
for app in self.launcher_ring:
|
||||||
|
if instanceof(app, cls):
|
||||||
|
self.launcher_ring.remove(app)
|
||||||
|
break
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def brightness(self):
|
def brightness(self):
|
||||||
"""Cached copy of the brightness current written to the hardware."""
|
"""Cached copy of the brightness current written to the hardware."""
|
||||||
|
|
Loading…
Reference in a new issue