From 982258ece7b30b7a46cd36521184a9779aae1e6a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 25 Apr 2016 11:42:13 +0200 Subject: [PATCH] Cleaned up more code CURA-49 --- NetworkPrinterOutputDevice.py | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/NetworkPrinterOutputDevice.py b/NetworkPrinterOutputDevice.py index 8defed6bc4..6dcc6faf6c 100644 --- a/NetworkPrinterOutputDevice.py +++ b/NetworkPrinterOutputDevice.py @@ -15,6 +15,7 @@ from PyQt5.QtCore import QUrl i18n_catalog = i18nCatalog("cura") + ## Network connected (wifi / lan) printer that uses the Ultimaker API class NetworkPrinterOutputDevice(PrinterOutputDevice): def __init__(self, key, address, info): @@ -47,10 +48,6 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self._qt_multi_part = None self._qt_part = None - - #request_qt_get = QNetworkRequest(QUrl("http://10.180.0.53/api/v1/printer")) - #response = self._manager.get(request_qt_get) - self._progress_message = None self._error_message = None @@ -126,7 +123,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self._update_thread.start() def getCameraImage(self): - pass #Do Nothing + pass # TODO: This still needs to be implemented (we don't have a place to show it now anyway) def startPrint(self): if self._progress != 0: @@ -170,10 +167,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self._error_message.show() except Exception as e: self._progress_message.hide() - Logger.log("e" , "An exception occured in wifi connection: %s" % str(e)) + Logger.log("e" , "An exception occured in network connection: %s" % str(e)) def _onFinished(self, reply): - #print(reply.attribute(QNetworkRequest.HttpStatusCodeAttribute)) reply.uploadProgress.disconnect(self._onUploadProgress) self._progress_message.hide() @@ -181,17 +177,4 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self._progress_message.setProgress(bytes_sent / bytes_total * 100) def _httpGet(self, path): - return requests.get("http://" + self._address + self._api_prefix + path) - - def _httpPost(self, path, file_data): - with self._http_lock: - files_dict = {} - if isinstance(file_data, list): # in case a list with strings is sent - single_string_file_data = "" - for line in file_data: - single_string_file_data += line - files_dict = {"file":("test.gcode", single_string_file_data)} - else: - files_dict = {"file":("test.gcode", file_data)} - - return requests.post("http://" + self._address + self._api_prefix + path, files = files_dict) \ No newline at end of file + return requests.get("http://" + self._address + self._api_prefix + path) \ No newline at end of file