Skip to content
Permalink
Browse files
Plugin installer fixes: fix error when uninstalling installer itself,…
… support for <disabled> repo tag, remove my repository

git-svn-id: http://svn.osgeo.org/qgis/trunk@13830 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
borysiasty committed Jun 28, 2010
1 parent b98a7ba commit e6507adc78c8bfb97dc3efc52acb90dd221fdbcc
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Copyright (C) 2007-2008 Matthew Perry
Copyright (C) 2008-2009 Borys Jurgiel
Copyright (C) 2008-2010 Borys Jurgiel
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
@@ -15,7 +15,7 @@ def name():
return "Plugin Installer"

def version():
return "Version 1.0.11"
return "Version 1.0.12"

def description():
return "Downloads and installs QGIS python plugins"
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Copyright (C) 2007-2008 Matthew Perry
Copyright (C) 2008-2009 Borys Jurgiel
Copyright (C) 2008-2010 Borys Jurgiel
/***************************************************************************
* *
@@ -83,7 +83,7 @@ def setIface(qgisIface):
officialRepo = ("QGIS Official Repository", "http://pyqgis.org/repo/official","")
contribRepo = ("QGIS Contributed Repository", "http://pyqgis.org/repo/contributed","")
authorRepos = [("Carson Farmer's Repository", "http://www.ftools.ca/cfarmerQgisRepo.xml", "http://www.ftools.ca/cfarmerQgisRepo_0.xx.xml"),
("Borys Jurgiel's Repository", "http://bwj.aster.net.pl/qgis/plugins.xml", "http://bwj.aster.net.pl/qgis-oldapi/plugins.xml"),
# depreciated: ("Borys Jurgiel's Repository", "http://bwj.aster.net.pl/qgis/plugins.xml", "http://bwj.aster.net.pl/qgis-oldapi/plugins.xml"),
("Faunalia Repository", "http://www.faunalia.it/qgis/plugins.xml", "http://faunalia.it/qgis/plugins.xml"),
("Martin Dobias' Sandbox", "http://mapserver.sk/~wonder/qgis/plugins-sandbox.xml", ""),
("Aaron Racicot's Repository", "http://qgisplugins.z-pulley.com", ""),
@@ -456,7 +456,8 @@ def xmlDownloaded(self,nr,state):
qgisMaximumVersion = pluginNodes.item(i).firstChildElement("qgis_maximum_version").text().simplified()
if not qgisMaximumVersion: qgisMaximumVersion = "2"
#if compatible, add the plugin to the list
if compareVersions(QGIS_VER, qgisMinimumVersion) < 2 and compareVersions(qgisMaximumVersion, QGIS_VER) < 2:
if not pluginNodes.item(i).firstChildElement("disabled").text().simplified().toUpper() in ["TRUE","YES"]:
if compareVersions(QGIS_VER, qgisMinimumVersion) < 2 and compareVersions(qgisMaximumVersion, QGIS_VER) < 2:
if QGIS_VER[0]==qgisMinimumVersion[0] or name=="plugin_installer" or (qgisMinimumVersion!="0" and qgisMaximumVersion!="2"):
#add the plugin to the cache
plugins.addFromRepository(plugin)
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Copyright (C) 2007-2008 Matthew Perry
Copyright (C) 2008-2009 Borys Jurgiel
Copyright (C) 2008-2010 Borys Jurgiel
/***************************************************************************
* *
@@ -27,7 +27,7 @@

try:
from qgis.utils import startPlugin, unloadPlugin, loadPlugin # QGIS >= 1.4
from qgis.utils import updateAvailablePlugins # QGIS >= 1.5
from qgis.utils import reloadPlugin, updateAvailablePlugins # QGIS >= 1.5
except Exception:
pass

@@ -676,11 +676,24 @@ def uninstallPlugin(self):
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:
return
# unload the plugin if it's not plugin_installer itself (otherwise, do it after removing its directory):
if key != "plugin_installer":
try:
unloadPlugin(key)
except:
pass
pluginDir = QFileInfo(QgsApplication.qgisUserDbFilePath()).path() + "/python/plugins/" + plugin["localdir"]
result = removeDir(pluginDir)
if result:
QMessageBox.warning(self, self.tr("Plugin uninstall failed"), result)
else:
# if the uninstalled plugin is the installer itself, reload it and quit
if key == "plugin_installer":
try:
reloadPlugin(key)
return
except:
pass
# safe remove
try:
unloadPlugin(plugin["localdir"])
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Copyright (C) 2007-2008 Matthew Perry
Copyright (C) 2008-2009 Borys Jurgiel
Copyright (C) 2008-2010 Borys Jurgiel
/***************************************************************************
* *
@@ -128,6 +128,7 @@ def unload(self):
self.mainWindow().menuBar().actions()[4].menu().removeAction(self.action)
if self.statusLabel:
self.mainWindow().statusBar().removeWidget(self.statusLabel)
self.guiDlg.close()


# ----------------------------------------- #
@@ -14,7 +14,7 @@
<property name="minimumSize">
<size>
<width>480</width>
<height>150</height>
<height>182</height>
</size>
</property>
<property name="windowTitle">

0 comments on commit e6507ad

Please sign in to comment.