mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-19 22:13:14 +08:00
Make pre-heat button cancel if currently heating
This is based on the timer, which is locally. Eventually we'd want to make the timer update every now and then or so. Contributes to issue CURA-3161.
This commit is contained in:
parent
9b235aebf2
commit
8d09c53896
@ -323,7 +323,7 @@ Column
|
||||
Button //The pre-heat button.
|
||||
{
|
||||
id: preheatButton
|
||||
text: catalog.i18nc("@button", "Pre-heat")
|
||||
text: preheatCountdownTimer.running ? catalog.i18nc("@button Cancel pre-heating", "Cancel") : catalog.i18nc("@button", "Pre-heat")
|
||||
tooltip: catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.")
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
enabled: printerConnected
|
||||
@ -416,13 +416,22 @@ Column
|
||||
|
||||
onClicked:
|
||||
{
|
||||
connectedPrinter.preheatBed(preheatTemperatureInput.text, connectedPrinter.preheatBedTimeout);
|
||||
var now = new Date();
|
||||
var end_time = new Date();
|
||||
end_time.setTime(now.getTime() + connectedPrinter.preheatBedTimeout * 1000); //*1000 because time is in milliseconds here.
|
||||
preheatCountdownTimer.endTime = end_time;
|
||||
preheatCountdownTimer.start();
|
||||
preheatCountdownTimer.update(); //Update once before the first timer is triggered.
|
||||
if (!preheatCountdownTimer.running)
|
||||
{
|
||||
connectedPrinter.preheatBed(preheatTemperatureInput.text, connectedPrinter.preheatBedTimeout);
|
||||
var now = new Date();
|
||||
var end_time = new Date();
|
||||
end_time.setTime(now.getTime() + connectedPrinter.preheatBedTimeout * 1000); //*1000 because time is in milliseconds here.
|
||||
preheatCountdownTimer.endTime = end_time;
|
||||
preheatCountdownTimer.start();
|
||||
preheatCountdownTimer.update(); //Update once before the first timer is triggered.
|
||||
}
|
||||
else
|
||||
{
|
||||
connectedPrinter.cancelPreheatBed();
|
||||
preheatCountdownTimer.endTime = new Date();
|
||||
preheatCountdownTimer.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user