diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/PreferenceEnums.py b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/PreferenceEnums.py index 9d8cde6..9addeb4 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/PreferenceEnums.py +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/PreferenceEnums.py @@ -9,7 +9,7 @@ class PrefenceEnums(enumerate): IMAGE_SOURCE = "image_source" SELECTED_IMAGE_SET = "selected_image_set" - SELECTED_SOURCE_FOLDER = "selected_source_folder" + SOURCE_FOLDER = "source_folder" PERIOD_0_IMAGE = "period_0_image" PERIOD_1_IMAGE = "period_1_image" diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.glade b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.glade index 833a7f0..9812041 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.glade +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.glade @@ -437,6 +437,7 @@ False select-folder + False @@ -627,7 +628,7 @@ True False - + 0 @@ -638,7 +639,7 @@ True False - + 1 @@ -649,7 +650,7 @@ True False - + 2 @@ -660,7 +661,7 @@ True False - + 3 @@ -671,7 +672,7 @@ True False - + 4 @@ -844,7 +845,7 @@ True False - + 0 @@ -855,7 +856,7 @@ True False - + 1 @@ -866,7 +867,7 @@ True False - + 3 @@ -877,7 +878,7 @@ True False - + 2 @@ -888,7 +889,7 @@ True False - + 4 @@ -909,122 +910,6 @@ 4 - - - True - False - start - 64 - Behaviour - - - - - - False - True - 5 - - - - - True - False - 64 - 64 - none - False - - - 36 - True - True - - - True - False - 12 - 12 - 12 - 12 - - - True - False - start - Expand image over all displays - - - False - True - 0 - - - - - True - True - end - - - True - True - 1 - - - - - - - - - True - True - - - True - False - 12 - 12 - 12 - 12 - - - True - False - start - Show image on Lock Screen - - - False - True - 0 - - - - - True - True - end - - - True - True - 1 - - - - - - - - - False - True - 3 - 6 - - image_config @@ -2523,6 +2408,127 @@ 1 + + + True + False + 8 + 8 + 8 + 8 + vertical + + + True + False + 64 + 64 + 64 + 64 + none + False + + + 36 + True + True + + + True + False + 12 + 12 + 12 + 12 + 12 + 12 + + + True + False + start + Expand image over all displays + + + False + True + 0 + + + + + True + True + end + + + True + True + 1 + + + + + + + + + True + True + + + True + False + 12 + 12 + 12 + 12 + 12 + 12 + + + True + False + start + Show image on Lock Screen + + + False + True + 0 + + + + + True + True + end + + + True + True + 1 + + + + + + + + + False + True + 3 + 0 + + + + + behaviour + Behaviour + 2 + + True @@ -2779,7 +2785,7 @@ about About - 2 + 3 diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.py b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.py index 404257d..905378a 100755 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.py +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.py @@ -302,7 +302,11 @@ class Preferences: ############################################################ ## Image Configuration - + + # +-----------+-----------+---------------+ + # | Image Set | HEIC file | Source Folder | + # +-----------+-----------+---------------+ + def on_toggle_button_image_set_clicked(self, button: Gtk.Button): if button.get_active(): self.c_prefs.prefs[PrefenceEnums.IMAGE_SOURCE] = ImageSourceEnum.IMAGESET @@ -312,7 +316,12 @@ class Preferences: self.lbr_image_set.set_visible(True) self.lbr_heic_file.set_visible(False) self.lbr_source_folder.set_visible(False) + + # Make the comboboxes invisible + for combobox in self.cb_periods: + combobox.set_visible(False) + def on_toggle_button_heic_file_clicked(self, button: Gtk.Button): if button.get_active(): self.c_prefs.prefs[PrefenceEnums.IMAGE_SOURCE] = ImageSourceEnum.HEICFILE @@ -323,6 +332,11 @@ class Preferences: self.lbr_heic_file.set_visible(True) self.lbr_source_folder.set_visible(False) + # Make the comboboxes visible + for combobox in self.cb_periods: + combobox.set_visible(True) + + def on_toggle_button_source_folder_clicked(self, button: Gtk.Button): if button.get_active(): self.c_prefs.prefs[PrefenceEnums.IMAGE_SOURCE] = ImageSourceEnum.SOURCEFOLDER @@ -333,6 +347,12 @@ class Preferences: self.lbr_heic_file.set_visible(False) self.lbr_source_folder.set_visible(True) + # Make the comboboxes invisible + for combobox in self.cb_periods: + combobox.set_visible(True) + + + def on_cb_image_set_changed(self, combobox: Gtk.ComboBox): tree_iter = combobox.get_active_iter() @@ -345,15 +365,40 @@ class Preferences: self.c_prefs.prefs[PrefenceEnums.SELECTED_IMAGE_SET] = selected_image_set # Update the ComboBoxes for image selection - image_path = os.path.abspath(os.path.join(PREFERENCES_URI, os.pardir)) + \ - "/images/included_image_sets/" + selected_image_set + "/" + self.c_prefs.prefs[PrefenceEnums.SOURCE_FOLDER] = os.path.abspath(os.path.join(PREFERENCES_URI, os.pardir)) + \ + "/images/included_image_sets/" + selected_image_set + "/" - image_names = self.images.get_images_from_folder(image_path) - + # Load all possible options to the comboboxes + image_names = self.images.get_images_from_folder(self.c_prefs.prefs[PrefenceEnums.SOURCE_FOLDER]) self.load_image_options_to_combo_boxes(image_names) + + # Image sets have the same names for the images: + # 9.jpg = Period 0 + # 1.jpg = Period 1 + # 2.jpg = Period 2 + # and so on.... + self.cb_periods[0].set_active(8) + for i in range(1, 10): + self.cb_periods[i].set_active(i - 1) + - def on_cb_period_changed(self, combobox: Gtk.ComboBox): + def on_fc_source_folder_file_set(self, fc_button: Gtk.FileChooser): + files = self.images.get_images_from_folder(fc_button.get_filename()) + + # Update the ComboBoxes for image selection + self.c_prefs.prefs[PrefenceEnums.SOURCE_FOLDER] = fc_button.get_filename() + "/" + + print(fc_button.get_filename()) + + if len(files) != 0: + self.load_image_options_to_combo_boxes(files) + else: + #todo + pass + + + def on_cb_period_preview_changed(self, combobox: Gtk.ComboBox): tree_iter = combobox.get_active_iter() combobox_name = Gtk.Buildable.get_name(combobox) @@ -363,12 +408,14 @@ class Preferences: # Get the selected value model = combobox.get_model() image_file_name = model[tree_iter][0] + + # Store selection to preferences self.c_prefs.prefs["period_%s_image" % (period_index)] = image_file_name - image_path = os.path.abspath(os.path.join(PREFERENCES_URI, os.pardir)) + \ - "/images/included_image_sets/" + self.c_prefs.prefs[PrefenceEnums.SELECTED_IMAGE_SET] + "/" + # Build up image path + image_path = self.c_prefs.prefs[PrefenceEnums.SOURCE_FOLDER] + image_file_name - self.load_image_to_preview(self.img_periods[period_index], image_path + image_file_name) + self.load_image_to_preview(self.img_periods[period_index], image_path) ## Location & Times diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json b/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json index 1389568..b725c83 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json @@ -19,7 +19,7 @@ "type": "generic", "default": "" }, - "selected_source_folder": { + "source_folder": { "type": "generic", "default": "" },