Move pre-heat timer into PrinterOutputDevice

If it's held inside the device that has two advantages: It's being held per-device, so switching connection doesn't stop the timer. And also, the logic is no longer in the GUI.

Contributes to issue CURA-3161.
This commit is contained in:
Ghostkeeper 2017-02-16 09:23:28 +01:00
parent 2f89a1cff4
commit 75a50b73c2
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75
3 changed files with 28 additions and 22 deletions

View file

@ -262,6 +262,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
put_request = QNetworkRequest(url)
put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json")
self._manager.put(put_request, data.encode())
self._preheat_bed_timer.start(self._preheat_bed_timeout * 1000) #Times 1000 because it needs to be provided as milliseconds.
## Cancels pre-heating the heated bed of the printer.
#
@ -269,6 +270,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
@pyqtSlot()
def cancelPreheatBed(self):
self.preheatBed(temperature = 0, duration = 0)
self._preheat_bed_timer.stop()
self._preheat_bed_timer.setInterval(0)
## Changes the target bed temperature on the printer.
#