Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
follow up 86bebab
  • Loading branch information
borysiasty committed Jun 25, 2013
1 parent c0ae8f3 commit 0485aa0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion python/pyplugin_installer/installer.py
Expand Up @@ -131,7 +131,7 @@ def fetchAvailablePlugins(self, reloadMode):
if repositories.allUnavailable() and repositories.allUnavailable() != repositories.allEnabled():
for key in repositories.allUnavailable():
if not keepQuiet:
QMessageBox.warning(iface.mainWindow(), self.tr("QGIS Python Plugin Installer"), self.tr("Error reading repository:") + " " + key + "\n" + repositories.all()[key]["error"])
QMessageBox.warning(iface.mainWindow(), self.tr("QGIS Python Plugin Installer"), self.tr("Error reading repository:") + " " + key + "\n\n" + repositories.all()[key]["error"])
if QgsApplication.keyboardModifiers() == Qt.KeyboardModifiers(Qt.ShiftModifier):
keepQuiet = True
# finally, rebuild plugins from the caches
Expand Down
22 changes: 13 additions & 9 deletions python/pyplugin_installer/installer_data.py
Expand Up @@ -393,12 +393,7 @@ def xmlDownloaded(self):
self.mRepositories[reposName]["state"] = 3
self.mRepositories[reposName]["error"] = reply.errorString()
if reply.error() == QNetworkReply.OperationCanceledError:
self.mRepositories[reposName]["error"] += "\n\n" + QCoreApplication.translate("QgsPluginInstaller", "If you haven't cancelled the download manually, it might be caused by a timeout. In this case consider increasing the connection timeout value in QGIS options.")
elif reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200:
self.mRepositories[reposName]["state"] = 3
self.mRepositories[reposName]["error"] = QCoreApplication.translate("QgsPluginInstaller", "Status code:") + " %d %s" % (
reply.attribute(QNetworkRequest.HttpStatusCodeAttribute),
reply.attribute(QNetworkRequest.HttpReasonPhraseAttribute))
self.mRepositories[reposName]["error"] += "\n\n" + QCoreApplication.translate("QgsPluginInstaller", "If you haven't cancelled the download manually, it was most likely caused by a timeout. In this case consider increasing the connection timeout value in QGIS options window.")
else:
reposXML = QDomDocument()
reposXML.setContent(reply.readAll())
Expand Down Expand Up @@ -458,8 +453,14 @@ def xmlDownloaded(self):
plugins.addFromRepository(plugin)
self.mRepositories[reposName]["state"] = 2
else:
# no plugin metadata found
self.mRepositories[reposName]["state"] = 3
self.mRepositories[reposName]["error"] = QCoreApplication.translate("QgsPluginInstaller", "Server response is 200 OK, but doesn't look like plugin metatada.")
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200:
self.mRepositories[reposName]["error"] = QCoreApplication.translate("QgsPluginInstaller", "Server response is 200 OK, but doesn't contain plugin metatada. This is most likely caused by a proxy or a wrong repository URL. You can configure proxy settings in QGIS options.")
else:
self.mRepositories[reposName]["error"] = QCoreApplication.translate("QgsPluginInstaller", "Status code:") + " %d %s" % (
reply.attribute(QNetworkRequest.HttpStatusCodeAttribute),
reply.attribute(QNetworkRequest.HttpReasonPhraseAttribute))

self.repositoryFetched.emit( reposName )

Expand Down Expand Up @@ -723,15 +724,18 @@ def rebuild(self):
self.mPlugins[key] = plugin # just add a new plugin
else:
# update local plugin with remote metadata
# name, description, icon: only use remote data if local one is not available (because of i18n and to not download the icon)
# description, about, icon: only use remote data if local one not available. Prefer local version because of i18n.
# NOTE: don't prefer local name to not desynchronize names if repository doesn't support i18n.
# Also prefer local icon to avoid downloading.
for attrib in translatableAttributes + ["icon"]:
if attrib != "name":
if not self.mPlugins[key][attrib] and plugin[attrib]:
self.mPlugins[key][attrib] = plugin[attrib]
# other remote metadata is preffered:
for attrib in ["name", "description", "about", "category", "tags", "changelog", "author_name", "author_email", "homepage",
"tracker", "code_repository", "experimental", "version_available", "zip_repository",
"download_url", "filename", "downloads", "average_vote", "rating_votes"]:
if not attrib in translatableAttributes:
if ( not attrib in translatableAttributes ) or ( attrib == "name" ): # include name!
if plugin[attrib]:
self.mPlugins[key][attrib] = plugin[attrib]
# set status
Expand Down

0 comments on commit 0485aa0

Please sign in to comment.