Skip to content

Commit d98b6ae

Browse files
author
borysiasty
committedMar 19, 2010
Patch #2422 applied
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13086 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed
 

‎python/plugins/plugin_installer/installer_data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@
5858
else:
5959
QGIS_MAJOR_VER = 0
6060
QGIS_14 = False
61+
QGIS_15 = False
6162
except:
6263
QGIS_VER = QGis.QGIS_VERSION
6364
QGIS_MAJOR_VER = 1
6465
QGIS_14 = (QGIS_VER[2] > 3)
66+
QGIS_15 = (QGIS_VER[2] > 4)
6567

6668

6769

‎python/plugins/plugin_installer/installer_gui.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
from installer_data import *
2727

2828
try:
29-
from qgis.utils import startPlugin, unloadPlugin
29+
from qgis.utils import startPlugin, unloadPlugin, loadPlugin # QGIS >= 1.4
30+
from qgis.utils import updateAvailablePlugins # QGIS >= 1.5
3031
except Exception:
3132
pass
3233

@@ -592,28 +593,31 @@ def installPlugin(self):
592593
plugins.rebuild()
593594
QApplication.restoreOverrideCursor()
594595
else:
595-
try:
596-
exec ("sys.path_importer_cache.clear()")
597-
exec ("import %s" % plugin["localdir"])
598-
exec ("reload (%s)" % plugin["localdir"])
599-
except:
600-
pass
596+
if QGIS_14:
597+
if QGIS_15: # update the list of plugins in plugin handling routines
598+
updateAvailablePlugins()
599+
# try to load the plugin
600+
loadPlugin(plugin["localdir"])
601+
else: # QGIS < 1.4
602+
try:
603+
exec ("sys.path_importer_cache.clear()")
604+
exec ("import %s" % plugin["localdir"])
605+
exec ("reload (%s)" % plugin["localdir"])
606+
except:
607+
pass
601608
plugins.getAllInstalled()
602609
plugins.rebuild()
603610
plugin = plugins.all()[key]
604611
if not plugin["error"]:
605612
if previousStatus in ["not installed", "new"]:
606-
if QGIS_14:
613+
if QGIS_14: # plugins can be started in python from QGIS >= 1.4
607614
infoString = (self.tr("Plugin installed successfully"), self.tr("Plugin installed successfully"))
608615
settings = QSettings()
609616
settings.setValue("/PythonPlugins/"+plugin["localdir"], QVariant(True))
617+
startPlugin(plugin["localdir"])
610618
else: infoString = (self.tr("Plugin installed successfully"), self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
611619
else:
612620
infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
613-
try:
614-
startPlugin(plugin["localdir"])
615-
except:
616-
pass
617621
else:
618622
if plugin["error"] == "incompatible":
619623
message = self.tr("The plugin is designed for a newer version of Quantum GIS. The minimum required version is:")

0 commit comments

Comments
 (0)
Please sign in to comment.