Round pre-heat temperature and duration to integer but allow floats

We want to allow floats in the interface since the interface needs to be agnostic of what device it is connected to. But the UM3 API only allows integers, so we still need to round it to the nearest integer.

Contributes to issue CURA-3161.
This commit is contained in:
Ghostkeeper 2017-02-07 16:57:20 +01:00
parent 785f10966e
commit 4ccadc6208
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -247,8 +247,10 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
# Celsius.
# \param duration How long the bed should stay warm, in seconds. Defaults
# to a quarter hour.
@pyqtSlot(int, int)
@pyqtSlot(float, float)
def preheatBed(self, temperature, duration):
temperature = round(temperature) #The API doesn't allow floating point.
duration = round(duration)
url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat")
if duration > 0:
data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration)