Changelog, Readme, dynamic background example image
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
# Version 2.2
|
||||||
|
- Bugfixes
|
||||||
|
- Migrate code to MVVM pattern
|
||||||
|
- Adding option to change the location provider
|
||||||
|
- Adding example image for dynamic background color
|
||||||
|
|
||||||
# Version 2.1
|
# Version 2.1
|
||||||
- Bugfixes
|
- Bugfixes
|
||||||
- Smaller UI for displays with reduced resolution (< 1000px height)
|
- Smaller UI for displays with reduced resolution (< 1000px height)
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ This extension switches the background image of your Cinnamon desktop multiple t
|
|||||||
- 10 day periods
|
- 10 day periods
|
||||||
- HEIF converter
|
- HEIF converter
|
||||||
- Image configuration assistent with simple one-click setup for image choices
|
- Image configuration assistent with simple one-click setup for image choices
|
||||||
- Online location estimation or offline with manual latitude and longitude input
|
- Online location estimation (three provider) or offline with manual latitude and longitude input
|
||||||
- Time periods individual configured by user
|
- Time periods individual configured by user
|
||||||
- Offline sun angles estimation
|
- Offline sun angles estimation
|
||||||
- Image stretching over multiple displays or repeat image for every display
|
- Image stretching over multiple displays or repeat image for every display
|
||||||
- Show image on lock screen
|
- Creating a color gradient based on the current wallpaper for images which not fill the whole screen
|
||||||
|
|
||||||
### Tested Cinnamon versions
|
### Tested Cinnamon versions
|
||||||
- 5.4 (Mint 21)
|
- 5.4 (Mint 21)
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 201 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
@@ -2471,6 +2471,23 @@
|
|||||||
<property name="margin-top">8</property>
|
<property name="margin-top">8</property>
|
||||||
<property name="margin-bottom">8</property>
|
<property name="margin-bottom">8</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label" translatable="yes">Scaling</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBox">
|
<object class="GtkListBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -2492,6 +2509,7 @@
|
|||||||
<property name="margin-end">12</property>
|
<property name="margin-end">12</property>
|
||||||
<property name="margin-top">12</property>
|
<property name="margin-top">12</property>
|
||||||
<property name="margin-bottom">12</property>
|
<property name="margin-bottom">12</property>
|
||||||
|
<property name="homogeneous">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -2522,6 +2540,36 @@
|
|||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="padding">3</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label" translatable="yes">Dynamic Background color</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="selection-mode">none</property>
|
||||||
|
<property name="activate-on-single-click">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBoxRow">
|
<object class="GtkListBoxRow">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -2542,7 +2590,7 @@
|
|||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="label" translatable="yes">Dynamic Background color</property>
|
<property name="label" translatable="yes">Use dynamic Background color to create a gradient</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -2554,7 +2602,6 @@
|
|||||||
<object class="GtkSwitch" id="sw_dynamic_background_color">
|
<object class="GtkSwitch" id="sw_dynamic_background_color">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<signal name="state-set" handler="on_sw_dynamic_background_color_state_set" swapped="no"/>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -2571,7 +2618,19 @@
|
|||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="padding">3</property>
|
<property name="padding">3</property>
|
||||||
<property name="position">0</property>
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="pixbuf">images/dynamic_background_example.png</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">4</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys, datetime
|
||||||
from view.main_window import *
|
from view.main_window import *
|
||||||
from model.main_view_model import *
|
from model.main_view_model import *
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import os
|
import os, time
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from gi.repository import Gio, Gdk
|
from gi.repository import Gio, Gdk
|
||||||
|
|
||||||
@@ -83,6 +83,7 @@ class Main_View_Model:
|
|||||||
|
|
||||||
def refresh_location(self) -> bool:
|
def refresh_location(self) -> bool:
|
||||||
""" Updating the location by IP, store the result to cinnamon_prefs
|
""" Updating the location by IP, store the result to cinnamon_prefs
|
||||||
|
Run it in a parallel thread to avoid UI freeze!
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: Successful or not
|
bool: Successful or not
|
||||||
@@ -108,10 +109,12 @@ class Main_View_Model:
|
|||||||
hour = raw_str[0:raw_str.find(":")]
|
hour = raw_str[0:raw_str.find(":")]
|
||||||
minute = raw_str[raw_str.find(":") + 1:]
|
minute = raw_str[raw_str.find(":") + 1:]
|
||||||
|
|
||||||
|
time(1, 2)
|
||||||
|
|
||||||
return time(hour=int(hour), minute=int(minute))
|
return time(hour=int(hour), minute=int(minute))
|
||||||
|
|
||||||
|
|
||||||
def time_to_string_converter(self, time: time) -> str:
|
def time_to_string_converter(self, _time: time) -> str:
|
||||||
""" Convert a time object to a string like "12:34"
|
""" Convert a time object to a string like "12:34"
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -120,7 +123,7 @@ class Main_View_Model:
|
|||||||
Returns:
|
Returns:
|
||||||
str: Converted string
|
str: Converted string
|
||||||
"""
|
"""
|
||||||
return "{:0>2}:{:0>2}".format(time.hour, time.minute)
|
return "{:0>2}:{:0>2}".format(_time.hour, _time.minute)
|
||||||
|
|
||||||
|
|
||||||
def calulate_time_periods(self) -> list[time]:
|
def calulate_time_periods(self) -> list[time]:
|
||||||
@@ -139,7 +142,6 @@ class Main_View_Model:
|
|||||||
# Time periods have to be estimate by coordinates
|
# Time periods have to be estimate by coordinates
|
||||||
if self.cinnamon_prefs.period_source == PeriodSourceEnum.NETWORKLOCATION:
|
if self.cinnamon_prefs.period_source == PeriodSourceEnum.NETWORKLOCATION:
|
||||||
# Get coordinates from the network
|
# Get coordinates from the network
|
||||||
self.refresh_location()
|
|
||||||
self.suntimes.calc_suntimes(self.cinnamon_prefs.latitude_auto, self.cinnamon_prefs.longitude_auto)
|
self.suntimes.calc_suntimes(self.cinnamon_prefs.latitude_auto, self.cinnamon_prefs.longitude_auto)
|
||||||
|
|
||||||
elif self.cinnamon_prefs.period_source == PeriodSourceEnum.CUSTOMLOCATION:
|
elif self.cinnamon_prefs.period_source == PeriodSourceEnum.CUSTOMLOCATION:
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ gi.require_version("Gtk", "3.0")
|
|||||||
from gi.repository import Gtk, GdkPixbuf
|
from gi.repository import Gtk, GdkPixbuf
|
||||||
|
|
||||||
# Packages
|
# Packages
|
||||||
import subprocess
|
import subprocess, threading, time
|
||||||
from datetime import timedelta
|
from datetime import timedelta, datetime, date
|
||||||
|
|
||||||
# Local scripts
|
# Local scripts
|
||||||
from model.main_view_model import *
|
from model.main_view_model import *
|
||||||
@@ -335,7 +335,7 @@ class Main_Window:
|
|||||||
try:
|
try:
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file(image_src)
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file(image_src)
|
||||||
|
|
||||||
# Scaling the images smaller for screens
|
# Scaling the images for smaller screens
|
||||||
if self.view_model.screen_height < self.view_model.breakpoint_ui:
|
if self.view_model.screen_height < self.view_model.breakpoint_ui:
|
||||||
pixbuf = pixbuf.scale_simple(221, 128, GdkPixbuf.InterpType.BILINEAR)
|
pixbuf = pixbuf.scale_simple(221, 128, GdkPixbuf.InterpType.BILINEAR)
|
||||||
else:
|
else:
|
||||||
@@ -356,7 +356,9 @@ class Main_Window:
|
|||||||
label_txt = self.view_model.time_to_string_converter(start_times[i]) + " - "
|
label_txt = self.view_model.time_to_string_converter(start_times[i]) + " - "
|
||||||
|
|
||||||
if i != 9:
|
if i != 9:
|
||||||
label_txt += self.view_model.time_to_string_converter(start_times[i + 1])
|
diff = timedelta(hours=start_times[i + 1].hour, minutes=start_times[i + 1].minute) - timedelta(minutes=1)
|
||||||
|
prev_time = time(hour=diff.seconds // 3600, minute=diff.seconds // 60 % 60)
|
||||||
|
label_txt += self.view_model.time_to_string_converter(prev_time)
|
||||||
else:
|
else:
|
||||||
label_txt += "23:59"
|
label_txt += "23:59"
|
||||||
|
|
||||||
@@ -627,16 +629,21 @@ class Main_Window:
|
|||||||
Args:
|
Args:
|
||||||
combobox (Gtk.ComboBox): The used ComboBox
|
combobox (Gtk.ComboBox): The used ComboBox
|
||||||
"""
|
"""
|
||||||
|
def network_refresh_thread():
|
||||||
|
success = self.view_model.refresh_location()
|
||||||
|
|
||||||
|
if success:
|
||||||
|
self.lb_current_location.set_text(\
|
||||||
|
"Latitude: " + str(self.view_model.cinnamon_prefs.latitude_auto) + ", Longitude: " + str(self.view_model.cinnamon_prefs.longitude_auto))
|
||||||
|
else:
|
||||||
|
self.dialogs.message_dialog("Error during fetching location. Are you connected to the network?", Gtk.MessageType.ERROR)
|
||||||
|
self.lb_current_location.set_text("Latitude: ?, Longitude: ?")
|
||||||
|
|
||||||
|
|
||||||
self.view_model.cinnamon_prefs.network_location_provider = self.get_active_combobox_item(combobox)
|
self.view_model.cinnamon_prefs.network_location_provider = self.get_active_combobox_item(combobox)
|
||||||
|
|
||||||
success = self.view_model.refresh_location()
|
thread = threading.Thread(target=network_refresh_thread)
|
||||||
|
thread.start()
|
||||||
if success:
|
|
||||||
self.lb_current_location.set_text(\
|
|
||||||
"Latitude: " + str(self.view_model.cinnamon_prefs.latitude_auto) + ", Longitude: " + str(self.view_model.cinnamon_prefs.longitude_auto))
|
|
||||||
else:
|
|
||||||
self.dialogs.message_dialog("Error during fetching location. Are you connected to the network?", Gtk.MessageType.ERROR)
|
|
||||||
self.lb_current_location.set_text("Latitude: ?, Longitude: ?")
|
|
||||||
|
|
||||||
|
|
||||||
def on_etr_longitude_changed(self, entry: Gtk.Entry):
|
def on_etr_longitude_changed(self, entry: Gtk.Entry):
|
||||||
|
|||||||
Reference in New Issue
Block a user