From 0d3776a5c399be8ddb054b2c67fda0b6772abf0b Mon Sep 17 00:00:00 2001 From: admar Date: Sun, 16 Apr 2023 17:32:26 +0200 Subject: [PATCH] Make dict of wake up sounds a separate file --- clock.kv | 1 - clock.py | 17 ++++++++--------- sounds.py | 6 ++++++ {icons/dark => themes/Dark}/alarm_off.png | Bin {icons/dark => themes/Dark}/alarm_on.png | Bin {icons/dark => themes/Dark}/light_off.png | Bin {icons/dark => themes/Dark}/light_on.png | Bin {icons/dark => themes/Dark}/light_reading.png | Bin {icons/dark => themes/Dark}/light_sunrise.png | Bin {icons/dark => themes/Dark}/media_playing.png | Bin {icons/dark => themes/Dark}/media_stopped.png | Bin .../Dark}/settings_not_visible.png | Bin .../dark => themes/Dark}/settings_visible.png | Bin {icons/light => themes/Light}/alarm_off.png | Bin {icons/light => themes/Light}/alarm_on.png | Bin {icons/light => themes/Light}/light_off.png | Bin {icons/light => themes/Light}/light_on.png | Bin .../light => themes/Light}/light_reading.png | Bin .../light => themes/Light}/light_sunrise.png | Bin .../light => themes/Light}/media_playing.png | Bin .../light => themes/Light}/media_stopped.png | Bin .../Light}/settings_not_visible.png | Bin .../Light}/settings_visible.png | Bin 23 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 sounds.py rename {icons/dark => themes/Dark}/alarm_off.png (100%) rename {icons/dark => themes/Dark}/alarm_on.png (100%) rename {icons/dark => themes/Dark}/light_off.png (100%) rename {icons/dark => themes/Dark}/light_on.png (100%) rename {icons/dark => themes/Dark}/light_reading.png (100%) rename {icons/dark => themes/Dark}/light_sunrise.png (100%) rename {icons/dark => themes/Dark}/media_playing.png (100%) rename {icons/dark => themes/Dark}/media_stopped.png (100%) rename {icons/dark => themes/Dark}/settings_not_visible.png (100%) rename {icons/dark => themes/Dark}/settings_visible.png (100%) rename {icons/light => themes/Light}/alarm_off.png (100%) rename {icons/light => themes/Light}/alarm_on.png (100%) rename {icons/light => themes/Light}/light_off.png (100%) rename {icons/light => themes/Light}/light_on.png (100%) rename {icons/light => themes/Light}/light_reading.png (100%) rename {icons/light => themes/Light}/light_sunrise.png (100%) rename {icons/light => themes/Light}/media_playing.png (100%) rename {icons/light => themes/Light}/media_stopped.png (100%) rename {icons/light => themes/Light}/settings_not_visible.png (100%) rename {icons/light => themes/Light}/settings_visible.png (100%) diff --git a/clock.kv b/clock.kv index a2fc115..6a6c85d 100644 --- a/clock.kv +++ b/clock.kv @@ -117,7 +117,6 @@ id: settings_menu_wake_up_sound_select_button on_press: root.settings_menu_wake_up_sound_select_button_cb() font_size: root.height*0.05 - text: str(app.alarm_settings.sound_selected) color: root.theme.color_font background_normal: '' background_color: root.theme.color_button diff --git a/clock.py b/clock.py index d970902..6cf4f29 100644 --- a/clock.py +++ b/clock.py @@ -9,6 +9,7 @@ import os from kivy.config import Config from kivy.properties import ObjectProperty import time +from sounds import WakeUpSounds def is_arm(): if (os.uname()[4][:3] == 'arm') or (os.uname()[4][:7] == 'aarch64'): @@ -131,10 +132,6 @@ class AlarmSettings(): alarm_modified = False - # sound_selected = "NPO Radio 1" - # sound_source = "https://icecast.omroep.nl/radio1-bb-mp3" - sound_selected = "Birds" - sound_source = "Woodpecker Chirps - QuickSounds.com.mp3" seconds_to_sunrise = 30 * 60 # 30 minutes volume = 15 @@ -1175,10 +1172,11 @@ class MyApp(App): cols=2, ) - clock_widget.wake_up_sounds = { - "Birds": "Woodpecker Chirps - QuickSounds.com.mp3", - "NPO Radio 1": "https://icecast.omroep.nl/radio1-bb-mp3" - } + clock_widget.wake_up_sounds = WakeUpSounds + + self.alarm_settings.sound_selected = next(iter(clock_widget.wake_up_sounds)) + self.alarm_settings.sound_source = clock_widget.wake_up_sounds[self.alarm_settings.sound_selected] + clock_widget.ids["settings_menu_wake_up_sound_select_button"].text = self.alarm_settings.sound_selected clock_widget.wake_up_sound_checkboxes = [] clock_widget.wake_up_sound_labels = [] @@ -1187,6 +1185,7 @@ class MyApp(App): for w in clock_widget.wake_up_sounds: c = CheckBox( group = "settings_menu_wake_up_sound", + size = [gl.size[0] * 0.1, gl.size[1]], ) c.bind(active=clock_widget.settings_menu_wake_up_sound_cb) gl.add_widget(c) @@ -1201,7 +1200,7 @@ class MyApp(App): text = w, halign = "left", valign = "middle", - size = [c.size[0] * 2.88, c.size[1]], + size = [gl.size[0] * 2.5, c.size[1]], text_size = Window.size, font_size = Window.height*0.05, color = clock_widget.theme.color_font, diff --git a/sounds.py b/sounds.py new file mode 100644 index 0000000..4036ab3 --- /dev/null +++ b/sounds.py @@ -0,0 +1,6 @@ +WakeUpSounds = { + "Birds": "Woodpecker Chirps - QuickSounds.com.mp3", + "NPO Radio 1": "https://icecast.omroep.nl/radio1-bb-mp3", + "QMusic Non Stop": "https://icecast-qmusicnl-cdp.triple-it.nl/Qmusic_nl_nonstop_high.aac?aw_0_1st.playerId=redirect", +} + diff --git a/icons/dark/alarm_off.png b/themes/Dark/alarm_off.png similarity index 100% rename from icons/dark/alarm_off.png rename to themes/Dark/alarm_off.png diff --git a/icons/dark/alarm_on.png b/themes/Dark/alarm_on.png similarity index 100% rename from icons/dark/alarm_on.png rename to themes/Dark/alarm_on.png diff --git a/icons/dark/light_off.png b/themes/Dark/light_off.png similarity index 100% rename from icons/dark/light_off.png rename to themes/Dark/light_off.png diff --git a/icons/dark/light_on.png b/themes/Dark/light_on.png similarity index 100% rename from icons/dark/light_on.png rename to themes/Dark/light_on.png diff --git a/icons/dark/light_reading.png b/themes/Dark/light_reading.png similarity index 100% rename from icons/dark/light_reading.png rename to themes/Dark/light_reading.png diff --git a/icons/dark/light_sunrise.png b/themes/Dark/light_sunrise.png similarity index 100% rename from icons/dark/light_sunrise.png rename to themes/Dark/light_sunrise.png diff --git a/icons/dark/media_playing.png b/themes/Dark/media_playing.png similarity index 100% rename from icons/dark/media_playing.png rename to themes/Dark/media_playing.png diff --git a/icons/dark/media_stopped.png b/themes/Dark/media_stopped.png similarity index 100% rename from icons/dark/media_stopped.png rename to themes/Dark/media_stopped.png diff --git a/icons/dark/settings_not_visible.png b/themes/Dark/settings_not_visible.png similarity index 100% rename from icons/dark/settings_not_visible.png rename to themes/Dark/settings_not_visible.png diff --git a/icons/dark/settings_visible.png b/themes/Dark/settings_visible.png similarity index 100% rename from icons/dark/settings_visible.png rename to themes/Dark/settings_visible.png diff --git a/icons/light/alarm_off.png b/themes/Light/alarm_off.png similarity index 100% rename from icons/light/alarm_off.png rename to themes/Light/alarm_off.png diff --git a/icons/light/alarm_on.png b/themes/Light/alarm_on.png similarity index 100% rename from icons/light/alarm_on.png rename to themes/Light/alarm_on.png diff --git a/icons/light/light_off.png b/themes/Light/light_off.png similarity index 100% rename from icons/light/light_off.png rename to themes/Light/light_off.png diff --git a/icons/light/light_on.png b/themes/Light/light_on.png similarity index 100% rename from icons/light/light_on.png rename to themes/Light/light_on.png diff --git a/icons/light/light_reading.png b/themes/Light/light_reading.png similarity index 100% rename from icons/light/light_reading.png rename to themes/Light/light_reading.png diff --git a/icons/light/light_sunrise.png b/themes/Light/light_sunrise.png similarity index 100% rename from icons/light/light_sunrise.png rename to themes/Light/light_sunrise.png diff --git a/icons/light/media_playing.png b/themes/Light/media_playing.png similarity index 100% rename from icons/light/media_playing.png rename to themes/Light/media_playing.png diff --git a/icons/light/media_stopped.png b/themes/Light/media_stopped.png similarity index 100% rename from icons/light/media_stopped.png rename to themes/Light/media_stopped.png diff --git a/icons/light/settings_not_visible.png b/themes/Light/settings_not_visible.png similarity index 100% rename from icons/light/settings_not_visible.png rename to themes/Light/settings_not_visible.png diff --git a/icons/light/settings_visible.png b/themes/Light/settings_visible.png similarity index 100% rename from icons/light/settings_visible.png rename to themes/Light/settings_visible.png