From 28e488dad712a5e5b3ce01d1e457e80b1c809263 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 11:37:04 +0100 Subject: [PATCH] Fix setting target bed temperature The previous implementation just emitted the signal twice, once in setTargetBedTemperature and once in _setTargetBedTemperature. I've made the private one actually set the temperature. Contributes to issue CURA-3161. --- .../NetworkPrinterOutputDevice.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 6ce3a4fcc5..5f7a36f316 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -266,14 +266,17 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def cancelPreheatBed(self): self.preheatBed(temperature = 0, duration = 0) - ## Changes the target bed temperature and makes sure that its signal is - # emitted. + ## Changes the target bed temperature on the printer. # # /param temperature The new target temperature of the bed. def _setTargetBedTemperature(self, temperature): - if self._target_bed_temperature != temperature: - self._target_bed_temperature = temperature - self.targetBedTemperatureChanged.emit() + if self._target_bed_temperature == temperature: + return + url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/temperature") + data = """{"target": "%i"}""" % temperature + put_request = QNetworkRequest(url) + put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") + self._manager.put(put_request, data.encode()) def _stopCamera(self): self._camera_timer.stop()