Skip to content

Commit fa2f889

Browse files
author
mhugent
committedApr 6, 2009
Merge vector overlay branch (diagram plugin)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10484 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

97 files changed

+19566
-73
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+19566
-73
lines changed
 

‎python/plugins/plugin_installer/installer_gui.py

Lines changed: 34 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,10 @@ def installPlugin(self):
571571
if plugin["status"] == "newer" and not plugin["error"]: # ask for confirmation if user downgrades an usable plugin
572572
if QMessageBox.warning(self, self.tr("QGIS Python Plugin Installer"), self.tr("Are you sure you want to downgrade the plugin to the latest available version? The installed one is newer!"), QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
573573
return
574+
if plugin["status"] == "newer":
575+
if QMessageBox.warning(self, self.tr("QGIS Python Plugin Installer"), self.tr("Are you sure you want to downgrade the plugin to the latest available version? The installed one is newer!"), QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
576+
return
577+
574578
dlg = QgsPluginInstallerInstallingDialog(self,plugin)
575579
dlg.exec_()
576580

@@ -582,58 +586,38 @@ def installPlugin(self):
582586
self.getAllAvailablePlugins()
583587
QApplication.restoreOverrideCursor()
584588
else:
585-
try:
586-
exec ("sys.path_importer_cache.clear()")
587-
exec ("import %s" % plugin["localdir"])
588-
exec ("reload (%s)" % plugin["localdir"])
589-
except:
590-
pass
591-
plugins.updatePlugin(key, False)
592-
plugin = plugins.all()[key]
593-
if not plugin["error"]:
594-
if previousStatus in ["not installed", "new"]:
595-
infoString = (self.tr("Plugin installed successfully"),
596-
self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
597-
else:
598-
infoString = (self.tr("Plugin reinstalled successfully"),
599-
self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
589+
590+
path = QDir.cleanPath(QgsApplication.qgisSettingsDirPath() + "/python/plugins/" + key)
591+
if not QDir(path).exists():
592+
infoString = (self.tr("Plugin has disappeared"), self.tr("The plugin seems to have been installed but I don't know where. Probably the plugin package contained a wrong named directory.\nPlease search the list of installed plugins. I'm nearly sure you'll find the plugin there, but I just can't determine which of them it is. It also means that I won't be able to determine if this plugin is installed and inform you about available updates. However the plugin may work. Please contact the plugin author and submit this issue."))
593+
QApplication.setOverrideCursor(Qt.WaitCursor)
594+
self.getAllAvailablePlugins()
595+
QApplication.restoreOverrideCursor()
600596
else:
601-
if plugin["error"] == "incompatible":
602-
message = self.tr("The plugin is designed for a newer version of Quantum GIS. The minimum required version is:")
603-
message += " <b>" + plugin["error_details"] + "</b>"
604-
elif plugin["error"] == "dependent":
605-
message = self.tr("The plugin depends on some components missing on your system. You need to install the following Python module in order to enable it:")
606-
message += "<b> " + plugin["error_details"] + "</b>"
607-
else:
608-
message = self.tr("The plugin is broken. Python said:")
609-
message += "<br><b>" + plugin["error_details"] + "</b>"
610-
dlg = QgsPluginInstallerPluginErrorDialog(self,message)
611-
dlg.exec_()
612-
if dlg.result():
613-
# revert installation
614-
plugins.setPluginData(key, "status", "not installed")
615-
plugins.setPluginData(key, "version_inst", "")
616-
plugins.setPluginData(key, "desc_local", "")
617-
plugins.setPluginData(key, "error", "")
618-
plugins.setPluginData(key, "error_details", "")
619-
pluginDir = QFileInfo(QgsApplication.qgisUserDbFilePath()).path() + "/python/plugins/" + plugin["localdir"]
620-
removeDir(pluginDir)
621-
if QDir(pluginDir).exists():
622-
infoString = (self.tr("Plugin uninstall failed"), result)
623-
try:
624-
exec ("sys.path_importer_cache.clear()")
625-
exec ("import %s" % plugin["localdir"])
626-
exec ("reload (%s)" % plugin["localdir"])
627-
except:
628-
pass
629-
plugins.updatePlugin(key, False)
597+
try:
598+
exec ("sys.path_importer_cache.clear()")
599+
exec ("del sys.modules[%s]" % plugin["localdir"]) # remove old version if exist
600+
except:
601+
pass
602+
try:
603+
exec ("import %s" % plugin["localdir"])
604+
exec ("reload (%s)" % plugin["localdir"])
605+
if plugin["status"] == "not installed" or plugin["status"] == "new":
606+
infoString = (self.tr("Plugin installed successfully"), self.tr("Python plugin installed.\nYou have to enable it in the Plugin Manager."))
630607
else:
631-
try:
632-
exec ("del sys.modules[%s]" % plugin["localdir"])
633-
except:
634-
pass
635-
if not plugin["repository"]:
636-
plugins.remove(key)
608+
infoString = (self.tr("Plugin installed successfully"),self.tr("Python plugin reinstalled.\nYou have to restart Quantum GIS to reload it."))
609+
except Exception, error:
610+
dlg = QgsPluginInstallerPluginErrorDialog(self,error.message)
611+
dlg.exec_()
612+
if dlg.result():
613+
pluginDir = unicode(QFileInfo(QgsApplication.qgisUserDbFilePath()).path()+"/python/plugins/"+ str(plugin["localdir"]))
614+
result = removeDir(pluginDir)
615+
if result:
616+
QMessageBox.warning(self, self.tr("Plugin uninstall failed"), result)
617+
plugins.updatePlugin(key, False)
618+
self.populatePluginTree()
619+
return
620+
plugins.updatePlugin(key, False)
637621
self.populatePluginTree()
638622
if infoString[0]:
639623
QMessageBox.information(self, infoString[0], infoString[1])

‎src/app/qgisapp.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4367,8 +4367,6 @@ void QgisApp::loadPythonSupport()
43674367
}
43684368
}
43694369

4370-
4371-
43724370
void QgisApp::checkQgisVersion()
43734371
{
43744372
QApplication::setOverrideCursor( Qt::WaitCursor );

0 commit comments

Comments
 (0)
Please sign in to comment.