mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 04:36:01 +08:00
Add function to pre-head bed
This makes a PUT-request to the printer with the new API function call. Contributes to issue CURA-3161.
This commit is contained in:
parent
f24d778cc5
commit
cfbcf56739
@ -240,6 +240,18 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
|||||||
def ipAddress(self):
|
def ipAddress(self):
|
||||||
return self._address
|
return self._address
|
||||||
|
|
||||||
|
## Pre-heats the heated bed of the printer.
|
||||||
|
#
|
||||||
|
# \param temperature The temperature to heat the bed to, in degrees
|
||||||
|
# Celsius.
|
||||||
|
# \param duration How long the bed should stay warm, in seconds.
|
||||||
|
def preheatBed(self, temperature, duration):
|
||||||
|
url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat")
|
||||||
|
data = """{"temperature": "{temperature}", "timeout": "{timeout}"}""".format(temperature=temperature, timeout=duration)
|
||||||
|
put_request = QNetworkRequest(url)
|
||||||
|
put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json")
|
||||||
|
self._manager.put(put_request, data.encode())
|
||||||
|
|
||||||
def _stopCamera(self):
|
def _stopCamera(self):
|
||||||
self._camera_timer.stop()
|
self._camera_timer.stop()
|
||||||
if self._image_reply:
|
if self._image_reply:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user