[QGIS Commit] r13086 - trunk/qgis/python/plugins/plugin_installer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Mar 19 11:24:08 EDT 2010


Author: borysiasty
Date: 2010-03-19 11:24:04 -0400 (Fri, 19 Mar 2010)
New Revision: 13086

Modified:
   trunk/qgis/python/plugins/plugin_installer/installer_data.py
   trunk/qgis/python/plugins/plugin_installer/installer_gui.py
Log:
Patch #2422 applied

Modified: trunk/qgis/python/plugins/plugin_installer/installer_data.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_data.py	2010-03-19 14:04:37 UTC (rev 13085)
+++ trunk/qgis/python/plugins/plugin_installer/installer_data.py	2010-03-19 15:24:04 UTC (rev 13086)
@@ -58,10 +58,12 @@
   else:
     QGIS_MAJOR_VER = 0
   QGIS_14 = False
+  QGIS_15 = False
 except:
   QGIS_VER = QGis.QGIS_VERSION
   QGIS_MAJOR_VER = 1
   QGIS_14 = (QGIS_VER[2] > 3)
+  QGIS_15 = (QGIS_VER[2] > 4)
 
 
 

Modified: trunk/qgis/python/plugins/plugin_installer/installer_gui.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_gui.py	2010-03-19 14:04:37 UTC (rev 13085)
+++ trunk/qgis/python/plugins/plugin_installer/installer_gui.py	2010-03-19 15:24:04 UTC (rev 13086)
@@ -26,7 +26,8 @@
 from installer_data import *
 
 try:
-  from qgis.utils import startPlugin, unloadPlugin
+  from qgis.utils import startPlugin, unloadPlugin, loadPlugin # QGIS >= 1.4
+  from qgis.utils import updateAvailablePlugins # QGIS >= 1.5
 except Exception:
   pass
 
@@ -592,28 +593,31 @@
       plugins.rebuild()
       QApplication.restoreOverrideCursor()
     else:
-      try:
-        exec ("sys.path_importer_cache.clear()")
-        exec ("import %s" % plugin["localdir"])
-        exec ("reload (%s)" % plugin["localdir"])
-      except:
-        pass
+      if QGIS_14:
+        if QGIS_15: # update the list of plugins in plugin handling routines
+          updateAvailablePlugins()
+        # try to load the plugin
+        loadPlugin(plugin["localdir"])
+      else: # QGIS < 1.4
+        try:
+          exec ("sys.path_importer_cache.clear()")
+          exec ("import %s" % plugin["localdir"])
+          exec ("reload (%s)" % plugin["localdir"])
+        except:
+          pass
       plugins.getAllInstalled()
       plugins.rebuild()
       plugin = plugins.all()[key]
       if not plugin["error"]:
         if previousStatus in ["not installed", "new"]:
-          if QGIS_14: 
+          if QGIS_14: # plugins can be started in python from QGIS >= 1.4
             infoString = (self.tr("Plugin installed successfully"), self.tr("Plugin installed successfully"))
             settings = QSettings()
             settings.setValue("/PythonPlugins/"+plugin["localdir"], QVariant(True))
+            startPlugin(plugin["localdir"])
           else: infoString = (self.tr("Plugin installed successfully"), self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
         else:
           infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
-        try:
-          startPlugin(plugin["localdir"])
-        except:
-          pass
       else:
         if plugin["error"] == "incompatible":
           message = self.tr("The plugin is designed for a newer version of Quantum GIS. The minimum required version is:")



More information about the QGIS-commit mailing list