From 66743d42c83ac0943f628fe2e6ab6852ba9b3f4f Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Tue, 14 Apr 2020 20:05:57 +0100 Subject: [PATCH] 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. --- wasp/apps/launcher.py | 6 +++--- wasp/wasp.py | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/wasp/apps/launcher.py b/wasp/apps/launcher.py index 4e76ab1..071a90c 100644 --- a/wasp/apps/launcher.py +++ b/wasp/apps/launcher.py @@ -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) diff --git a/wasp/wasp.py b/wasp/wasp.py index 0f6327d..12a9536 100644 --- a/wasp/wasp.py +++ b/wasp/wasp.py @@ -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):