mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Show error if the upload failed
Contributes to issue CURA-8609.
This commit is contained in:
parent
ffee4a2443
commit
ffd3277854
3 changed files with 23 additions and 5 deletions
|
@ -405,6 +405,8 @@ class MaterialManagementModel(QObject):
|
|||
job.uploadCompleted.connect(self.exportUploadCompleted)
|
||||
job.start()
|
||||
|
||||
def exportUploadCompleted(self):
|
||||
def exportUploadCompleted(self, job_result: UploadMaterialsJob.Result):
|
||||
if job_result == UploadMaterialsJob.Result.FAILED:
|
||||
self._sync_all_dialog.setProperty("syncStatusText", catalog.i18nc("@text", "Something went wrong when sending the materials to the printers."))
|
||||
self._export_upload_status = "idle"
|
||||
self.exportUploadStatusChanged.emit()
|
|
@ -79,9 +79,11 @@ class UploadMaterialsJob(Job):
|
|||
if error is not None:
|
||||
Logger.error(f"Failed to upload material archive: {error}")
|
||||
self.setResult(self.Result.FAILED)
|
||||
return
|
||||
else:
|
||||
self.setResult(self.Result.SUCCESS)
|
||||
self.uploadCompleted.emit()
|
||||
self.uploadCompleted.emit(self.getResult())
|
||||
|
||||
def onError(self, reply: "QNetworkReply", error: Optional["QNetworkReply.NetworkError"]):
|
||||
pass # TODO: Handle errors.
|
||||
Logger.error(f"Failed to upload material archive: {error}")
|
||||
self.setResult(self.Result.FAILED)
|
||||
self.uploadCompleted.emit(self.getResult())
|
|
@ -23,6 +23,7 @@ Window
|
|||
|
||||
property variant materialManagementModel
|
||||
property alias pageIndex: swipeView.currentIndex
|
||||
property alias syncStatusText: syncStatusLabel.text
|
||||
|
||||
SwipeView
|
||||
{
|
||||
|
@ -358,6 +359,19 @@ Window
|
|||
return materialManagementModel.exportUploadStatus != "uploading";
|
||||
}
|
||||
}
|
||||
Label
|
||||
{
|
||||
id: syncStatusLabel
|
||||
|
||||
anchors.right: syncButton.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
visible: syncButton.visible
|
||||
text: ""
|
||||
color: UM.Theme.getColor("text")
|
||||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
Item
|
||||
{
|
||||
anchors.right: parent.right
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue