From 4468285c343d7f4044748c6232f3e7510def9dce Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Sun, 13 Dec 2020 16:46:19 +0000 Subject: [PATCH] widgets: BatteryMeter: Fix theme handling Add the battery frame to the theme so it matches the frame used for charging and rename accordingly. Signed-off-by: Daniel Thompson --- tools/test_theme.py | 2 +- tools/themer.py | 4 ++-- wasp/wasp.py | 2 +- wasp/widgets.py | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/test_theme.py b/tools/test_theme.py index dc2b990..2c161ff 100644 --- a/tools/test_theme.py +++ b/tools/test_theme.py @@ -6,7 +6,7 @@ class Theme(DefaultTheme): # The default theme was generated by removing all the lines below and adding `pass` instead. BLE_COLOR = 0xfb80 SCROLL_INDICATOR_COLOR = 0xf800 - BATTERY_CHARGING_COLOR = 0x07ff + BATTERY_COLOR = 0x07ff SMALL_CLOCK_COLOR = 0x599f NOTIFICATION_COLOR = 0x8fe0 ACCENT_MID = 0xf800 diff --git a/tools/themer.py b/tools/themer.py index 819c35c..f0f1f35 100755 --- a/tools/themer.py +++ b/tools/themer.py @@ -14,7 +14,7 @@ class DefaultTheme(): """ BLE_COLOR = 0x7bef SCROLL_INDICATOR_COLOR = 0x7bef - BATTERY_CHARGING_COLOR = 0x7bef + BATTERY_COLOR = 0x7bef SMALL_CLOCK_COLOR = 0xe73c NOTIFICATION_COLOR = 0x7bef ACCENT_MID = 0xb5b6 @@ -29,7 +29,7 @@ class DefaultTheme(): theme_bytes = bytes([ *split_bytes(self.BLE_COLOR), *split_bytes(self.SCROLL_INDICATOR_COLOR), - *split_bytes(self.BATTERY_CHARGING_COLOR), + *split_bytes(self.BATTERY_COLOR), *split_bytes(self.SMALL_CLOCK_COLOR), *split_bytes(self.NOTIFICATION_COLOR), *split_bytes(self.ACCENT_MID), diff --git a/wasp/wasp.py b/wasp/wasp.py index 4837e12..2422cfd 100644 --- a/wasp/wasp.py +++ b/wasp/wasp.py @@ -529,7 +529,7 @@ class Manager(): """Returns the relevant part of theme. For more see ../tools/themer.py""" theme_parts = ("ble", "scroll-indicator", - "battery-charging", + "battery", "status-clock", "notify-icon", "accent-mid", diff --git a/wasp/widgets.py b/wasp/widgets.py index 1d79e22..d39de90 100644 --- a/wasp/widgets.py +++ b/wasp/widgets.py @@ -40,7 +40,7 @@ class BatteryMeter: if watch.battery.charging(): if self.level != -1: draw.rleblit(icon, pos=(239-icon[0], 0), - fg=wasp.system.theme('battery-charging')) + fg=wasp.system.theme('battery')) self.level = -1 else: level = watch.battery.level() @@ -59,7 +59,8 @@ class BatteryMeter: if self.level < 0 or ((level > 5) ^ (self.level > 5)): if level > 5: - draw.rleblit(icon, pos=(239-icon[0], 0), fg=0x7bef) + draw.rleblit(icon, pos=(239-icon[0], 0), + fg=wasp.system.theme('battery')) else: rgb = 0xf800 draw.rleblit(icon, pos=(239-icon[0], 0), fg=0xf800)