Small fixes so switching printers correctly connects / disconnects output devices

CURA-1036
This commit is contained in:
Jaime van Kessel 2016-06-15 14:17:59 +02:00
parent ac4dbe2304
commit 7d258485c8
2 changed files with 2 additions and 2 deletions

View file

@ -109,7 +109,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self._updateHeadPosition(head_x, head_y, head_z) self._updateHeadPosition(head_x, head_y, head_z)
def close(self): def close(self):
self._connection_state == ConnectionState.closed self.setConnectionState(ConnectionState.closed)
self._update_timer.stop() self._update_timer.stop()
def requestWrite(self, node, file_name = None, filter_by_machine = False): def requestWrite(self, node, file_name = None, filter_by_machine = False):

View file

@ -32,7 +32,6 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
self._zero_conf.close() self._zero_conf.close()
def _onGlobalStackChanged(self): def _onGlobalStackChanged(self):
active_machine = Application.getInstance().getGlobalContainerStack() active_machine = Application.getInstance().getGlobalContainerStack()
if not active_machine: if not active_machine:
return return
@ -41,6 +40,7 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
if key == active_machine.getMetaDataEntry("key"): if key == active_machine.getMetaDataEntry("key"):
self._printers[key].connect() self._printers[key].connect()
self._printers[key].connectionStateChanged.connect(self._onPrinterConnectionStateChanged) self._printers[key].connectionStateChanged.connect(self._onPrinterConnectionStateChanged)
else:
self._printers[key].close() 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.