mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
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:
parent
5d0908e8ce
commit
52954460a3
2 changed files with 26 additions and 6 deletions
|
@ -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:
|
||||
|
|
|
@ -14,6 +14,11 @@ UM.Dialog
|
|||
Item
|
||||
{
|
||||
anchors.fill: parent
|
||||
Item
|
||||
{
|
||||
id: topBar
|
||||
height: childrenRect.height;
|
||||
width: parent.width
|
||||
Label
|
||||
{
|
||||
id: introText
|
||||
|
@ -21,10 +26,19 @@ UM.Dialog
|
|||
width: parent.width
|
||||
height: 30
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: refresh
|
||||
text: catalog.i18nc("@action:button", "Refresh")
|
||||
onClicked: manager.requestPluginList()
|
||||
anchors.right: parent.right
|
||||
}
|
||||
}
|
||||
ScrollView
|
||||
{
|
||||
width: parent.width
|
||||
anchors.top: introText.bottom
|
||||
anchors.top: topBar.bottom
|
||||
anchors.bottom: progressbar.top
|
||||
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
||||
frameVisible: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue