mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Simplified the pause code
Now always follow the states of the remote (instead of using states that can get out of sync) CURA-2060
This commit is contained in:
parent
f6c1a46d22
commit
c254737e25
1 changed files with 18 additions and 25 deletions
|
@ -248,39 +248,32 @@ Rectangle
|
||||||
|
|
||||||
text: {
|
text: {
|
||||||
var result = "";
|
var result = "";
|
||||||
if (!printerConnected) {
|
if (!printerConnected)
|
||||||
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
var jobState = Cura.MachineManager.printerOutputDevices[0].jobState;
|
var jobState = Cura.MachineManager.printerOutputDevices[0].jobState;
|
||||||
if (lastJobState != jobState) {
|
|
||||||
// the userClicked message must disappear when an "automated" jobState comes by
|
|
||||||
userClicked = false;
|
|
||||||
lastJobState = jobState;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jobState == "paused")
|
if (jobState == "paused")
|
||||||
{
|
{
|
||||||
if (userClicked) {
|
return catalog.i18nc("@label:", "Resume");
|
||||||
// User feedback for pretending we're already in "printing" mode.
|
}
|
||||||
result = catalog.i18nc("@label:", "Pause");
|
else
|
||||||
} else {
|
{
|
||||||
result = catalog.i18nc("@label:", "Resume");
|
return catalog.i18nc("@label:", "Pause");
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (userClicked) {
|
|
||||||
// User feedback for pretending we're already in "pause" mode.
|
|
||||||
result = catalog.i18nc("@label:", "Resume");
|
|
||||||
} else {
|
|
||||||
result = catalog.i18nc("@label:", "Pause");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked:
|
||||||
var newJobState = Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "print" : "pause";
|
{
|
||||||
Cura.MachineManager.printerOutputDevices[0].setJobState(newJobState);
|
var current_job_state = Cura.MachineManager.printerOutputDevices[0].jobState
|
||||||
userClicked = true;
|
if(current_job_state == "paused")
|
||||||
|
{
|
||||||
|
Cura.MachineManager.printerOutputDevices[0].setJobState("print");
|
||||||
|
}
|
||||||
|
else if(current_job_state == "printing")
|
||||||
|
{
|
||||||
|
Cura.MachineManager.printerOutputDevices[0].setJobState("pause");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
style: ButtonStyle
|
style: ButtonStyle
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue