wasp: Manager: Bring in proper separation of apps

This is getting us much closer to the final UI concept. We have a
quick ring from which we can select typical apps such as clock and
stopwatch which will (eventually) be supplemented with step counting
and heart rate monitoriing. More exotic apps (currenrtly torch, self
test, settings) are all relagated to the launcher ring.
This commit is contained in:
Daniel Thompson 2020-04-14 20:05:57 +01:00
parent 10706a9704
commit 66743d42c8
2 changed files with 10 additions and 6 deletions

View file

@ -29,7 +29,7 @@ class LauncherApp():
else:
i -= 1
if i < 0:
wasp.system.switch(wasp.system.applications[0])
wasp.system.switch(wasp.system.quick_ring[0])
return
self._page = i
@ -50,11 +50,11 @@ class LauncherApp():
@property
def _num_pages(self):
"""Work out what the highest possible pages it."""
num_apps = len(wasp.system.applications)
num_apps = len(wasp.system.launcher_ring)
return (num_apps + 3) // 4
def _get_page(self, i):
apps = wasp.system.applications
apps = wasp.system.launcher_ring
page = apps[4*i: 4*(i+1)]
while len(page) < 4:
page.append(None)

View file

@ -100,12 +100,16 @@ class Manager():
self.register(SettingsApp(), False)
self.register(TestApp(), False)
def register(self, app, quick_ring=True):
def register(self, app, quick_ring=False):
"""Register an application with the system.
:param object app: The application to regsister
"""
self.quick_ring.append(app)
if quick_ring == True:
self.quick_ring.append(app)
else:
self.launcher_ring.append(app)
self.launcher_ring.sort(key = lambda x: x.NAME)
@property
def brightness(self):
@ -296,7 +300,7 @@ class Manager():
watch.rtc.update()
if 1 == self._button.get_event() or \
self._charging != watch.battery.changing():
self._charging != watch.battery.charging():
self.wake()
def run(self, no_except=True):