Only close connection if it's open when re-checking connections

This commit is contained in:
Jaime van Kessel 2016-06-28 15:00:35 +02:00
parent 4c7d235a0d
commit bc50f0fa7c

View file

@ -44,7 +44,8 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
self._printers[key].connect() self._printers[key].connect()
self._printers[key].connectionStateChanged.connect(self._onPrinterConnectionStateChanged) self._printers[key].connectionStateChanged.connect(self._onPrinterConnectionStateChanged)
else: else:
self._printers[key].close() if self._printers[key].isConnected():
self._printers[key].close()
## Because the model needs to be created in the same thread as the QMLEngine, we use a signal. ## Because the model needs to be created in the same thread as the QMLEngine, we use a signal.
def addPrinter(self, name, address, properties): def addPrinter(self, name, address, properties):