mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Renamed connection to printer
CURA-49
This commit is contained in:
parent
f488d8eb28
commit
2a90c76cb8
1 changed files with 9 additions and 9 deletions
|
@ -14,10 +14,10 @@ class WifiOutputDevicePlugin(OutputDevicePlugin, SignalEmitter):
|
||||||
self._printers = {}
|
self._printers = {}
|
||||||
|
|
||||||
# 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.
|
||||||
self.addConnectionSignal.connect(self.addConnection)
|
self.addPrinterSignal.connect(self.addPrinter)
|
||||||
Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineInstanceChanged)
|
Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineInstanceChanged)
|
||||||
|
|
||||||
addConnectionSignal = Signal()
|
addPrinterSignal = Signal()
|
||||||
|
|
||||||
## Start looking for devices on network.
|
## Start looking for devices on network.
|
||||||
def start(self):
|
def start(self):
|
||||||
|
@ -37,12 +37,12 @@ class WifiOutputDevicePlugin(OutputDevicePlugin, SignalEmitter):
|
||||||
self._printers[address].close()
|
self._printers[address].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 addConnection(self, name, address, properties):
|
def addPrinter(self, name, address, properties):
|
||||||
connection = NetworkPrinterOutputDevice.NetworkPrinterOutputDevice(name, address, properties)
|
printer = NetworkPrinterOutputDevice.NetworkPrinterOutputDevice(name, address, properties)
|
||||||
self._printers[address] = connection
|
self._printers[address] = printer
|
||||||
if connection.getKey() == Application.getInstance().getMachineManager().getActiveMachineInstance().getKey():
|
if printer.getKey() == Application.getInstance().getMachineManager().getActiveMachineInstance().getKey():
|
||||||
self._printers[address].connect()
|
self._printers[address].connect()
|
||||||
connection.connectionStateChanged.connect(self._onPrinterConnectionStateChanged)
|
printer.connectionStateChanged.connect(self._onPrinterConnectionStateChanged)
|
||||||
|
|
||||||
def _onPrinterConnectionStateChanged(self, address):
|
def _onPrinterConnectionStateChanged(self, address):
|
||||||
if self._printers[address].isConnected():
|
if self._printers[address].isConnected():
|
||||||
|
@ -50,7 +50,7 @@ class WifiOutputDevicePlugin(OutputDevicePlugin, SignalEmitter):
|
||||||
else:
|
else:
|
||||||
self.getOutputDeviceManager().removeOutputDevice(self._printers[address])
|
self.getOutputDeviceManager().removeOutputDevice(self._printers[address])
|
||||||
|
|
||||||
def removeConnection(self):
|
def removePrinter(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _onServiceChanged(self, zeroconf, service_type, name, state_change):
|
def _onServiceChanged(self, zeroconf, service_type, name, state_change):
|
||||||
|
@ -59,7 +59,7 @@ class WifiOutputDevicePlugin(OutputDevicePlugin, SignalEmitter):
|
||||||
if info:
|
if info:
|
||||||
if info.properties.get(b"type", None):
|
if info.properties.get(b"type", None):
|
||||||
address = '.'.join(map(lambda n: str(n), info.address))
|
address = '.'.join(map(lambda n: str(n), info.address))
|
||||||
self.addConnectionSignal.emit(str(name), address, info.properties)
|
self.addPrinterSignal.emit(str(name), address, info.properties)
|
||||||
|
|
||||||
elif state_change == ServiceStateChange.Removed:
|
elif state_change == ServiceStateChange.Removed:
|
||||||
info = zeroconf.get_service_info(service_type, name)
|
info = zeroconf.get_service_info(service_type, name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue