Directly show feedback when pressing the slice button

CURA-6034
This commit is contained in:
Jaime van Kessel 2019-05-29 16:32:43 +02:00
parent 07ff08f6bb
commit 27f60a6d5d

View file

@ -27,15 +27,21 @@ Column
property real progress: UM.Backend.progress
property int backendState: UM.Backend.state
// As the collection of settings to send to the engine might take some time, we have an extra value to indicate
// That the user pressed the button but it's still waiting for the backend to acknowledge that it got it.
property bool waitingForSliceToStart: false
onBackendStateChanged: waitingForSliceToStart = false
function sliceOrStopSlicing()
{
if (widget.backendState == UM.Backend.NotStarted)
{
widget.waitingForSliceToStart = true
CuraApplication.backend.forceSlice()
}
else
{
widget.waitingForSliceToStart = false
CuraApplication.backend.stopSlicing()
}
}
@ -94,9 +100,9 @@ Column
anchors.right: parent.right
anchors.left: parent.left
text: catalog.i18nc("@button", "Slice")
text: widget.waitingForSliceToStart ? catalog.i18nc("@button", "Processing"): catalog.i18nc("@button", "Slice")
tooltip: catalog.i18nc("@label", "Start the slicing process")
enabled: widget.backendState != UM.Backend.Error
enabled: widget.backendState != UM.Backend.Error && !widget.waitingForSliceToStart
visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error
onClicked: sliceOrStopSlicing()
}