diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index 0254bb0dcd..cdbe2f0710 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -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 diff --git a/plugins/Toolbox/resources/qml/ToolboxErrorPage.qml b/plugins/Toolbox/resources/qml/ToolboxErrorPage.qml new file mode 100644 index 0000000000..600ae2b39f --- /dev/null +++ b/plugins/Toolbox/resources/qml/ToolboxErrorPage.qml @@ -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 + } + } +} diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 2e2fb3cbb8..ea5a535196 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -314,8 +314,9 @@ class Toolbox(QObject, Extension): return def resetDownload(self): - self._download_reply.abort() - self._download_reply.downloadProgress.disconnect(self._onDownloadProgress) + if self._download_reply: + self._download_reply.abort() + self._download_reply.downloadProgress.disconnect(self._onDownloadProgress) self._download_reply = None self._download_request = None self.setDownloadProgress(0) @@ -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