From d433ab579d3c9f767362a7b70552b501f5edfe07 Mon Sep 17 00:00:00 2001 From: tobias Date: Fri, 25 Aug 2023 19:55:39 +0200 Subject: [PATCH] Display period times in Image Configurator, Changelog --- CHANGELOG | 6 + .../5.4/extension.js | 21 +++ .../image-configurator.glade | 144 +++++++++++++++--- .../5.4/image-configurator/windowHandler.py | 37 ++++- .../5.4/settings-schema.json | 46 ++++++ 5 files changed, 232 insertions(+), 22 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2218fa4..01b2236 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +# Version 1.4 +- Log System +- Bugfixes +- Display times in Image Configurator +- Display time of last location update in Preferences + # Version 1.3 - Adding option to stretch the image over multiple displays diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js b/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js index fbf443c..66cac84 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js @@ -93,6 +93,16 @@ CinnamonDynamicWallpaperExtension.prototype = { this.bindSettings("etr_img_night_twilight", "img_night_twilight", this.settingsUpdated) this.bindSettings("etr_img_night", "img_night", this.settingsUpdated) + this.bindSettings("etr_morning_twilight_times", "img_morning_twilight_times") + this.bindSettings("etr_sunrise_times", "img_sunrise_times") + this.bindSettings("etr_morning_times", "img_morning_times") + this.bindSettings("etr_noon_times", "img_noon_times") + this.bindSettings("etr_afternoon_times", "img_afternoon_times") + this.bindSettings("etr_evening_times", "img_evening_times") + this.bindSettings("etr_sunset_times", "img_sunset_times") + this.bindSettings("etr_night_twilight_times", "img_night_twilight_times") + this.bindSettings("etr_night_times", "img_night_times") + // Check for the first startup if (this.settings.getValue("first_start")) { @@ -273,6 +283,17 @@ CinnamonDynamicWallpaperExtension.prototype = { return time.getHours().toString().padStart(2, "0") + ":" + time.getMinutes().toString().padStart(2, "0") } + + this.img_morning_twilight_times = convertToTimeString(timesArray[0][0]) + " - " + convertToTimeString(timesArray[0][1]) + this.img_sunrise_times = convertToTimeString(timesArray[1][0]) + " - " + convertToTimeString(timesArray[1][1]) + this.img_morning_times = convertToTimeString(timesArray[2][0]) + " - " + convertToTimeString(timesArray[2][1]) + this.img_noon_times = convertToTimeString(timesArray[3][0]) + " - " + convertToTimeString(timesArray[3][1]) + this.img_afternoon_times = convertToTimeString(timesArray[4][0]) + " - " + convertToTimeString(timesArray[4][1]) + this.img_evening_times = convertToTimeString(timesArray[5][0]) + " - " + convertToTimeString(timesArray[5][1]) + this.img_sunset_times = convertToTimeString(timesArray[6][0]) + " - " + convertToTimeString(timesArray[6][1]) + this.img_night_twilight_times = convertToTimeString(timesArray[7][0]) + " - " + convertToTimeString(timesArray[7][1]) + this.img_night_times = convertToTimeString(timesArray[8][0]) + " - " + convertToTimeString(timesArray[8][1]) + this.tvTimes = "Morning Twilight:\t\t" + convertToTimeString(timesArray[0][0]) + " - " + convertToTimeString(timesArray[0][1]) + "\nSunrise:\t\t\t\t" + convertToTimeString(timesArray[1][0]) + " - " + convertToTimeString(timesArray[1][1]) + diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/image-configurator/image-configurator.glade b/cinnamon-dynamic-wallpaper@TobiZog/5.4/image-configurator/image-configurator.glade index 35d9abb..a28b860 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/image-configurator/image-configurator.glade +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/image-configurator/image-configurator.glade @@ -250,6 +250,18 @@ False vertical 8 + + + True + False + label + + + False + True + 0 + + 300 @@ -263,7 +275,7 @@ False True - 0 + 1 @@ -275,7 +287,7 @@ False True - 1 + 2 @@ -317,6 +329,18 @@ False vertical 8 + + + True + False + label + + + False + True + 0 + + 300 @@ -329,7 +353,7 @@ False True - 0 + 1 @@ -340,7 +364,7 @@ False True - 1 + 2 @@ -382,6 +406,18 @@ False vertical 8 + + + True + False + label + + + False + True + 0 + + 300 @@ -394,7 +430,7 @@ False True - 0 + 1 @@ -406,7 +442,7 @@ False True - 1 + 2 @@ -448,6 +484,18 @@ False vertical 8 + + + True + False + label + + + False + True + 0 + + 300 @@ -460,7 +508,7 @@ False True - 0 + 1 @@ -471,7 +519,7 @@ False True - 1 + 2 @@ -513,6 +561,18 @@ False vertical 8 + + + True + False + label + + + False + True + 0 + + 300 @@ -525,7 +585,7 @@ False True - 0 + 1 @@ -537,7 +597,7 @@ False True - 1 + 2 @@ -579,6 +639,18 @@ False vertical 8 + + + True + False + label + + + False + True + 0 + + 300 @@ -591,7 +663,7 @@ False True - 0 + 1 @@ -603,7 +675,7 @@ False True - 1 + 2 @@ -645,6 +717,18 @@ False vertical 8 + + + True + False + label + + + False + True + 0 + + 300 @@ -657,7 +741,7 @@ False True - 0 + 1 @@ -669,7 +753,7 @@ False True - 1 + 2 @@ -711,6 +795,18 @@ False vertical 8 + + + True + False + label + + + False + True + 0 + + 300 @@ -723,7 +819,7 @@ False True - 0 + 1 @@ -735,7 +831,7 @@ False True - 1 + 2 @@ -777,6 +873,18 @@ False vertical 8 + + + True + False + label + + + False + True + 0 + + 300 @@ -789,7 +897,7 @@ False True - 0 + 1 @@ -801,7 +909,7 @@ False True - 1 + 2 diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/image-configurator/windowHandler.py b/cinnamon-dynamic-wallpaper@TobiZog/5.4/image-configurator/windowHandler.py index b1265d6..165265b 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/image-configurator/windowHandler.py +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/image-configurator/windowHandler.py @@ -21,7 +21,19 @@ class WindowHandler: ########### Class variables ########### self.pref_path = pref_path - self.pref_vars = [ + self.time_values = [ + "etr_morning_twilight_times", + "etr_sunrise_times", + "etr_morning_times", + "etr_noon_times", + "etr_afternoon_times", + "etr_evening_times", + "etr_sunset_times", + "etr_night_twilight_times", + "etr_night_times" + ] + + self.img_values = [ "etr_img_morning_twilight", "etr_img_sunrise", "etr_img_morning", @@ -70,6 +82,18 @@ class WindowHandler: self.lb_heic_file = self.builder.get_object("lb_heic_file") self.fc_heic_file = self.builder.get_object("fc_heic_file") + self.lb_times = [ + self.builder.get_object("lb_times_1"), + self.builder.get_object("lb_times_2"), + self.builder.get_object("lb_times_3"), + self.builder.get_object("lb_times_4"), + self.builder.get_object("lb_times_5"), + self.builder.get_object("lb_times_6"), + self.builder.get_object("lb_times_7"), + self.builder.get_object("lb_times_8"), + self.builder.get_object("lb_times_9") + ] + self.img_previews = [ self.builder.get_object("img_preview_1"), self.builder.get_object("img_preview_2"), @@ -148,7 +172,8 @@ class WindowHandler: self.cb_image_set.set_active(i) - for i, val in enumerate(self.pref_vars): + for i, val in enumerate(self.img_values): + # Bugfix: Load the images only, if there is choosen one if pref_data[val]['value'] != None: # Set the preview image self.changePreviewImage(i, IMAGE_SELECTED_DIR + pref_data[val]['value']) @@ -163,6 +188,10 @@ class WindowHandler: else: self.image_source = Source.SET + # Print the times of the day + for i, val in enumerate(self.time_values): + self.lb_times[i].set_text(pref_data[val]['value']) + def writeToSettings(self): """ Save preferences to the Cinnamon preference file @@ -176,12 +205,12 @@ class WindowHandler: if self.image_source == Source.SET: pref_data["etr_choosen_image_set"]["value"] = self.cb_image_set.get_active_text() - for i, val in enumerate(self.pref_vars): + for i, val in enumerate(self.img_values): pref_data[val]['value'] = str(i + 1) + ".jpg" else: pref_data["etr_choosen_image_set"]["value"] = "custom" - for i, val in enumerate(self.pref_vars): + for i, val in enumerate(self.img_values): image_name = self.cb_previews[i].get_active_text() pref_data[val]['value'] = image_name diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json b/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json index 6b06af4..1d16f1e 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json @@ -267,5 +267,51 @@ "first_start": { "type": "generic", "default": true + }, + + "etr_morning_twilight_times": { + "type": "entry", + "default": "", + "description": "" + }, + "etr_sunrise_times": { + "type": "entry", + "default": "", + "description": "" + }, + "etr_morning_times": { + "type": "entry", + "default": "", + "description": "" + }, + "etr_noon_times": { + "type": "entry", + "default": "", + "description": "" + }, + "etr_afternoon_times": { + "type": "entry", + "default": "", + "description": "" + }, + "etr_evening_times": { + "type": "entry", + "default": "", + "description": "" + }, + "etr_sunset_times": { + "type": "entry", + "default": "", + "description": "" + }, + "etr_night_twilight_times": { + "type": "entry", + "default": "", + "description": "" + }, + "etr_night_times": { + "type": "entry", + "default": "", + "description": "" } } \ No newline at end of file