Skip to content

Commit 0485aa0

Browse files
committedJun 25, 2013
follow up 86bebab
1 parent c0ae8f3 commit 0485aa0

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed
 

‎python/pyplugin_installer/installer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def fetchAvailablePlugins(self, reloadMode):
131131
if repositories.allUnavailable() and repositories.allUnavailable() != repositories.allEnabled():
132132
for key in repositories.allUnavailable():
133133
if not keepQuiet:
134-
QMessageBox.warning(iface.mainWindow(), self.tr("QGIS Python Plugin Installer"), self.tr("Error reading repository:") + " " + key + "\n" + repositories.all()[key]["error"])
134+
QMessageBox.warning(iface.mainWindow(), self.tr("QGIS Python Plugin Installer"), self.tr("Error reading repository:") + " " + key + "\n\n" + repositories.all()[key]["error"])
135135
if QgsApplication.keyboardModifiers() == Qt.KeyboardModifiers(Qt.ShiftModifier):
136136
keepQuiet = True
137137
# finally, rebuild plugins from the caches

‎python/pyplugin_installer/installer_data.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,7 @@ def xmlDownloaded(self):
393393
self.mRepositories[reposName]["state"] = 3
394394
self.mRepositories[reposName]["error"] = reply.errorString()
395395
if reply.error() == QNetworkReply.OperationCanceledError:
396-
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.")
397-
elif reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200:
398-
self.mRepositories[reposName]["state"] = 3
399-
self.mRepositories[reposName]["error"] = QCoreApplication.translate("QgsPluginInstaller", "Status code:") + " %d %s" % (
400-
reply.attribute(QNetworkRequest.HttpStatusCodeAttribute),
401-
reply.attribute(QNetworkRequest.HttpReasonPhraseAttribute))
396+
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.")
402397
else:
403398
reposXML = QDomDocument()
404399
reposXML.setContent(reply.readAll())
@@ -458,8 +453,14 @@ def xmlDownloaded(self):
458453
plugins.addFromRepository(plugin)
459454
self.mRepositories[reposName]["state"] = 2
460455
else:
456+
# no plugin metadata found
461457
self.mRepositories[reposName]["state"] = 3
462-
self.mRepositories[reposName]["error"] = QCoreApplication.translate("QgsPluginInstaller", "Server response is 200 OK, but doesn't look like plugin metatada.")
458+
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200:
459+
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.")
460+
else:
461+
self.mRepositories[reposName]["error"] = QCoreApplication.translate("QgsPluginInstaller", "Status code:") + " %d %s" % (
462+
reply.attribute(QNetworkRequest.HttpStatusCodeAttribute),
463+
reply.attribute(QNetworkRequest.HttpReasonPhraseAttribute))
463464

464465
self.repositoryFetched.emit( reposName )
465466

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

0 commit comments

Comments
 (0)
Please sign in to comment.