Show upload error or success in header once completed

According to the brand new design.

Contributes to issue CURA-8609.
This commit is contained in:
Ghostkeeper 2021-10-11 15:27:54 +02:00
parent 8ae93c6bc1
commit c3d392c5cf
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
2 changed files with 56 additions and 16 deletions

View file

@ -408,5 +408,7 @@ class MaterialManagementModel(QObject):
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._export_upload_status = "error"
else:
self._export_upload_status = "success"
self.exportUploadStatusChanged.emit()

View file

@ -186,12 +186,62 @@ Window
anchors.margins: UM.Theme.getSize("default_margin").width
visible: cloudPrinterList.count > 0
Row
{
Layout.preferredHeight: childrenRect.height
spacing: UM.Theme.getSize("default_margin").width
states: [
State
{
name: "idle"
when: typeof materialManagementModel === "undefined" || materialManagementModel.exportUploadStatus == "idle" || materialManagementModel.exportUploadStatus == "uploading"
PropertyChanges { target: printerListHeader; text: catalog.i18nc("@title:header", "The following printers will receive the new material profiles:") }
PropertyChanges { target: printerListHeaderIcon; status: UM.StatusIcon.Status.NEUTRAL }
},
State
{
name: "error"
when: typeof materialManagementModel !== "undefined" && materialManagementModel.exportUploadStatus == "error"
PropertyChanges { target: printerListHeader; text: catalog.i18nc("@title:header", "Something went wrong when sending the materials to the printers.") }
PropertyChanges { target: printerListHeaderIcon; status: UM.StatusIcon.Status.ERROR }
},
State
{
name: "success"
when: typeof materialManagementModel !== "undefined" && materialManagementModel.exportUploadStatus == "success"
PropertyChanges { target: printerListHeader; text: catalog.i18nc("@title:header", "Material profiles successfully synced with the following printers:") }
PropertyChanges { target: printerListHeaderIcon; status: UM.StatusIcon.Status.POSITIVE }
}
]
UM.StatusIcon
{
id: printerListHeaderIcon
width: UM.Theme.getSize("section_icon").width
height: width
anchors.verticalCenter: parent.verticalCenter
}
Label
{
id: printerListHeader
anchors.verticalCenter: parent.verticalCenter
//Text is always defined by the states above.
font: UM.Theme.getFont("large_bold")
color: UM.Theme.getColor("text")
}
}
Label
{
text: catalog.i18nc("@title:header", "The following printers will receive the new material profiles")
font: UM.Theme.getFont("large_bold")
id: syncStatusLabel
anchors.right: syncButton.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
visible: text !== ""
text: ""
color: UM.Theme.getColor("text")
Layout.preferredHeight: height
font: UM.Theme.getFont("medium")
}
ScrollView
{
@ -359,18 +409,6 @@ Window
return materialManagementModel.exportUploadStatus != "uploading";
}
}
Label
{
id: syncStatusLabel
anchors.right: syncButton.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
visible: syncButton.visible
text: ""
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
}
Item
{
anchors.right: parent.right