diff --git a/NetworkPrinterOutputDevicePlugin.py b/NetworkPrinterOutputDevicePlugin.py index 5f0352ff3e..3b281c3984 100644 --- a/NetworkPrinterOutputDevicePlugin.py +++ b/NetworkPrinterOutputDevicePlugin.py @@ -11,7 +11,7 @@ class WifiOutputDevicePlugin(OutputDevicePlugin, SignalEmitter): super().__init__() self._zero_conf = Zeroconf() self._browser = None - self._connections = {} + self._printers = {} # Because the model needs to be created in the same thread as the QMLEngine, we use a signal. self.addConnectionSignal.connect(self.addConnection) @@ -29,26 +29,26 @@ class WifiOutputDevicePlugin(OutputDevicePlugin, SignalEmitter): def _onActiveMachineInstanceChanged(self): active_machine_key = Application.getInstance().getMachineManager().getActiveMachineInstance().getKey() - for address in self._connections: - if self._connections[address].getKey() == active_machine_key: - self._connections[address].connect() - self._connections[address].connectionStateChanged.connect(self._onPrinterConnectionStateChanged) + for address in self._printers: + if self._printers[address].getKey() == active_machine_key: + self._printers[address].connect() + self._printers[address].connectionStateChanged.connect(self._onPrinterConnectionStateChanged) else: - self._connections[address].close() + self._printers[address].close() ## Because the model needs to be created in the same thread as the QMLEngine, we use a signal. def addConnection(self, name, address, properties): connection = NetworkPrinterOutputDevice.NetworkPrinterOutputDevice(name, address, properties) - self._connections[address] = connection + self._printers[address] = connection if connection.getKey() == Application.getInstance().getMachineManager().getActiveMachineInstance().getKey(): - self._connections[address].connect() + self._printers[address].connect() connection.connectionStateChanged.connect(self._onPrinterConnectionStateChanged) def _onPrinterConnectionStateChanged(self, address): - if self._connections[address].isConnected(): - self.getOutputDeviceManager().addOutputDevice(self._connections[address]) + if self._printers[address].isConnected(): + self.getOutputDeviceManager().addOutputDevice(self._printers[address]) else: - self.getOutputDeviceManager().removeOutputDevice(self._connections[address]) + self.getOutputDeviceManager().removeOutputDevice(self._printers[address]) def removeConnection(self): pass