Bugfixes
This commit is contained in:
@@ -34,7 +34,7 @@ const PATH = DIRECTORY.path;
|
|||||||
let extension;
|
let extension;
|
||||||
|
|
||||||
// Time and date of the last location update
|
// Time and date of the last location update
|
||||||
let lastLocationUpdate = new Date()
|
let lastLocationUpdate = -1
|
||||||
|
|
||||||
// The last calculated suntime of the day
|
// The last calculated suntime of the day
|
||||||
let lastDayTime = suntimes.DAYPERIOD.NONE
|
let lastDayTime = suntimes.DAYPERIOD.NONE
|
||||||
@@ -69,13 +69,14 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
// Location estimation
|
// Location estimation
|
||||||
this.bindSettings("sw_auto_location", "autolocation", this.settingsUpdated)
|
this.bindSettings("sw_auto_location", "autolocation", this.settingsUpdated)
|
||||||
this.bindSettings("sc_location_refresh_time", "locationRefreshTime", this.settingsUpdated)
|
this.bindSettings("sc_location_refresh_time", "locationRefreshTime", this.settingsUpdated)
|
||||||
|
this.bindSettings("etr_last_update", "etrLastUpdate")
|
||||||
this.bindSettings("etr_latitude", "latitude", this.settingsUpdated)
|
this.bindSettings("etr_latitude", "latitude", this.settingsUpdated)
|
||||||
this.bindSettings("etr_longitude", "longitude", this.settingsUpdated)
|
this.bindSettings("etr_longitude", "longitude", this.settingsUpdated)
|
||||||
|
|
||||||
|
|
||||||
// Time periods
|
// Time periods
|
||||||
this.bindSettings("tv_times", "tvTimes")
|
this.bindSettings("tv_times", "tvTimes")
|
||||||
|
|
||||||
|
|
||||||
/** Debugging */
|
/** Debugging */
|
||||||
// Logs
|
// Logs
|
||||||
this.bindSettings("tv_logs", "tvLogs")
|
this.bindSettings("tv_logs", "tvLogs")
|
||||||
@@ -149,7 +150,11 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
if (looping) {
|
if (looping) {
|
||||||
this.setImageToTime()
|
this.setImageToTime()
|
||||||
|
|
||||||
if (lastLocationUpdate < new Date().getTime() - this.locationRefreshTime * 1000) {
|
// Update the location, if the user choose "autoLocation" and the timer has expired
|
||||||
|
if ((lastLocationUpdate == -1 ||
|
||||||
|
lastLocationUpdate.getTime() < new Date().getTime() - this.locationRefreshTime * 60000) &&
|
||||||
|
this.autolocation)
|
||||||
|
{
|
||||||
this.updateLocation()
|
this.updateLocation()
|
||||||
lastLocationUpdate = new Date()
|
lastLocationUpdate = new Date()
|
||||||
}
|
}
|
||||||
@@ -210,6 +215,8 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/******************** Other functions ********************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the desktop background image
|
* Changes the desktop background image
|
||||||
*
|
*
|
||||||
@@ -283,17 +290,16 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
* Callback for changes in preferences
|
* Callback for changes in preferences
|
||||||
*/
|
*/
|
||||||
updateLocation: function () {
|
updateLocation: function () {
|
||||||
|
// Update the update information
|
||||||
|
lastLocationUpdate = new Date()
|
||||||
|
|
||||||
if (this.autolocation) {
|
if (this.autolocation) {
|
||||||
let loc = location.estimateLocation()
|
let loc = location.estimateLocation()
|
||||||
this.latitude = loc["latitude"]
|
this.latitude = loc["latitude"]
|
||||||
this.longitude = loc["longitude"]
|
this.longitude = loc["longitude"]
|
||||||
} else {
|
|
||||||
this.latitude = this.latitude
|
|
||||||
this.longitude = this.longitude
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the update information
|
this.etrLastUpdate = lastLocationUpdate.getHours() + ":" + lastLocationUpdate.getMinutes()
|
||||||
lastLocationUpdate = new Date()
|
}
|
||||||
|
|
||||||
this.writeToLogs("Location updated")
|
this.writeToLogs("Location updated")
|
||||||
},
|
},
|
||||||
@@ -342,4 +348,4 @@ function enable() {
|
|||||||
*/
|
*/
|
||||||
function disable() {
|
function disable() {
|
||||||
looping = false
|
looping = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ IMAGE_DIR = PROJECT_DIR + "images/"
|
|||||||
IMAGE_EXTRACT_DIR = IMAGE_DIR + "extracted/"
|
IMAGE_EXTRACT_DIR = IMAGE_DIR + "extracted/"
|
||||||
IMAGE_SETS_DIR = IMAGE_DIR + "included_image_sets/"
|
IMAGE_SETS_DIR = IMAGE_DIR + "included_image_sets/"
|
||||||
IMAGE_SELECTED_DIR = IMAGE_DIR + "selected/"
|
IMAGE_SELECTED_DIR = IMAGE_DIR + "selected/"
|
||||||
|
IMAGE_DEFAULT_DIR = IMAGE_DIR + "default/"
|
||||||
|
|
||||||
|
|
||||||
class WindowHandler:
|
class WindowHandler:
|
||||||
@@ -148,20 +149,19 @@ class WindowHandler:
|
|||||||
|
|
||||||
|
|
||||||
for i, val in enumerate(self.pref_vars):
|
for i, val in enumerate(self.pref_vars):
|
||||||
# Set the preview image
|
if pref_data[val]['value'] != None:
|
||||||
self.changePreviewImage(i, IMAGE_SELECTED_DIR + pref_data[val]['value'])
|
# Set the preview image
|
||||||
|
self.changePreviewImage(i, IMAGE_SELECTED_DIR + pref_data[val]['value'])
|
||||||
|
|
||||||
# Set the ComboBox selection
|
# Set the ComboBox selection
|
||||||
if pref_data["etr_choosen_image_set"]["value"] == "custom":
|
if pref_data["etr_choosen_image_set"]["value"] == "custom":
|
||||||
self.image_source = Source.EXTRACT
|
self.image_source = Source.EXTRACT
|
||||||
|
|
||||||
for j, set in enumerate(choosable_images):
|
for j, set in enumerate(choosable_images):
|
||||||
if set == pref_data[val]["value"]:
|
if set == pref_data[val]["value"]:
|
||||||
self.cb_previews[i].set_active(j)
|
self.cb_previews[i].set_active(j)
|
||||||
else:
|
else:
|
||||||
self.image_source = Source.SET
|
self.image_source = Source.SET
|
||||||
#except:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
def writeToSettings(self):
|
def writeToSettings(self):
|
||||||
@@ -182,7 +182,9 @@ class WindowHandler:
|
|||||||
pref_data["etr_choosen_image_set"]["value"] = "custom"
|
pref_data["etr_choosen_image_set"]["value"] = "custom"
|
||||||
|
|
||||||
for i, val in enumerate(self.pref_vars):
|
for i, val in enumerate(self.pref_vars):
|
||||||
pref_data[val]['value'] = self.cb_previews[i].get_active_text()
|
image_name = self.cb_previews[i].get_active_text()
|
||||||
|
|
||||||
|
pref_data[val]['value'] = image_name
|
||||||
|
|
||||||
|
|
||||||
# Write the settings
|
# Write the settings
|
||||||
@@ -219,7 +221,7 @@ class WindowHandler:
|
|||||||
self.image_source = Source.EXTRACT
|
self.image_source = Source.EXTRACT
|
||||||
|
|
||||||
self.wipeImages(Source.EXTRACT)
|
self.wipeImages(Source.EXTRACT)
|
||||||
os.system("heif-convert " + imageURI + " " + IMAGE_EXTRACT_DIR + "/" + filename + ".jpg")
|
os.system("heif-convert " + imageURI + " " + IMAGE_EXTRACT_DIR + filename + ".jpg")
|
||||||
|
|
||||||
self.createExtracted()
|
self.createExtracted()
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
"keys": [
|
"keys": [
|
||||||
"sw_auto_location",
|
"sw_auto_location",
|
||||||
"sc_location_refresh_time",
|
"sc_location_refresh_time",
|
||||||
|
"etr_last_update",
|
||||||
"etr_latitude",
|
"etr_latitude",
|
||||||
"etr_longitude"
|
"etr_longitude"
|
||||||
]
|
]
|
||||||
@@ -134,6 +135,12 @@
|
|||||||
"description": "Interval time to refresh the location via network (min)",
|
"description": "Interval time to refresh the location via network (min)",
|
||||||
"dependency": "sw_auto_location"
|
"dependency": "sw_auto_location"
|
||||||
},
|
},
|
||||||
|
"etr_last_update": {
|
||||||
|
"type": "entry",
|
||||||
|
"description": "Last location update",
|
||||||
|
"default": "",
|
||||||
|
"dependency": "sw_auto_location"
|
||||||
|
},
|
||||||
"etr_latitude": {
|
"etr_latitude": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"uuid": "cinnamon-dynamic-wallpaper@TobiZog",
|
"uuid": "cinnamon-dynamic-wallpaper@TobiZog",
|
||||||
"name": "Cinnamon Dynamic Wallpaper",
|
"name": "Cinnamon Dynamic Wallpaper",
|
||||||
"description": "Cinnamon extension for dynamic desktop backgrounds based on time and location",
|
"description": "Cinnamon extension for dynamic desktop backgrounds based on time and location",
|
||||||
"version": "1.3",
|
"version": "1.4",
|
||||||
"multiversion": true,
|
"multiversion": true,
|
||||||
"cinnamon-version": [
|
"cinnamon-version": [
|
||||||
"4.8",
|
"4.8",
|
||||||
|
|||||||
Reference in New Issue
Block a user