diff --git a/python/pyplugin_installer/installer.py b/python/pyplugin_installer/installer.py index f38ccee84a25..211ab47415fb 100644 --- a/python/pyplugin_installer/installer.py +++ b/python/pyplugin_installer/installer.py @@ -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 diff --git a/python/pyplugin_installer/installer_data.py b/python/pyplugin_installer/installer_data.py index c9425acb8e73..d6428aa5f05c 100644 --- a/python/pyplugin_installer/installer_data.py +++ b/python/pyplugin_installer/installer_data.py @@ -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()) @@ -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 ) @@ -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