Added refresh option for plugin list.

This fixes the issue that if you don't have internet connection on first start of the browser, you'd need a reboot of cura to get the list.

CURA-3856
This commit is contained in:
Jaime van Kessel 2017-06-30 15:30:22 +02:00
parent 5d0908e8ce
commit 52954460a3
2 changed files with 26 additions and 6 deletions

View file

@ -66,7 +66,9 @@ class PluginBrowser(QObject, Extension):
self._createDialog()
self._dialog.show()
@pyqtSlot()
def requestPluginList(self):
Logger.log("i", "Requesting plugin list")
url = QUrl(self._api_url + "plugins")
self._plugin_list_request = QNetworkRequest(url)
self._plugin_list_request.setRawHeader(*self._request_header)
@ -181,7 +183,6 @@ class PluginBrowser(QObject, Extension):
def _onRequestFinished(self, reply):
reply_url = reply.url().toString()
if reply.error() == QNetworkReply.TimeoutError:
Logger.log("w", "Got a timeout.")
# Reset everything.
@ -191,6 +192,11 @@ class PluginBrowser(QObject, Extension):
self._download_plugin_reply.downloadProgress.disconnect(self._onDownloadPluginProgress)
self._download_plugin_reply.abort()
self._download_plugin_reply = None
return
elif reply.error() == QNetworkReply.HostNotFoundError:
Logger.log("w", "Unable to reach server.")
return
if reply.operation() == QNetworkAccessManager.GetOperation:
if reply_url == self._api_url + "plugins":
try: