mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 03:35:57 +08:00
Indicate when "Prepare" button has already been clicked
Contributes to CURA-5551
This commit is contained in:
parent
8e1c116b5d
commit
5854ae544f
@ -48,14 +48,15 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sliceOrStopSlicing() {
|
function sliceOrStopSlicing() {
|
||||||
try {
|
if ( [ 1, 5 ].indexOf( base.backendState ) != -1 )
|
||||||
if ([1, 5].indexOf(base.backendState) != -1) {
|
{
|
||||||
CuraApplication.backend.forceSlice();
|
prepareButton.preparingToSlice = true;
|
||||||
} else {
|
CuraApplication.backend.forceSlice();
|
||||||
CuraApplication.backend.stopSlicing();
|
}
|
||||||
}
|
else
|
||||||
} catch (e) {
|
{
|
||||||
console.log('Could not start or stop slicing', e)
|
prepareButton.preparingToSlice = false;
|
||||||
|
CuraApplication.backend.stopSlicing();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,10 +168,10 @@ Item {
|
|||||||
// Prepare button, only shows if auto_slice is off
|
// Prepare button, only shows if auto_slice is off
|
||||||
Button {
|
Button {
|
||||||
id: prepareButton
|
id: prepareButton
|
||||||
|
property bool preparingToSlice: false
|
||||||
tooltip: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process")
|
tooltip: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process")
|
||||||
// 1 = not started, 2 = Processing
|
// 1 = not started, 2 = Processing
|
||||||
enabled: base.backendState != "undefined" && ([1, 2].indexOf(base.backendState) != -1) && base.activity
|
enabled: !preparingToSlice && base.backendState != "undefined" && ([1, 2].indexOf(base.backendState) != -1) && base.activity
|
||||||
visible: base.backendState != "undefined" && !autoSlice && ([1, 2, 4].indexOf(base.backendState) != -1) && base.activity
|
visible: base.backendState != "undefined" && !autoSlice && ([1, 2, 4].indexOf(base.backendState) != -1) && base.activity
|
||||||
property bool autoSlice
|
property bool autoSlice
|
||||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||||
@ -180,7 +181,23 @@ Item {
|
|||||||
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
|
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
|
||||||
|
|
||||||
// 1 = not started, 4 = error, 5 = disabled
|
// 1 = not started, 4 = error, 5 = disabled
|
||||||
text: [1, 4, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel")
|
text: {
|
||||||
|
if ( preparingToSlice )
|
||||||
|
{
|
||||||
|
return catalog.i18nc("@label:Printjob", "Preparing");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( [ 1, 4, 5 ].indexOf( base.backendState ) != -1 )
|
||||||
|
{
|
||||||
|
return catalog.i18nc("@label:Printjob", "Prepare");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return catalog.i18nc("@label:Printjob", "Cancel")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
sliceOrStopSlicing();
|
sliceOrStopSlicing();
|
||||||
@ -237,6 +254,18 @@ Item {
|
|||||||
}
|
}
|
||||||
label: Item { }
|
label: Item { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: UM.Backend
|
||||||
|
onStateChanged:
|
||||||
|
{
|
||||||
|
if ( [ 2, 3 ].indexOf( UM.Backend.state) != -1 )
|
||||||
|
{
|
||||||
|
prepareButton.preparingToSlice = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user