Skip to content

Commit

Permalink
Patch #2422 applied
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13086 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
borysiasty committed Mar 19, 2010
1 parent 0a4f8f4 commit d98b6ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 2 additions & 0 deletions python/plugins/plugin_installer/installer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)



Expand Down
28 changes: 16 additions & 12 deletions python/plugins/plugin_installer/installer_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -592,28 +593,31 @@ def installPlugin(self):
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:")
Expand Down

0 comments on commit d98b6ae

Please sign in to comment.