Skip to content

Commit f8f4e83

Browse files
author
borysiasty
committed
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/qgis@13830 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5b2446a commit f8f4e83

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

python/plugins/plugin_installer/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""
33
Copyright (C) 2007-2008 Matthew Perry
4-
Copyright (C) 2008-2009 Borys Jurgiel
4+
Copyright (C) 2008-2010 Borys Jurgiel
55
/***************************************************************************
66
* *
77
* This program is free software; you can redistribute it and/or modify *
@@ -15,7 +15,7 @@ def name():
1515
return "Plugin Installer"
1616

1717
def version():
18-
return "Version 1.0.11"
18+
return "Version 1.0.12"
1919

2020
def description():
2121
return "Downloads and installs QGIS python plugins"

python/plugins/plugin_installer/installer_data.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""
33
Copyright (C) 2007-2008 Matthew Perry
4-
Copyright (C) 2008-2009 Borys Jurgiel
4+
Copyright (C) 2008-2010 Borys Jurgiel
55
66
/***************************************************************************
77
* *
@@ -83,7 +83,7 @@ def setIface(qgisIface):
8383
officialRepo = ("QGIS Official Repository", "http://pyqgis.org/repo/official","")
8484
contribRepo = ("QGIS Contributed Repository", "http://pyqgis.org/repo/contributed","")
8585
authorRepos = [("Carson Farmer's Repository", "http://www.ftools.ca/cfarmerQgisRepo.xml", "http://www.ftools.ca/cfarmerQgisRepo_0.xx.xml"),
86-
("Borys Jurgiel's Repository", "http://bwj.aster.net.pl/qgis/plugins.xml", "http://bwj.aster.net.pl/qgis-oldapi/plugins.xml"),
86+
# depreciated: ("Borys Jurgiel's Repository", "http://bwj.aster.net.pl/qgis/plugins.xml", "http://bwj.aster.net.pl/qgis-oldapi/plugins.xml"),
8787
("Faunalia Repository", "http://www.faunalia.it/qgis/plugins.xml", "http://faunalia.it/qgis/plugins.xml"),
8888
("Martin Dobias' Sandbox", "http://mapserver.sk/~wonder/qgis/plugins-sandbox.xml", ""),
8989
("Aaron Racicot's Repository", "http://qgisplugins.z-pulley.com", ""),
@@ -456,7 +456,8 @@ def xmlDownloaded(self,nr,state):
456456
qgisMaximumVersion = pluginNodes.item(i).firstChildElement("qgis_maximum_version").text().simplified()
457457
if not qgisMaximumVersion: qgisMaximumVersion = "2"
458458
#if compatible, add the plugin to the list
459-
if compareVersions(QGIS_VER, qgisMinimumVersion) < 2 and compareVersions(qgisMaximumVersion, QGIS_VER) < 2:
459+
if not pluginNodes.item(i).firstChildElement("disabled").text().simplified().toUpper() in ["TRUE","YES"]:
460+
if compareVersions(QGIS_VER, qgisMinimumVersion) < 2 and compareVersions(qgisMaximumVersion, QGIS_VER) < 2:
460461
if QGIS_VER[0]==qgisMinimumVersion[0] or name=="plugin_installer" or (qgisMinimumVersion!="0" and qgisMaximumVersion!="2"):
461462
#add the plugin to the cache
462463
plugins.addFromRepository(plugin)

python/plugins/plugin_installer/installer_gui.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""
33
Copyright (C) 2007-2008 Matthew Perry
4-
Copyright (C) 2008-2009 Borys Jurgiel
4+
Copyright (C) 2008-2010 Borys Jurgiel
55
66
/***************************************************************************
77
* *
@@ -27,7 +27,7 @@
2727

2828
try:
2929
from qgis.utils import startPlugin, unloadPlugin, loadPlugin # QGIS >= 1.4
30-
from qgis.utils import updateAvailablePlugins # QGIS >= 1.5
30+
from qgis.utils import reloadPlugin, updateAvailablePlugins # QGIS >= 1.5
3131
except Exception:
3232
pass
3333

@@ -676,11 +676,24 @@ def uninstallPlugin(self):
676676
warning += "\n\n"+self.tr("Warning: this plugin isn't available in any accessible repository!")
677677
if QMessageBox.warning(self, self.tr("QGIS Python Plugin Installer"), warning , QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
678678
return
679+
# unload the plugin if it's not plugin_installer itself (otherwise, do it after removing its directory):
680+
if key != "plugin_installer":
681+
try:
682+
unloadPlugin(key)
683+
except:
684+
pass
679685
pluginDir = QFileInfo(QgsApplication.qgisUserDbFilePath()).path() + "/python/plugins/" + plugin["localdir"]
680686
result = removeDir(pluginDir)
681687
if result:
682688
QMessageBox.warning(self, self.tr("Plugin uninstall failed"), result)
683689
else:
690+
# if the uninstalled plugin is the installer itself, reload it and quit
691+
if key == "plugin_installer":
692+
try:
693+
reloadPlugin(key)
694+
return
695+
except:
696+
pass
684697
# safe remove
685698
try:
686699
unloadPlugin(plugin["localdir"])

python/plugins/plugin_installer/installer_plugin.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""
33
Copyright (C) 2007-2008 Matthew Perry
4-
Copyright (C) 2008-2009 Borys Jurgiel
4+
Copyright (C) 2008-2010 Borys Jurgiel
55
66
/***************************************************************************
77
* *
@@ -128,6 +128,7 @@ def unload(self):
128128
self.mainWindow().menuBar().actions()[4].menu().removeAction(self.action)
129129
if self.statusLabel:
130130
self.mainWindow().statusBar().removeWidget(self.statusLabel)
131+
self.guiDlg.close()
131132

132133

133134
# ----------------------------------------- #

python/plugins/plugin_installer/qgsplugininstalleroldreposbase.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<property name="minimumSize">
1515
<size>
1616
<width>480</width>
17-
<height>150</height>
17+
<height>182</height>
1818
</size>
1919
</property>
2020
<property name="windowTitle">

0 commit comments

Comments
 (0)