More work on support for light button

This commit is contained in:
Admar Schoonen 2023-04-10 00:47:04 +02:00
parent b05ccf3ed1
commit 5bfe72e039
3 changed files with 18 additions and 6 deletions

View File

@ -405,8 +405,18 @@ class MyClockWidget(FloatLayout):
)
def update_light_button(self):
source = 'light_off.png'
rgb = [1.0, 1.0, 1.0]
if (self.light_state == "off"):
source = 'light_off.png'
rgb = [1.0, 1.0, 1.0]
elif (self.light_state == "reading"):
source = 'light_reading.png'
rgb = [1.0, 1.0, 1.0]
elif (self.light_state == "sunrise"):
source = 'light_sunrise.png'
rgb = [1.0, 1.0, 1.0]
elif (self.light_state == "on"):
source = 'light_on.png'
rgb = [1.0, 1.0, 1.0]
light_button = self.ids["light_button"]
self.draw_list_curr_frame.append(["canvas.clear()", light_button])
@ -419,7 +429,7 @@ class MyClockWidget(FloatLayout):
if alarm_settings.alarm_playing:
source = 'playing.png'
rgb = [0.9, 0.9, 0.9]
rgb = [1.0, 1.0, 1.0]
else:
source = 'stopped.png'
rgb = [1.0, 1.0, 1.0]
@ -435,7 +445,7 @@ class MyClockWidget(FloatLayout):
if (self.view == "set_alarm") or alarm_settings.alarm_activated:
source = 'alarm_on.png'
rgb = [0.9, 0.9, 0.9]
rgb = [1.0, 1.0, 1.0]
else:
source = 'alarm_off.png'
rgb = [1.0, 1.0, 1.0]
@ -452,7 +462,7 @@ class MyClockWidget(FloatLayout):
if (self.view.startswith("settings_menu")):
source = 'settings_visible.png'
rgb = [0.9, 0.9, 0.9]
rgb = [1.0, 1.0, 1.0]
else:
source = 'settings_not_visible.png'
rgb = [1.0, 1.0, 1.0]
@ -495,7 +505,7 @@ class MyClockWidget(FloatLayout):
alarm_settings = App.get_running_app().alarm_settings
if self.view == "set_alarm":
# do not simulate sunrise when adjusting alarm time
# Do not simulate sunrise when adjusting alarm time
return
if self.seconds_to_next_alarm < 0.1:
@ -721,6 +731,8 @@ class MyClockWidget(FloatLayout):
alarm_settings = App.get_running_app().alarm_settings
alarm_settings.reading_light_brightness = int(args[1])
if (self.light_state == "reading") or (self.light_state == "sunrise"):
self.intensity = alarm_settings.reading_light_brightness / 20.0
print("Reading light brightness changed to " + str(alarm_settings.reading_light_brightness))
def display_brightness_slider_value(self, *args):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

BIN
light_reading.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB