[QGIS Commit] r14471 - trunk/qgis/python/plugins/plugin_installer
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun Oct 31 19:36:26 EDT 2010
Author: borysiasty
Date: 2010-10-31 16:36:26 -0700 (Sun, 31 Oct 2010)
New Revision: 14471
Modified:
trunk/qgis/python/plugins/plugin_installer/__init__.py
trunk/qgis/python/plugins/plugin_installer/installer_data.py
trunk/qgis/python/plugins/plugin_installer/installer_gui.py
trunk/qgis/python/plugins/plugin_installer/installer_plugin.py
Log:
Plugin installer update
Modified: trunk/qgis/python/plugins/plugin_installer/__init__.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/__init__.py 2010-10-31 22:54:26 UTC (rev 14470)
+++ trunk/qgis/python/plugins/plugin_installer/__init__.py 2010-10-31 23:36:26 UTC (rev 14471)
@@ -15,13 +15,13 @@
return "Plugin Installer"
def version():
- return "Version 1.0.12"
+ return "Version 1.1"
def description():
return "Downloads and installs QGIS python plugins"
def qgisMinimumVersion():
- return "0.9"
+ return "1.0"
def authorName():
return "Matthew Perry, Borys Jurgiel"
Modified: trunk/qgis/python/plugins/plugin_installer/installer_data.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_data.py 2010-10-31 22:54:26 UTC (rev 14470)
+++ trunk/qgis/python/plugins/plugin_installer/installer_data.py 2010-10-31 23:36:26 UTC (rev 14471)
@@ -51,19 +51,9 @@
"""
-try:
- QGIS_VER = QGis.qgisVersion
- if QGIS_VER[0] == "1":
- QGIS_MAJOR_VER = 1
- else:
- QGIS_MAJOR_VER = 0
- QGIS_14 = False
- QGIS_15 = False
-except:
- QGIS_VER = QGis.QGIS_VERSION
- QGIS_MAJOR_VER = 1
- QGIS_14 = (QGIS_VER[2] > "3")
- QGIS_15 = (QGIS_VER[2] > "4")
+QGIS_VER = QGis.QGIS_VERSION
+QGIS_14 = (QGIS_VER[2] > "3")
+QGIS_15 = (QGIS_VER[2] > "4")
@@ -79,20 +69,20 @@
# Repositories: (name, url, possible depreciated url)
-oldRepo = ("QGIS 0.x Plugin Repository", "http://spatialserver.net/cgi-bin/pyqgis_plugin.rb","")
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"),
- # 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", ""),
+authorRepos = [("Aaron Racicot's Repository", "http://qgisplugins.z-pulley.com", ""),
("Barry Rowlingson's Repository", "http://www.maths.lancs.ac.uk/~rowlings/Qgis/Plugins/plugins.xml", ""),
- ("Volkan Kepoglu's Repository","http://ggit.metu.edu.tr/~volkan/plugins.xml", ""),
+ # depreciated: ("Bob Bruce's Repository", "http://www.mappinggeek.ca/QGISPythonPlugins/Bobs-QGIS-plugins.xml", ""),
+ # depreciated: ("Borys Jurgiel's Repository", "http://bwj.aster.net.pl/qgis/plugins.xml", "http://bwj.aster.net.pl/qgis-oldapi/plugins.xml"),
+ ("Carson Farmer's Repository", "http://www.ftools.ca/cfarmerQgisRepo.xml", "http://www.ftools.ca/cfarmerQgisRepo_0.xx.xml"),
+ ("CatAIS Repository", "http://www.catais.org/qgis/plugins.xml", ""),
+ ("Faunalia Repository", "http://www.faunalia.it/qgis/plugins.xml", "http://faunalia.it/qgis/plugins.xml"),
("GIS-Lab Repository", "http://gis-lab.info/programs/qgis/qgis-repo.xml", ""),
+ ("Martin Dobias' Sandbox", "http://mapserver.sk/~wonder/qgis/plugins-sandbox.xml", ""),
("Marco Hugentobler's Repository","http://karlinapp.ethz.ch/python_plugins/python_plugins.xml", ""),
- ("Bob Bruce's Repository", "http://www.mappinggeek.ca/QGISPythonPlugins/Bobs-QGIS-plugins.xml", ""),
- ("Sourcepole Repository", "http://build.sourcepole.ch/qgis/plugins.xml", "")]
+ ("Sourcepole Repository", "http://build.sourcepole.ch/qgis/plugins.xml", ""),
+ ("Volkan Kepoglu's Repository","http://ggit.metu.edu.tr/~volkan/plugins.xml", "")]
@@ -205,17 +195,12 @@
settings = QSettings()
settings.beginGroup(reposGroup)
# add the central repositories
- if QGIS_MAJOR_VER: # QGIS 1.x
- if presentURLs.count(officialRepo[1]) == 0:
- settings.setValue(officialRepo[0]+"/url", QVariant(officialRepo[1]))
- settings.setValue(officialRepo[0]+"/enabled", QVariant(True))
- if presentURLs.count(contribRepo[1]) == 0:
- settings.setValue(contribRepo[0]+"/url", QVariant(contribRepo[1]))
- settings.setValue(contribRepo[0]+"/enabled", QVariant(True))
- else: # QGIS 0.x
- if presentURLs.count(oldRepo[1]) == 0:
- settings.setValue(oldRepo[0]+"/url", QVariant(oldRepo[1]))
- settings.setValue(oldRepo[0]+"/enabled", QVariant(True))
+ if presentURLs.count(officialRepo[1]) == 0:
+ settings.setValue(officialRepo[0]+"/url", QVariant(officialRepo[1]))
+ settings.setValue(officialRepo[0]+"/enabled", QVariant(True))
+ if presentURLs.count(contribRepo[1]) == 0:
+ settings.setValue(contribRepo[0]+"/url", QVariant(contribRepo[1]))
+ settings.setValue(contribRepo[0]+"/enabled", QVariant(True))
# add author repositories
for i in authorRepos:
if i[1] and presentURLs.count(i[1]) == 0:
@@ -336,31 +321,20 @@
settings = QSettings()
settings.beginGroup(reposGroup)
# first, update repositories in QSettings if needed
- if QGIS_MAJOR_VER:
- mainRepo = officialRepo
- invalidRepo = oldRepo
- else:
- mainRepo = oldRepo
- invalidRepo = officialRepo
- mainRepoPresent = False
+ officialRepoPresent = False
for key in settings.childGroups():
url = settings.value(key+"/url", QVariant()).toString()
if url == contribRepo[1]:
- if QGIS_MAJOR_VER:
- settings.setValue(key+"/valid", QVariant(True)) # unlock the contrib repo in qgis 1.x
- else:
- settings.setValue(key+"/valid", QVariant(False)) # lock the contrib repo in qgis 0.x
+ settings.setValue(key+"/valid", QVariant(True)) # unlock the contrib repo in qgis 1.x
else:
settings.setValue(key+"/valid", QVariant(True)) # unlock any other repo
- if url == mainRepo[1]:
- mainRepoPresent = True
- if url == invalidRepo[1]:
- settings.remove(key)
+ if url == officialRepo[1]:
+ officialRepoPresent = True
for authorRepo in authorRepos:
if url == authorRepo[2]:
settings.setValue(key+"/url", QVariant(authorRepo[1])) # correct a depreciated url
- if not mainRepoPresent:
- settings.setValue(mainRepo[0]+"/url", QVariant(mainRepo[1]))
+ if not officialRepoPresent:
+ settings.setValue(officialRepo[0]+"/url", QVariant(officialRepo[1]))
for key in settings.childGroups():
self.mRepositories[key] = {}
@@ -458,7 +432,7 @@
#if compatible, add the plugin to the list
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"):
+ if QGIS_VER[0]==qgisMinimumVersion[0] or (qgisMinimumVersion!="0" and qgisMaximumVersion!="2"): # to be deleted
#add the plugin to the cache
plugins.addFromRepository(plugin)
self.mRepositories[reposName]["state"] = 2
Modified: trunk/qgis/python/plugins/plugin_installer/installer_gui.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_gui.py 2010-10-31 22:54:26 UTC (rev 14470)
+++ trunk/qgis/python/plugins/plugin_installer/installer_gui.py 2010-10-31 23:36:26 UTC (rev 14471)
@@ -290,8 +290,6 @@
index = intervals.index(interval)
else:
index = 1
- if QGIS_VER[0] == "0":
- self.label_2.setText("<b>Note: This functionality requires QGIS 1.0</b>")
self.comboInterval.setCurrentIndex(index)
self.populateMostWidgets()
@@ -362,7 +360,7 @@
if plugins.isThereAnythingNew():
self.comboFilter2.addItem(self.tr("upgradeable and news"))
#set configuration widgets (dependent on the repository list)
- if len(repositories.all()) == 1 or QGIS_VER[0] == "0":
+ if len(repositories.all()) == 1:
self.radioPluginType0.setEnabled(False)
self.radioPluginType1.setEnabled(False)
self.radioPluginType2.setEnabled(False)
@@ -372,9 +370,7 @@
self.radioPluginType2.setEnabled(True)
settings = QSettings()
(i, ok) = settings.value(settingsGroup+"/allowedPluginType", QVariant(2)).toInt()
- if QGIS_VER[0] == "0":
- self.radioPluginType1.setChecked(Qt.Checked)
- elif i == 1 or len(repositories.all()) == 1:
+ if i == 1 or len(repositories.all()) == 1:
self.radioPluginType0.setChecked(Qt.Checked)
elif i == 3:
self.radioPluginType2.setChecked(Qt.Checked)
@@ -617,7 +613,14 @@
startPlugin(plugin["localdir"])
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."))
+ if QGIS_15: # plugins can be reloaded on the fly in QGIS >= 1.5
+ settings = QSettings()
+ if key != 'plugin_installer' and settings.value("/PythonPlugins/"+key).toBool(): # plugin will be reloaded on the fly only if currently loaded
+ infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Plugin reinstalled successfully"))
+ reloadPlugin(key)
+ else:
+ infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
+ else: infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
else:
if plugin["error"] == "incompatible":
message = self.tr("The plugin is designed for a newer version of Quantum GIS. The minimum required version is:")
Modified: trunk/qgis/python/plugins/plugin_installer/installer_plugin.py
===================================================================
--- trunk/qgis/python/plugins/plugin_installer/installer_plugin.py 2010-10-31 22:54:26 UTC (rev 14470)
+++ trunk/qgis/python/plugins/plugin_installer/installer_plugin.py 2010-10-31 23:36:26 UTC (rev 14471)
@@ -27,10 +27,7 @@
def __init__(self, iface):
self.iface = iface
setIface(self.iface) #pass self.iface to installer_data module (needed for plugin loading & testing)
- if QGIS_MAJOR_VER: # new plugin API
- self.mainWindow = self.iface.mainWindow
- else: # old plugin API
- self.mainWindow = self.iface.getMainWindow
+ self.mainWindow = self.iface.mainWindow
self.guiDlg = None
@@ -43,9 +40,6 @@
# ----------------------------------------- #
def getThemeIcon(self, theName):
""" get the icon from the best available theme """
- if not QGIS_MAJOR_VER: # QGIS 0.x
- return QIcon(":/plugins/installer/" + theName)
-
myCurThemePath = QgsApplication.activeThemePath() + "/plugins/" + theName;
myDefThemePath = QgsApplication.defaultThemePath() + "/plugins/" + theName;
myQrcPath = ":/plugins/installer/" + theName;
@@ -65,12 +59,8 @@
self.action = QAction(self.getThemeIcon("plugin_installer.png"), QCoreApplication.translate("QgsPluginInstaller","Fetch Python Plugins..."), self.mainWindow())
self.action.setWhatsThis(QCoreApplication.translate("QgsPluginInstaller","Install more plugins from remote repositories"))
self.action.setStatusTip(QCoreApplication.translate("QgsPluginInstaller","Install more plugins from remote repositories"))
- if QGIS_MAJOR_VER: # new plugin API
- nextAction = self.iface.actionManagePlugins()
- self.iface.pluginMenu().insertAction(nextAction,self.action)
- else: # old plugin API
- nextAction = self.mainWindow().menuBar().actions()[4].menu().actions()[1]
- self.mainWindow().menuBar().actions()[4].menu().insertAction(nextAction,self.action)
+ nextAction = self.iface.actionManagePlugins()
+ self.iface.pluginMenu().insertAction(nextAction,self.action)
QObject.connect(self.action, SIGNAL("triggered()"), self.run)
QObject.connect(self.iface, SIGNAL("currentThemeChanged ( QString )"), self.setCurrentTheme)
self.statusLabel = None
@@ -90,7 +80,7 @@
repositories.setRepositoryData(key,"state",3)
for i in plugins.obsoletePlugins:
- QMessageBox.warning(self.mainWindow(), QCoreApplication.translate("QgsPluginInstaller","QGIS Plugin Conflict:")+" "+plugins.localCache[i]["name"], QCoreApplication.translate("QgsPluginInstaller","The Plugin Installer has detected an obsolete plugin which masks a newer version shipped with this QGIS version. This is likely due to files associated with a previous installation of QGIS. Please use the Plugin Installer to remove that older plugin in order to unmask the newer version shipped with this copy of QGIS."))
+ QMessageBox.warning(self.mainWindow(), QCoreApplication.translate("QgsPluginInstaller","QGIS Plugin Conflict:")+" "+plugins.localCache[i]["name"], "<b>"+ plugins.localCache[i]["name"] + "</b><br/><br/>" + QCoreApplication.translate("QgsPluginInstaller","The Plugin Installer has detected an obsolete plugin which masks a newer version shipped with this QGIS version. This is likely due to files associated with a previous installation of QGIS. Please use the Plugin Installer to remove that older plugin in order to unmask the newer version shipped with this copy of QGIS."))
# ----------------------------------------- #
@@ -123,10 +113,7 @@
# kill pending http requests
for key in repositories.all():
repositories.killConnection(key)
- if QGIS_MAJOR_VER: # new plugin API
- self.iface.pluginMenu().removeAction(self.action)
- else: # old plugin API
- self.mainWindow().menuBar().actions()[4].menu().removeAction(self.action)
+ self.iface.pluginMenu().removeAction(self.action)
if self.statusLabel:
self.mainWindow().statusBar().removeWidget(self.statusLabel)
if self.guiDlg:
More information about the QGIS-commit
mailing list