Tiny improvements

This commit is contained in:
Admar Schoonen 2022-12-17 20:50:47 +01:00
parent ab306e618c
commit ccf5cd2951
1 changed files with 7 additions and 8 deletions

View File

@ -128,24 +128,23 @@ class MyClockWidget(FloatLayout):
if self.set_alarm_mode or self.alarm_activated:
source = 'alarm_on.png'
r = 0.9
g = 0.0
b = 0.0
rgb = [0.9, 0.0, 0.0]
else:
source = 'alarm_off.png'
r = 1.0
g = 1.0
b = 1.0
rgb = [1.0, 1.0, 1.0]
set_alarm_button = self.ids["set_alarm_button"]
set_alarm_button.canvas.clear()
with set_alarm_button.canvas:
Color(r, g, b)
Color(rgb[0], rgb[1], rgb[2])
Rectangle(size=set_alarm_button.size, pos=set_alarm_button.pos, source=source)
def sun_rise(self):
# to do: calculate brightness and color according to sun rise instead of linear increment
intensity = round((1.0 - self.seconds_to_next_alarm / (30.0 * 60.0)) * 256.0)
intensity = math.floor((1.0 - self.seconds_to_next_alarm / (1.0 * 60.0)) * 256.0)
if intensity < 0:
intensity = 0
led_color = [0, 0, 0]
for i in range(3):
led_color[i] = intensity