diff --git a/python/plugins/plugin_installer/__init__.py b/python/plugins/plugin_installer/__init__.py index e205216285b7..73821487cd93 100644 --- a/python/plugins/plugin_installer/__init__.py +++ b/python/plugins/plugin_installer/__init__.py @@ -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" diff --git a/python/plugins/plugin_installer/installer_data.py b/python/plugins/plugin_installer/installer_data.py index 2852d08d7dc4..7220f083d677 100644 --- a/python/plugins/plugin_installer/installer_data.py +++ b/python/plugins/plugin_installer/installer_data.py @@ -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) diff --git a/python/plugins/plugin_installer/installer_gui.py b/python/plugins/plugin_installer/installer_gui.py index 9b9719313043..1bc2d1f95b78 100644 --- a/python/plugins/plugin_installer/installer_gui.py +++ b/python/plugins/plugin_installer/installer_gui.py @@ -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) """ diff --git a/python/plugins/plugin_installer/installer_plugin.py b/python/plugins/plugin_installer/installer_plugin.py index 621bf770bb45..578c92f2cefc 100644 --- a/python/plugins/plugin_installer/installer_plugin.py +++ b/python/plugins/plugin_installer/installer_plugin.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Copyright (C) 2007-2008 Matthew Perry Copyright (C) 2008-2009 Borys Jurgiel diff --git a/python/plugins/plugin_installer/qgsplugininstallerbase.ui b/python/plugins/plugin_installer/qgsplugininstallerbase.ui index 6b2d269e82e1..1c1e14e7a977 100644 --- a/python/plugins/plugin_installer/qgsplugininstallerbase.ui +++ b/python/plugins/plugin_installer/qgsplugininstallerbase.ui @@ -1,8 +1,9 @@ - + + Matthew Perry, Borys Jurgiel QgsPluginInstallerDialogBase - - + + 0 0 @@ -10,135 +11,175 @@ 382 - + QGIS Python Plugin Installer - - :/plugins/installer/qgis-icon.png + + + :/plugins/installer/qgis-icon.png:/plugins/installer/qgis-icon.png - + QGIS Python Plugin Installer - - - + + + - - + + + Help + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + - + The plugins will be installed to ~/.qgis/python/plugins - - - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 0 0 - + Close the Installer window - + Close the Installer window - + Close - - - + + + - + - + 0 - - + + Plugins - + List of available and installed plugins - + - + - - + + true - + Filter: + + lineFilter + - - + + true - + Display only plugins containing this word in their metadata - + Display only plugins containing this word in their metadata - - + + true - - + + 0 0 - + Display only plugins from given repository - + - + Display only plugins from given repository - + all repositories - - + + true - - + + 0 0 - + Display only plugins with matching status - + Display only plugins with matching status @@ -146,62 +187,62 @@ - - + + true - + false - + false - + true - + true - + Status - + Name - + Version - + Description - + Author - + Repository - + - + Qt::Horizontal - + 40 20 @@ -210,42 +251,42 @@ - - - + + + 0 0 - + 160 0 - + Install, reinstall or upgrade the selected plugin - + Install, reinstall or upgrade the selected plugin - + Install/upgrade plugin - - + + true - + Uninstall the selected plugin - + Uninstall the selected plugin - + Uninstall plugin @@ -254,48 +295,48 @@ - - + + Repositories - + List of plugin repositories - - - - + + + + false - + false - + Status - + Name - + URL - + - + Qt::Horizontal - + QSizePolicy::Preferred - + 20 20 @@ -303,28 +344,28 @@ - - - + + + true - + Add third party plugin repositories to the list - + Add third party plugin repositories to the list - + Add 3rd party repositories - + - + Qt::Horizontal - + 40 20 @@ -332,119 +373,119 @@ - - - + + + Add a new plugin repository - + Add a new plugin repository - + Add... - - - + + + Edit the selected repository - + Edit the selected repository - + Edit... - - - + + + Remove the selected repository - + Remove the selected repository - + Delete - - + + Options - + Configuration of the plugin installer - + - - + + true - - + + 0 0 - + Check for updates on startup - + true - + false - - - + + + - + every time QGIS starts - + once a day - + every 3 days - + every week - + every 2 weeks - + every month - - - + + + Qt::Vertical - + QSizePolicy::Fixed - + 20 10 @@ -452,22 +493,22 @@ - - - - + + + + 0 0 - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Note:</span> If this function is enabled, Quantum GIS will inform you whenever a new plugin or plugin update is available. Otherwise, fetching repositories will be performed during opening of the Plugin Installer window.</p></body></html> +</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Note:</span> If this function is enabled, Quantum GIS will inform you whenever a new plugin or plugin update is available. Otherwise, fetching repositories will be performed during opening of the Plugin Installer window.</p></body></html> - + true @@ -476,81 +517,81 @@ p, li { white-space: pre-wrap; } - - - + + + 0 1 - + Allowed plugins - - - - + + + + false - + Only show plugins from the official repository - + true - - - + + + false - + Show all plugins except those marked as experimental - + false - - - + + + false - + Show all plugins, even those marked as experimental - - - - + + + + 0 0 - + 0 75 - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Note:</span> Experimental plugins are generally unsuitable for production use. These plugins are in early stages of development, and should be considered 'incomplete' or 'proof of concept' tools. QGIS does not recommend installing these plugins unless you intend to use them for testing purposes.</p></body></html> +</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Note:</span> Experimental plugins are generally unsuitable for production use. These plugins are in early stages of development, and should be considered 'incomplete' or 'proof of concept' tools. QGIS does not recommend installing these plugins unless you intend to use them for testing purposes.</p></body></html> - + Qt::RichText - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - + true @@ -573,6 +614,7 @@ p, li { white-space: pre-wrap; } buttonInstall buttonUninstall buttonClose + buttonHelp treeRepositories buttonFetchRepositories buttonAddRep @@ -585,7 +627,7 @@ p, li { white-space: pre-wrap; } radioPluginType2 - + @@ -594,11 +636,11 @@ p, li { white-space: pre-wrap; } QgsPluginInstallerDialogBase close() - - 710 - 447 + + 790 + 372 - + 380 235 diff --git a/python/utils.py b/python/utils.py index 6a888853de32..da6ed1baa4a9 100644 --- a/python/utils.py +++ b/python/utils.py @@ -159,6 +159,6 @@ def unloadPlugin(packageName): del plugins[packageName] return True except Exception, e: - errMsg = QCoreApplication.translate("Python", "Error while unloading plugin %1").arg(packageName) + msg = QCoreApplication.translate("Python", "Error while unloading plugin %1").arg(packageName) showException(sys.exc_type, sys.exc_value, sys.exc_traceback, msg) return False