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._createDialog()
|
||||||
self._dialog.show()
|
self._dialog.show()
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
def requestPluginList(self):
|
def requestPluginList(self):
|
||||||
|
Logger.log("i", "Requesting plugin list")
|
||||||
url = QUrl(self._api_url + "plugins")
|
url = QUrl(self._api_url + "plugins")
|
||||||
self._plugin_list_request = QNetworkRequest(url)
|
self._plugin_list_request = QNetworkRequest(url)
|
||||||
self._plugin_list_request.setRawHeader(*self._request_header)
|
self._plugin_list_request.setRawHeader(*self._request_header)
|
||||||
|
@ -181,7 +183,6 @@ class PluginBrowser(QObject, Extension):
|
||||||
|
|
||||||
def _onRequestFinished(self, reply):
|
def _onRequestFinished(self, reply):
|
||||||
reply_url = reply.url().toString()
|
reply_url = reply.url().toString()
|
||||||
|
|
||||||
if reply.error() == QNetworkReply.TimeoutError:
|
if reply.error() == QNetworkReply.TimeoutError:
|
||||||
Logger.log("w", "Got a timeout.")
|
Logger.log("w", "Got a timeout.")
|
||||||
# Reset everything.
|
# Reset everything.
|
||||||
|
@ -191,6 +192,11 @@ class PluginBrowser(QObject, Extension):
|
||||||
self._download_plugin_reply.downloadProgress.disconnect(self._onDownloadPluginProgress)
|
self._download_plugin_reply.downloadProgress.disconnect(self._onDownloadPluginProgress)
|
||||||
self._download_plugin_reply.abort()
|
self._download_plugin_reply.abort()
|
||||||
self._download_plugin_reply = None
|
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.operation() == QNetworkAccessManager.GetOperation:
|
||||||
if reply_url == self._api_url + "plugins":
|
if reply_url == self._api_url + "plugins":
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -14,17 +14,31 @@ UM.Dialog
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Label
|
Item
|
||||||
{
|
{
|
||||||
id: introText
|
id: topBar
|
||||||
text: catalog.i18nc("@label", "Here you can find a list of Third Party plugins.")
|
height: childrenRect.height;
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 30
|
Label
|
||||||
|
{
|
||||||
|
id: introText
|
||||||
|
text: catalog.i18nc("@label", "Here you can find a list of Third Party plugins.")
|
||||||
|
width: parent.width
|
||||||
|
height: 30
|
||||||
|
}
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
id: refresh
|
||||||
|
text: catalog.i18nc("@action:button", "Refresh")
|
||||||
|
onClicked: manager.requestPluginList()
|
||||||
|
anchors.right: parent.right
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ScrollView
|
ScrollView
|
||||||
{
|
{
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.top: introText.bottom
|
anchors.top: topBar.bottom
|
||||||
anchors.bottom: progressbar.top
|
anchors.bottom: progressbar.top
|
||||||
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
||||||
frameVisible: true
|
frameVisible: true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue