From 4759610ddd422c0f91c27f52ccde27f979ef4459 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Thu, 9 Feb 2023 15:18:27 +0100 Subject: [PATCH] [settings] use dedicated category for plugin manager --- python/pyplugin_installer/installer.py | 4 ++-- python/pyplugin_installer/installer_data.py | 16 ++++++++-------- src/app/pluginmanager/qgspluginmanager.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/python/pyplugin_installer/installer.py b/python/pyplugin_installer/installer.py index e1a97cfcc45..beefedc0b8b 100644 --- a/python/pyplugin_installer/installer.py +++ b/python/pyplugin_installer/installer.py @@ -294,7 +294,7 @@ class QgsPluginInstaller(QObject): def exportSettingsGroup(self): """ Return QgsSettings settingsGroup value """ # todo QGIS 4 remove - return "plugins/_plugin_manager" + return "plugin-manager" # ----------------------------------------- # def upgradeAllUpgradeable(self): @@ -578,7 +578,7 @@ class QgsPluginInstaller(QObject): if not os.path.isfile(filePath): return - QgsSettingsTree.createPluginTreeNode("_plugin_manager").childSetting("last-zip-directory").setValue(QFileInfo(filePath).absoluteDir().absolutePath()) + QgsSettingsTree.nodeCopy("plugin-manager").childSetting("last-zip-directory").setValue(QFileInfo(filePath).absoluteDir().absolutePath()) pluginName = None with zipfile.ZipFile(filePath, 'r') as zf: diff --git a/python/pyplugin_installer/installer_data.py b/python/pyplugin_installer/installer_data.py index f6452dc625c..a43212e0031 100644 --- a/python/pyplugin_installer/installer_data.py +++ b/python/pyplugin_installer/installer_data.py @@ -229,22 +229,22 @@ class Repositories(QObject): def checkingOnStart(self) -> bool: """ return true if checking for news and updates is enabled """ - return QgsSettingsTree.createPluginTreeNode("_plugin_manager").childSetting('automatically-check-for-updates').value() + return QgsSettingsTree.nodeCopy("plugin-manager").childSetting('automatically-check-for-updates').value() def setCheckingOnStart(self, state: bool): """ set state of checking for news and updates """ - QgsSettingsTree.createPluginTreeNode("_plugin_manager").childSetting('automatically-check-for-updates').setValue(state) + QgsSettingsTree.nodeCopy("plugin-manager").childSetting('automatically-check-for-updates').setValue(state) def saveCheckingOnStartLastDate(self): """ set today's date as the day of last checking """ - QgsSettingsTree.createPluginTreeNode("_plugin_manager").childSetting('check-on-start-last-date').setValue(QDate.currentDate()) + QgsSettingsTree.nodeCopy("plugin-manager").childSetting('check-on-start-last-date').setValue(QDate.currentDate()) def timeForChecking(self) -> bool: """ determine whether it's the time for checking for news and updates now """ settings = QgsSettings() try: # QgsSettings may contain ivalid value... - interval = QgsSettingsTree.createPluginTreeNode("_plugin_manager").childSetting('check-on-start-last-date').valueAs(type=QDate).daysTo(QDate.currentDate()) + interval = QgsSettingsTree.nodeCopy("plugin-manager").childSetting('check-on-start-last-date').valueAs(type=QDate).daysTo(QDate.currentDate()) except: interval = 0 if interval >= Repositories.CHECK_ON_START_INTERVAL: @@ -711,8 +711,8 @@ class Plugins(QObject): self.mPlugins = {} for i in list(self.localCache.keys()): self.mPlugins[i] = self.localCache[i].copy() - allowExperimental = QgsSettingsTree.createPluginTreeNode("_plugin_manager").childSetting("allow-experimental").value() - allowDeprecated = QgsSettingsTree.createPluginTreeNode("_plugin_manager").childSetting("allow-deprecated").value() + allowExperimental = QgsSettingsTree.nodeCopy("plugin-manager").childSetting("allow-experimental").value() + allowDeprecated = QgsSettingsTree.nodeCopy("plugin-manager").childSetting("allow-deprecated").value() for i in list(self.repoCache.values()): for j in i: plugin = j.copy() # do not update repoCache elements! @@ -808,7 +808,7 @@ class Plugins(QObject): # ----------------------------------------- # def markNews(self): """ mark all new plugins as new """ - seenPlugins = QgsSettingsTree.createPluginTreeNode("_plugin_manager").childSetting("seen-plugins").valueWithDefaultOverride(list(self.mPlugins.keys())) + seenPlugins = QgsSettingsTree.nodeCopy("plugin-manager").childSetting("seen-plugins").valueWithDefaultOverride(list(self.mPlugins.keys())) if len(seenPlugins) > 0: for plugin in list(self.mPlugins.keys()): if seenPlugins.count(plugin) == 0 and self.mPlugins[plugin]["status"] == "not installed": @@ -817,7 +817,7 @@ class Plugins(QObject): # ----------------------------------------- # def updateSeenPluginsList(self): """ update the list of all seen plugins """ - setting = QgsSettingsTree.createPluginTreeNode("_plugin_manager").childSetting("seen-plugins") + setting = QgsSettingsTree.nodeCopy("plugin-manager").childSetting("seen-plugins") seenPlugins = setting.valueWithDefaultOverride(list(self.mPlugins.keys())) for plugin in list(self.mPlugins.keys()): if seenPlugins.count(plugin) == 0: diff --git a/src/app/pluginmanager/qgspluginmanager.h b/src/app/pluginmanager/qgspluginmanager.h index d2643cc2103..5b67f58f1e6 100644 --- a/src/app/pluginmanager/qgspluginmanager.h +++ b/src/app/pluginmanager/qgspluginmanager.h @@ -53,7 +53,7 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag Q_OBJECT public: - static inline QgsSettingsTreeNode *sTreePluginManager = QgsSettingsTree::sTreePlugins->createChildNode( QStringLiteral( "_plugin_manager" ) ); + static inline QgsSettingsTreeNode *sTreePluginManager = QgsSettingsTree::treeRoot()->createChildNode( QStringLiteral( "plugin-manager" ) ); static const QgsSettingsEntryBool *settingsAutomaticallyCheckForPluginUpdates; static const QgsSettingsEntryBool *settingsAllowExperimental;