diff --git a/wasp/apps/clock.py b/wasp/apps/clock.py index 5919ebf..106e712 100644 --- a/wasp/apps/clock.py +++ b/wasp/apps/clock.py @@ -31,16 +31,13 @@ class ClockApp(): NAME = 'Clock' ICON = icons.clock - def __init__(self): - self._bar = wasp.widgets.StatusBar() - def foreground(self): """Activate the application. Configure the status bar, redraw the display and request a periodic tick callback every second. """ - self._bar.clock = False + wasp.system.bar.clock = False self._draw(True) wasp.system.request_tick(1000) @@ -82,13 +79,13 @@ class ClockApp(): draw.rleblit(digits.clock_colon, pos=(2*48, 80), fg=0xb5b6) # Redraw the status bar - self._bar.draw() + wasp.system.bar.draw() else: # The update is doubly lazy... we update the status bar and if # the status bus update reports a change in the time of day # then we compare the minute on display to make sure we # only update the main clock once per minute. - now = self._bar.update() + now = wasp.system.bar.update() if not now or self._min == now[4]: # Skip the update return diff --git a/wasp/apps/fibonacci_clock.py b/wasp/apps/fibonacci_clock.py index 3f0ca95..3718cfc 100644 --- a/wasp/apps/fibonacci_clock.py +++ b/wasp/apps/fibonacci_clock.py @@ -61,12 +61,9 @@ class FibonacciClockApp(): NAME = 'Fibo' ICON = icon - def __init__(self): - self._bar = wasp.widgets.StatusBar() - def foreground(self): """Activate the application.""" - self._bar.clock = False + wasp.system.bar.clock = False self._draw(True) wasp.system.request_tick(1000) @@ -86,9 +83,9 @@ class FibonacciClockApp(): if redraw: now = wasp.watch.rtc.get_localtime() draw.fill() - self._bar.draw() + wasp.system.bar.draw() else: - now = self._bar.update() + now = wasp.system.bar.update() if not now or self._min == now[4]: return diff --git a/wasp/apps/steps.py b/wasp/apps/steps.py index d7f16a3..cd888bd 100644 --- a/wasp/apps/steps.py +++ b/wasp/apps/steps.py @@ -42,12 +42,12 @@ class StepCounterApp(): def __init__(self): watch.accel.reset() - self._bar = wasp.widgets.StatusBar() self._count = 0 self._prev_day = -1 def foreground(self): """Activate the application.""" + wasp.system.bar.clock = True self._draw() wasp.system.request_tick(1000) @@ -62,13 +62,13 @@ class StepCounterApp(): draw.blit(feet, 12, 132-24) self._update() - self._bar.draw() + wasp.system.bar.draw() def _update(self): draw = wasp.watch.drawable # Update the status bar - now = self._bar.update() + now = wasp.system.bar.update() # Reset the step counter if we have move onto the next day if now and now[2] != self._prev_day: diff --git a/wasp/apps/stopwatch.py b/wasp/apps/stopwatch.py index 807830c..43166a6 100644 --- a/wasp/apps/stopwatch.py +++ b/wasp/apps/stopwatch.py @@ -17,12 +17,12 @@ class StopwatchApp(): ICON = icons.app def __init__(self): - self._bar = wasp.widgets.StatusBar() self._reset() self._count = 0 def foreground(self): """Activate the application.""" + wasp.system.bar.clock = True self._draw() wasp.system.request_tick(97) wasp.system.request_event(wasp.EventMask.TOUCH | @@ -111,7 +111,7 @@ class StopwatchApp(): self._last_count = -1 self._update() - self._bar.draw() + wasp.system.bar.draw() self._draw_splits() def _update(self): @@ -125,7 +125,7 @@ class StopwatchApp(): self._reset() # Update the statusbar - self._bar.update() + wasp.system.bar.update() if self._last_count != self._count: centisecs = self._count diff --git a/wasp/wasp.py b/wasp/wasp.py index 8f7e8a8..e2e728a 100644 --- a/wasp/wasp.py +++ b/wasp/wasp.py @@ -100,6 +100,8 @@ class Manager(): def __init__(self): self.app = None + self.bar = widgets.StatusBar() + self.quick_ring = [] self.launcher = LauncherApp() self.launcher_ring = []