From d02aa7f6a39881373b9d26c106354ba0cbab9de5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 10 Apr 2017 13:32:37 +0200 Subject: [PATCH] Fixed order of close & disconnect This would cause the state change caused by close to not be sent to the printer. Fixes CURA-3668 --- .../UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py index f39d921fff..9f450f21ab 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py @@ -164,8 +164,8 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin): else: if self._printers[key].isConnected(): Logger.log("d", "Closing connection [%s]..." % key) - self._printers[key].connectionStateChanged.disconnect(self._onPrinterConnectionStateChanged) self._printers[key].close() + self._printers[key].connectionStateChanged.disconnect(self._onPrinterConnectionStateChanged) ## Because the model needs to be created in the same thread as the QMLEngine, we use a signal. def addPrinter(self, name, address, properties): @@ -183,9 +183,9 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin): printer = self._printers.pop(name, None) if printer: if printer.isConnected(): + printer.disconnect() printer.connectionStateChanged.disconnect(self._onPrinterConnectionStateChanged) Logger.log("d", "removePrinter, disconnecting [%s]..." % name) - printer.disconnect() self.printerListChanged.emit() ## Handler for when the connection state of one of the detected printers changes