diff --git a/CHANGELOG b/CHANGELOG index db50e77..6f50de8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +# Version 2.5 +- Switch from libheif to imagemagick, HEIC conversion is now possible on Arch and Fedora! + # Version 2.4 - Adding Login window support - Adding Russian translation (Thanks to blogdron) diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js b/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js index 0271d71..88bf715 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js @@ -75,12 +75,24 @@ CinnamonDynamicWallpaperExtension.prototype = { this.showNotification(_("Welcome to Cinnamon Dynamic Wallpaper"), _("Check the preferences to choose a dynamic wallpaper"), true) + // Check for necessary software + if (!find_program_in_path('convert')) { + // Run on Ubuntu/Debian based distros with APT package manager + if(GLib.find_program_in_path("apturl")) { + Util.spawnCommandLine("apturl apt://imagemagick"); + } else { + // Notification on other distros + this.showNotification(_("imagemagick is not installed"), + _("Please install the package manually for the full range of functions"), true) + } + } + // Hide the notification on system restart this.settings.setValue("first_start", false) this.settings.setValue("source_folder", DIRECTORY["path"] + "/res/images/included_image_sets/lakeside/") } - // Start the main loop, checks in fixed time periods the + // Start the main loop, checks in fixed time periods this._loop() }, @@ -170,11 +182,6 @@ function init(extensionMeta) { * @returns The extension object */ function enable() { - // Check for necessary software - if (!find_program_in_path('heif-convert')) { - Util.spawnCommandLine("apturl apt://libheif-examples"); - } - return extension; } diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/res/preferences.glade b/cinnamon-dynamic-wallpaper@TobiZog/5.4/res/preferences.glade index 62f9001..09aea58 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/res/preferences.glade +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/res/preferences.glade @@ -204,7 +204,8 @@ True True - True + False + Please install 'imagemagick' manually and reopen this configuration window diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/src/model/main_view_model.py b/cinnamon-dynamic-wallpaper@TobiZog/5.4/src/model/main_view_model.py index 38dfbbf..019b548 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/src/model/main_view_model.py +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/src/model/main_view_model.py @@ -1,5 +1,5 @@ # GTK -from gi.repository import Gio, Gdk +from gi.repository import Gio, Gdk, GLib # Packages import os, time, locale, subprocess, getpass @@ -244,7 +244,8 @@ class Main_View_Model: os.remove(extract_folder + file) # Extract the HEIC file - os.system("heif-convert '" + file_uri + "' '" + extract_folder + file_name + ".jpg'") + print(self.get_imagemagick_prompt() + " " + file_uri + " -quality 100% " + extract_folder + file_name + ".jpg") + os.system(self.get_imagemagick_prompt() + " " + file_uri + " -quality 100% " + extract_folder + file_name + ".jpg") return True except: @@ -328,3 +329,24 @@ class Main_View_Model: if os.path.isfile('/etc/lightdm/slick-greeter.conf.backup'): subprocess.call(['pkexec', 'rm', '/etc/lightdm/slick-greeter.conf']) subprocess.call(['pkexec', 'mv', '/etc/lightdm/slick-greeter.conf.backup', '/etc/lightdm/slick-greeter.conf']) + + + def check_for_imagemagick(self) -> bool: + # Imagemagick < v.7.0 + if GLib.find_program_in_path("convert") != None: + return True + # Imagemagick >= v.7.0 + elif GLib.find_program_in_path("imagemagick") != None: + return True + # Not installed + else: + return False + + def get_imagemagick_prompt(self) -> str: + # Imagemagick < v.7.0 + if GLib.find_program_in_path("convert") != None: + return "convert" + # Imagemagick >= v.7.0 + elif GLib.find_program_in_path("imagemagick") != None: + return "imagemagick convert" + diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/src/view/main_window.py b/cinnamon-dynamic-wallpaper@TobiZog/5.4/src/view/main_window.py index efa1173..ee9a635 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/src/view/main_window.py +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/src/view/main_window.py @@ -171,6 +171,13 @@ class Main_Window: self.add_items_to_combo_box(self.cb_image_set, self.view_model.image_sets) self.image_source = self.image_source # This triggers the @image_source.setter + ## Disable the HEIF-Converter option, if the plugin isn't installed + if not self.view_model.check_for_imagemagick(): + self.tb_heic_file.set_sensitive(False) + else: + ## Remove the Tooltip + self.tb_heic_file.set_tooltip_text("") + # Page 2: Location & Times self.add_items_to_combo_box(self.cb_network_provider, self.view_model.network_location_provider) self.period_source = self.period_source # This triggers the @period_source.setter