Skip to content

Commit

Permalink
[Plugin Installer] Fix #8080
Browse files Browse the repository at this point in the history
  • Loading branch information
borysiasty committed Jun 25, 2013
1 parent 0485aa0 commit 619558d
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 144 deletions.
5 changes: 2 additions & 3 deletions python/pyplugin_installer/installer.py
Expand Up @@ -172,9 +172,7 @@ def exportRepositoriesToManager(self):
""" Update manager's repository tree widget with current data """
iface.pluginManagerInterface().clearRepositoryList()
for key in repositories.all():
url = repositories.all()[key]["url"]
v=str(QGis.QGIS_VERSION_INT)
url += "?qgis=%d.%d" % ( int(v[0]), int(v[1:3]) )
url = repositories.all()[key]["url"] + repositories.urlParams()
repository = repositories.all()[key]
if repositories.inspectionFilter():
enabled = ( key == repositories.inspectionFilter() )
Expand Down Expand Up @@ -449,6 +447,7 @@ def editRepository(self, reposName):
dlg = QgsPluginInstallerRepositoryDialog( iface.mainWindow() )
dlg.editName.setText(reposName)
dlg.editURL.setText(repositories.all()[reposName]["url"])
dlg.editParams.setText(repositories.urlParams())
dlg.checkBoxEnabled.setCheckState(checkState[repositories.all()[reposName]["enabled"]])
if repositories.all()[reposName]["valid"]:
dlg.checkBoxEnabled.setEnabled(True)
Expand Down
13 changes: 10 additions & 3 deletions python/pyplugin_installer/installer_data.py
Expand Up @@ -236,6 +236,13 @@ def allUnavailable(self):
return repos


# ----------------------------------------- #
def urlParams(self):
""" return GET parameters to be added to every request """
v=str(QGis.QGIS_VERSION_INT)
return "?qgis=%d.%d" % ( int(v[0]), int(v[1:3]) )


# ----------------------------------------- #
def setRepositoryData(self, reposName, key, value):
""" write data to the mRepositories dict """
Expand Down Expand Up @@ -355,9 +362,9 @@ def load(self):
def requestFetching(self,key):
""" start fetching the repository given by key """
self.mRepositories[key]["state"] = 1
url = QUrl(self.mRepositories[key]["url"])
v=str(QGis.QGIS_VERSION_INT)
url.addQueryItem('qgis', '.'.join([str(int(s)) for s in [v[0], v[1:3]]]) ) # don't include the bugfix version!
url = QUrl(self.mRepositories[key]["url"] + self.urlParams() )
#v=str(QGis.QGIS_VERSION_INT)
#url.addQueryItem('qgis', '.'.join([str(int(s)) for s in [v[0], v[1:3]]]) ) # don't include the bugfix version!

self.mRepositories[key]["QRequest"] = QNetworkRequest(url)
self.mRepositories[key]["QRequest"].setAttribute( QNetworkRequest.User, key)
Expand Down

0 comments on commit 619558d

Please sign in to comment.