From 260bf0c139b94582368329e64f2936b6118f5af3 Mon Sep 17 00:00:00 2001 From: Borys Jurgiel Date: Fri, 26 Aug 2011 23:01:38 +0200 Subject: [PATCH] Don't check for plugin errors at startup --- python/plugins/plugin_installer/installer_data.py | 15 ++++++++------- python/plugins/plugin_installer/installer_gui.py | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/python/plugins/plugin_installer/installer_data.py b/python/plugins/plugin_installer/installer_data.py index 868bfd6de6a..475a60f227f 100755 --- a/python/plugins/plugin_installer/installer_data.py +++ b/python/plugins/plugin_installer/installer_data.py @@ -511,7 +511,7 @@ class Plugins(QObject): # ----------------------------------------- # - def getInstalledPlugin(self, key, readOnly): + def getInstalledPlugin(self, key, readOnly, testLoad=False): """ get the metadata of an installed plugin """ if readOnly: path = QgsApplication.pkgDataPath() @@ -557,10 +557,11 @@ class Plugins(QObject): errorDetails = qgisMinimumVersion except: pass - try: - exec ("%s.classFactory(iface)" % key) - except Exception, error: - error = unicode(error.args[0]) + if testLoad: + try: + exec ("%s.classFactory(iface)" % key) + except Exception, error: + error = unicode(error.args[0]) except Exception, error: error = unicode(error.args[0]) @@ -596,7 +597,7 @@ class Plugins(QObject): # ----------------------------------------- # - def getAllInstalled(self): + def getAllInstalled(self, testLoad=False): """ Build the localCache """ self.localCache = {} # first, try to add the read-only plugins... @@ -625,7 +626,7 @@ class Plugins(QObject): for key in pluginDir.entryList(): key = unicode(key) if not key in [".",".."]: - plugin = self.getInstalledPlugin(key, False) + plugin = self.getInstalledPlugin(key, False, testLoad) if key in self.localCache.keys() and compareVersions(self.localCache[key]["version_inst"],plugin["version_inst"]) == 1: # An obsolete plugin in the "user" location is masking a newer one in the "system" location! self.obsoletePlugins += [key] diff --git a/python/plugins/plugin_installer/installer_gui.py b/python/plugins/plugin_installer/installer_gui.py index b029a005343..63180bca87f 100755 --- a/python/plugins/plugin_installer/installer_gui.py +++ b/python/plugins/plugin_installer/installer_gui.py @@ -528,10 +528,10 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialogBase): n +=1 self.setWindowTitle(self.tr("QGIS Python Plugin Installer") + self.tr(" - %d plugins available" % len(plugins.all()))) self.buttonUpgradeAll.setEnabled( len(self.upgradeablePlugins) ) - + # initially, keep insert order self.treePlugins.sortItems(100,Qt.AscendingOrder) - + # resize the columns for i in [0,1,2,3,4,5]: self.treePlugins.resizeColumnToContents(i) @@ -630,7 +630,7 @@ class QgsPluginInstallerDialog(QDialog, Ui_QgsPluginInstallerDialogBase): exec ("reload (%s)" % plugin["localdir"]) except: pass - plugins.getAllInstalled() + plugins.getAllInstalled(testLoad=True) plugins.rebuild() plugin = plugins.all()[key] if not plugin["error"]: