mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 15:25:58 +08:00
Properly float-format input of preheatBed
It rounds to 3 digits. The specification of the feature in the API doesn't mention how detailed the temperature and duration can go, but thousands seems more than enough. This also eliminates pesky problems with the JSON brackets in the format function. Contributes to issue CURA-3161.
This commit is contained in:
parent
559b40867e
commit
3618ae0d4f
@ -249,7 +249,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||
@pyqtSlot(float, float)
|
||||
def preheatBed(self, temperature, duration=900):
|
||||
url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat")
|
||||
data = """{"temperature": "{temperature}", "timeout": "{timeout}"}""".format(temperature=str(temperature), timeout=str(duration))
|
||||
data = """{"temperature": "%0.3f", "timeout": "%0.3f"}""" % (temperature, duration)
|
||||
put_request = QNetworkRequest(url)
|
||||
put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json")
|
||||
self._manager.put(put_request, data.encode())
|
||||
|
Loading…
x
Reference in New Issue
Block a user