Skip to content
Permalink
Browse files

Plugin installer update: one-step plugin install and uninstall in QGI…

…S>=1.4

git-svn-id: http://svn.osgeo.org/qgis/trunk@12476 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
borysiasty
borysiasty committed Dec 15, 2009
1 parent fc2e019 commit a13ce526177c9678b66af5e094f3c49664a166c4
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
Copyright (C) 2007-2008 Matthew Perry
Copyright (C) 2008-2009 Borys Jurgiel
@@ -14,7 +15,7 @@ def name():
return "Plugin Installer"

def version():
return "Version 1.0.5"
return "Version 1.0.6"

def description():
return "Downloads and installs QGIS python plugins"
@@ -57,9 +57,11 @@
QGIS_MAJOR_VER = 1
else:
QGIS_MAJOR_VER = 0
QGIS_14 = False
except:
QGIS_VER = QGis.QGIS_VERSION
QGIS_MAJOR_VER = 1
QGIS_14 = (QGIS_VER[2] > 3)



@@ -25,6 +25,10 @@
from ui_qgsplugininstallerbase import Ui_QgsPluginInstallerDialogBase
from installer_data import *

try:
from qgis.utils import startPlugin, unloadPlugin
except Exception:
pass


# --- common functions ------------------------------------------------------------------- #
@@ -259,6 +263,8 @@ def __init__(self, parent, fl):
self.connect(self.buttonUninstall, SIGNAL("clicked()"), self.uninstallPlugin)
self.buttonInstall.setEnabled(False)
self.buttonUninstall.setEnabled(False)
self.buttonHelp.setEnabled(QGIS_14)
self.connect(self.buttonHelp, SIGNAL("clicked()"), self.runHelp)
# repositories handling
self.connect(self.treeRepositories, SIGNAL("doubleClicked(QModelIndex)"), self.editRepository)
self.connect(self.buttonFetchRepositories, SIGNAL("clicked()"), self.addKnownRepositories)
@@ -593,9 +599,11 @@ def installPlugin(self):
plugin = plugins.all()[key]
if not plugin["error"]:
if previousStatus in ["not installed", "new"]:
infoString = (self.tr("Plugin installed successfully"), self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
if QGIS_14: infoString = (self.tr("Plugin installed successfully"), self.tr("Plugin installed successfully"))
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."))
startPlugin(plugin["localdir"])
else:
if plugin["error"] == "incompatible":
message = self.tr("The plugin is designed for a newer version of Quantum GIS. The minimum required version is:")
@@ -649,7 +657,7 @@ def uninstallPlugin(self):
plugin = plugins.all()[key]
if not plugin:
return
warning = self.tr("Are you sure you want to uninstall the following plugin?") + "\n" + plugin["name"]
warning = self.tr("Are you sure you want to uninstall the following plugin?") + "\n(" + plugin["name"] + ")"
if plugin["status"] == "orphan" and not plugin["error"]:
warning += "\n\n"+self.tr("Warning: this plugin isn't available in any accessible repository!")
if QMessageBox.warning(self, self.tr("QGIS Python Plugin Installer"), warning , QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
@@ -660,6 +668,10 @@ def uninstallPlugin(self):
QMessageBox.warning(self, self.tr("Plugin uninstall failed"), result)
else:
# safe remove
try:
unloadPlugin(plugin["localdir"])
except:
pass
try:
exec ("plugins[%s].unload()" % plugin["localdir"])
exec ("del plugins[%s]" % plugin["localdir"])
@@ -672,7 +684,8 @@ def uninstallPlugin(self):
plugins.getAllInstalled()
plugins.rebuild()
self.populatePluginTree()
QMessageBox.information(self, self.tr("Plugin uninstalled successfully"), self.tr("Python plugin uninstalled. Note that you may need to restart Quantum GIS in order to remove it completely."))
if QGIS_14: QMessageBox.information(self, self.tr("Plugin uninstalled successfully"), self.tr("Plugin uninstalled successfully"))
else: QMessageBox.information(self, self.tr("Plugin uninstalled successfully"), self.tr("Python plugin uninstalled. Note that you may need to restart Quantum GIS in order to remove it completely."))
history.markChange(key,'D')


@@ -834,6 +847,12 @@ def deleteRepository(self):
self.populatePluginTree()


# ----------------------------------------- #
def runHelp(self):
""" open the context help browser """
QgsContextHelp.run("QgsPluginInstallerDialog")


# ----------------------------------------- #
def reject(self):
""" update the list of seen plugins before exit (both 'done' and 'x' buttons emit 'reject' signal) """
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
Copyright (C) 2007-2008 Matthew Perry
Copyright (C) 2008-2009 Borys Jurgiel

0 comments on commit a13ce52

Please sign in to comment.
You can’t perform that action at this time.