From 81da7bd6f91d67c1f2ee660030c037d9505426b4 Mon Sep 17 00:00:00 2001 From: Florian Bach Date: Sat, 8 Oct 2022 18:32:29 +0200 Subject: [PATCH] Fix all the bugs added with the last commit --- calibre-plugin/__init__.py | 3 ++- calibre-plugin/config.py | 2 +- calibre-plugin/prefs.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/calibre-plugin/__init__.py b/calibre-plugin/__init__.py index e79fb87..992a08e 100644 --- a/calibre-plugin/__init__.py +++ b/calibre-plugin/__init__.py @@ -134,7 +134,8 @@ class ACSMInput(FileTypePlugin): # If the old DeACSM plugin still exists, rename it to BAK or something so it doesn't load. - os.rename(os.path.join(self.pluginsdir, "DeACSM.zip"), os.path.join(self.pluginsdir, "DeACSM.BAK")) + if os.path.exists(os.path.join(self.pluginsdir, "DeACSM.zip")): + os.rename(os.path.join(self.pluginsdir, "DeACSM.zip"), os.path.join(self.pluginsdir, "DeACSM.BAK")) # Make sure the GUI extension is loaded: self.init_embedded_plugins() diff --git a/calibre-plugin/config.py b/calibre-plugin/config.py index 84becf9..69f6ac0 100644 --- a/calibre-plugin/config.py +++ b/calibre-plugin/config.py @@ -152,7 +152,7 @@ class ConfigWidget(QWidget): # First remove all overdue books from the loan list, # to determine if we should enable the button. - self.delete_overdue_books_from_loan_list() + RentedBooksDialog.remove_overdue_books_from_list() if (len(self.tempdeacsmprefs["list_of_rented_books"]) == 0): self.button_rented_books.setText(_("No loaned books available")) diff --git a/calibre-plugin/prefs.py b/calibre-plugin/prefs.py index 201a8ed..e1fd4bc 100644 --- a/calibre-plugin/prefs.py +++ b/calibre-plugin/prefs.py @@ -17,7 +17,7 @@ class ACSMInput_Prefs(): JSON_PATH_OLD = os.path.join("plugins", "deacsm.json") JSON_PATH = os.path.join("plugins", "ACSMInput", "ACSMInput.json") - if os.path.exists(JSON_PATH_OLD) and not os.path.exists(JSON_PATH): + if os.path.exists(os.path.join(config_dir, JSON_PATH_OLD)): # If the file exists in the old location, use that. JSON_PATH = JSON_PATH_OLD @@ -39,7 +39,7 @@ class ACSMInput_Prefs(): self.__pluginsdir = os.path.join(config_dir,"plugins") success = False - for f in ["ACSMInput", "DeACSM"]: + for f in ["DeACSM", "ACSMInput"]: self.__maindir = os.path.join(self.__pluginsdir, f) self.__accountdir = os.path.join(self.__maindir,"account") if os.path.exists(self.__accountdir):