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.
This commit is contained in:
Ghostkeeper 2017-02-08 11:37:04 +01:00
parent 98e3e2a25a
commit 28e488dad7
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -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()