mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 23:46:22 -06:00
CURA-5035 No more crash without internet connection
Still needs a timer or something to show the fetch failed though.
This commit is contained in:
parent
f7ca8cbf68
commit
4e62c58ee6
3 changed files with 32 additions and 2 deletions
|
@ -46,6 +46,11 @@ Window
|
|||
id: viewLoading
|
||||
visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "loading"
|
||||
}
|
||||
ToolboxErrorPage
|
||||
{
|
||||
id: viewErrored
|
||||
visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "errored"
|
||||
}
|
||||
ToolboxDownloadsPage
|
||||
{
|
||||
id: viewDownloads
|
||||
|
|
22
plugins/Toolbox/resources/qml/ToolboxErrorPage.qml
Normal file
22
plugins/Toolbox/resources/qml/ToolboxErrorPage.qml
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Toolbox is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: page
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@info", "Could not connect to the Cura Package database. Please check your connection.")
|
||||
anchors
|
||||
{
|
||||
centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
|
@ -314,6 +314,7 @@ class Toolbox(QObject, Extension):
|
|||
return
|
||||
|
||||
def resetDownload(self):
|
||||
if self._download_reply:
|
||||
self._download_reply.abort()
|
||||
self._download_reply.downloadProgress.disconnect(self._onDownloadProgress)
|
||||
self._download_reply = None
|
||||
|
@ -333,11 +334,13 @@ class Toolbox(QObject, Extension):
|
|||
|
||||
if reply.error() == QNetworkReply.TimeoutError:
|
||||
Logger.log("w", "Got a timeout.")
|
||||
self.setViewPage("errored")
|
||||
self.resetDownload()
|
||||
return
|
||||
|
||||
if reply.error() == QNetworkReply.HostNotFoundError:
|
||||
Logger.log("w", "Unable to reach server.")
|
||||
self.setViewPage("errored")
|
||||
self.resetDownload()
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue