Adding OK button, bugfixes

This commit is contained in:
2024-01-16 11:46:36 +01:00
parent 506bb45dda
commit c04ec20704
5 changed files with 30 additions and 6 deletions

3
.gitignore vendored
View File

@@ -1,7 +1,8 @@
*.glade~ *.glade~
*.glade# *.glade#
extracted_images/
*.txt *.txt
*.json
extracted_images/
selected/ selected/
__pycache__ __pycache__
time_bar.svg time_bar.svg

View File

@@ -60,7 +60,7 @@ CinnamonDynamicWallpaperExtension.prototype = {
this.settings = new Settings.ExtensionSettings(this, uuid); this.settings = new Settings.ExtensionSettings(this, uuid);
// Check for the first startup // Check for the first startup
if (!this.settings.getValue("first_start")) { if (this.settings.getValue("first_start")) {
// Welcome notification // Welcome notification
this.showNotification("Welcome to Cinnamon Dynamic Wallpaper", this.showNotification("Welcome to Cinnamon Dynamic Wallpaper",

View File

@@ -29,7 +29,7 @@ class Loop():
self.start_times = suntimes.day_periods self.start_times = suntimes.day_periods
# Position is given by user # Position is given by user
elif self.prefs.prefs[PrefenceEnums.PERIOD_SOURCE] == PeriodSourceEnum.CUSTOMLOCATION: elif self.prefs.period_source == PeriodSourceEnum.CUSTOMLOCATION:
suntimes.calc_suntimes(float(self.prefs.latitude_custom), float(self.prefs.longitude_custom)) suntimes.calc_suntimes(float(self.prefs.latitude_custom), float(self.prefs.longitude_custom))
self.start_times = suntimes.day_periods self.start_times = suntimes.day_periods

View File

@@ -2806,6 +2806,20 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="stack">stack_main</property> <property name="stack">stack_main</property>
</object> </object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-stock">True</property>
<property name="always-show-image">True</property>
<signal name="clicked" handler="on_ok" swapped="no"/>
</object>
</child> </child>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
@@ -2818,6 +2832,9 @@
<property name="always-show-image">True</property> <property name="always-show-image">True</property>
<signal name="clicked" handler="on_apply" swapped="no"/> <signal name="clicked" handler="on_apply" swapped="no"/>
</object> </object>
<packing>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
</child> </child>

View File

@@ -622,6 +622,15 @@ class Preferences:
subprocess.Popen(["xdg-open", "https://github.com/TobiZog/cinnamon-dynamic-wallpaper/issues/new"]) subprocess.Popen(["xdg-open", "https://github.com/TobiZog/cinnamon-dynamic-wallpaper/issues/new"])
def on_ok(self, *args):
""" Callback for the OK button in the top bar
"""
self.on_apply()
# Close the window
self.on_destroy()
def on_apply(self, *args): def on_apply(self, *args):
""" Callback for the Apply button in the top bar """ Callback for the Apply button in the top bar
""" """
@@ -632,9 +641,6 @@ class Preferences:
loop = Loop() loop = Loop()
loop.exchange_image() loop.exchange_image()
# Close the window
self.on_destroy()
if __name__ == "__main__": if __name__ == "__main__":
Preferences().show() Preferences().show()