Skip to content

Commit

Permalink
Plugin Installer update - new repositories for the 1.x
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/branches/Version-1_0@9867 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
borysiasty committed Dec 19, 2008
1 parent bca65d9 commit e64e8cc
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 32 deletions.
2 changes: 1 addition & 1 deletion python/plugins/plugin_installer/__init__.py
Expand Up @@ -14,7 +14,7 @@ def name():
return "Plugin Installer" return "Plugin Installer"


def version(): def version():
return "Version 0.9.7" return "Version 0.9.8"


def description(): def description():
return "Downloads and installs QGIS python plugins" return "Downloads and installs QGIS python plugins"
Expand Down
82 changes: 52 additions & 30 deletions python/plugins/plugin_installer/installer_data.py
Expand Up @@ -73,11 +73,13 @@ def setIface(qgisIface):
seenPluginGroup = "/Qgis/plugin-seen" seenPluginGroup = "/Qgis/plugin-seen"




# knownRepos: (name, url for QGIS 0.x, url for QGIS 1.x, possible depreciated url, another possible depreciated url) # Repositories: (name, url, possible depreciated url)
knownRepos = [("Official QGIS Repository","http://spatialserver.net/cgi-bin/pyqgis_plugin.rb","http://pyqgis.org/repo/official","",""), oldRepo = ("QGIS 0.x Plugin Repository", "http://spatialserver.net/cgi-bin/pyqgis_plugin.rb","")
("Carson Farmer's Repository","http://www.ftools.ca/cfarmerQgisRepo.xml","http://www.ftools.ca/cfarmerQgisRepo.xml", "http://www.geog.uvic.ca/spar/carson/cfarmerQgisRepo.xml","http://www.ftools.ca/cfarmerQgisRepo_0.xx.xml"), officialRepo = ("QGIS Official Repository", "http://pyqgis.org/repo/official","")
("Borys Jurgiel's Repository","http://bwj.aster.net.pl/qgis-oldapi/plugins.xml","http://bwj.aster.net.pl/qgis/plugins.xml","",""), contribRepo = ("QGIS Contributed Repository", "http://pyqgis.org/repo/contributed","")
("Faunalia Repository","http://faunalia.it/qgis/plugins.xml","http://faunalia.it/qgis/plugins.xml","http://faunalia.it/qgis/1.x/plugins.xml","")] 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"),
("Faunalia Repository", "http://faunalia.it/qgis/plugins.xml", "http://faunalia.it/qgis/1.x/plugins.xml")]






Expand Down Expand Up @@ -152,15 +154,27 @@ def addKnownRepos(self):
presentURLs = [] presentURLs = []
for i in self.all().values(): for i in self.all().values():
presentURLs += [QString(i["url"])] presentURLs += [QString(i["url"])]
for i in knownRepos: settings = QSettings()
if i[QGIS_MAJOR_VER+1] and presentURLs.count(i[QGIS_MAJOR_VER+1]) == 0: settings.beginGroup(reposGroup)
settings = QSettings() # add the central repositories
settings.beginGroup(reposGroup) 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))
# add author repositories
for i in authorRepos:
if i[1] and presentURLs.count(i[1]) == 0:
repoName = QString(i[0]) repoName = QString(i[0])
if self.all().has_key(repoName): if self.all().has_key(repoName):
repoName = repoName + "(2)" repoName = repoName + " (original)"
# add to settings settings.setValue(repoName+"/url", QVariant(i[1]))
settings.setValue(repoName+"/url", QVariant(i[QGIS_MAJOR_VER+1]))
settings.setValue(repoName+"/enabled", QVariant(True)) settings.setValue(repoName+"/enabled", QVariant(True))




Expand Down Expand Up @@ -225,24 +239,32 @@ def load(self):
self.mRepositories = {} self.mRepositories = {}
settings = QSettings() settings = QSettings()
settings.beginGroup(reposGroup) settings.beginGroup(reposGroup)
# first, update the QSettings repositories if needed # first, update repositories in QSettings if needed
if len(settings.childGroups()) == 0: # add the default repository when there isn't any if QGIS_MAJOR_VER:
settings.setValue(knownRepos[0][0]+"/url", QVariant(knownRepos[0][QGIS_MAJOR_VER+1])) mainRepo = officialRepo
else: # else update invalid urls invalidRepo = oldRepo
for key in settings.childGroups(): else:
url = settings.value(key+"/url", QVariant()).toString() mainRepo = oldRepo
allOk = True invalidRepo = officialRepo
for repo in knownRepos: mainRepoPresent = False
if repo[3] == url or repo[4] == url or (repo[QGIS_MAJOR_VER+1] != url and repo[int(not QGIS_MAJOR_VER)+1] == url): for key in settings.childGroups():
if repo[QGIS_MAJOR_VER+1]: #update the URL url = settings.value(key+"/url", QVariant()).toString()
settings.setValue(key+"/url", QVariant(repo[QGIS_MAJOR_VER+1])) if url == contribRepo[1]:
settings.setValue(key+"/valid", QVariant(True)) if QGIS_MAJOR_VER:
allOk = False settings.setValue(key+"/valid", QVariant(True)) # unlock the contrib repo in qgis 1.x
else: # mark as invalid else:
settings.setValue(key+"/valid", QVariant(False)) settings.setValue(key+"/valid", QVariant(False)) # lock the contrib repo in qgis 0.x
allOk = False else:
if allOk: # marking as valid if no problem. settings.setValue(key+"/valid", QVariant(True)) # unlock any other repo
settings.setValue(key+"/valid", QVariant(True)) if url == mainRepo[1]:
mainRepoPresent = True
if url == invalidRepo[1]:
settings.remove(key)
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]))


for key in settings.childGroups(): for key in settings.childGroups():
self.mRepositories[key] = {} self.mRepositories[key] = {}
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/plugin_installer/installer_gui.py
Expand Up @@ -412,7 +412,7 @@ def addItem(p):
ver = availableVersion ver = availableVersion
else: else:
ver = installedVersion ver = installedVersion
if p["status"] in ["upgradeable","newer"] or installedVersion == "?" or availableVersion == "?": if p["status"] in ["upgradeable","newer"] or p["error"]:
verTip = self.tr("installed version") + ": " + installedVersion + "\n" + self.tr("available version") + ": " + availableVersion verTip = self.tr("installed version") + ": " + installedVersion + "\n" + self.tr("available version") + ": " + availableVersion
elif p["status"] in ["not installed", "new"]: elif p["status"] in ["not installed", "new"]:
verTip = self.tr("available version") + ": " + availableVersion verTip = self.tr("available version") + ": " + availableVersion
Expand Down

0 comments on commit e64e8cc

Please sign in to comment.