docs: Add some main.py examples
These still need to be integrated into the generated documentation but there were included in the most recent wasp-os video so let's get them into the source code. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
1670be2672
commit
4e9a576a2d
3 changed files with 50 additions and 0 deletions
13
docs/main/apps.py
Normal file
13
docs/main/apps.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
# Copyright (C) 2020 Daniel Thompson
|
||||||
|
|
||||||
|
import wasp
|
||||||
|
|
||||||
|
from gadgetbridge import *
|
||||||
|
wasp.system.schedule()
|
||||||
|
|
||||||
|
# Registering normal apps *after* the schedule() ensures the
|
||||||
|
# watch will still (partially) boot even if we end up taking
|
||||||
|
# an exception during application init.
|
||||||
|
wasp.system.register('apps.flashlight.TorchApp')
|
||||||
|
wasp.system.register('apps.gameoflife.GameOfLifeApp')
|
15
docs/main/chrono.py
Normal file
15
docs/main/chrono.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
# Copyright (C) 2020 Daniel Thompson
|
||||||
|
|
||||||
|
import wasp
|
||||||
|
|
||||||
|
# Instantiate the analogue clock application and replace the default
|
||||||
|
# (digital) clock with this alternative.
|
||||||
|
from apps.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)
|
||||||
|
|
||||||
|
from gadgetbridge import *
|
||||||
|
wasp.system.schedule()
|
22
docs/main/theme.py
Normal file
22
docs/main/theme.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
# Copyright (C) 2020 Daniel Thompson
|
||||||
|
|
||||||
|
import wasp
|
||||||
|
|
||||||
|
# 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
|
||||||
|
)
|
||||||
|
|
||||||
|
from gadgetbridge import *
|
||||||
|
wasp.system.schedule()
|
Loading…
Add table
Reference in a new issue