Codestyle

This commit is contained in:
Jaime van Kessel 2016-04-18 16:36:52 +02:00
parent 4817c05a52
commit d621162a9b

View File

@ -5,14 +5,18 @@ from zeroconf import Zeroconf, ServiceBrowser, ServiceStateChange
from UM.Signal import Signal, SignalEmitter from UM.Signal import Signal, SignalEmitter
from UM.Application import Application from UM.Application import Application
class WifiOutputDevicePlugin(OutputDevicePlugin, SignalEmitter): class WifiOutputDevicePlugin(OutputDevicePlugin, SignalEmitter):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self._zero_conf = Zeroconf() self._zero_conf = Zeroconf()
self._browser = None self._browser = None
self._connections = {} self._connections = {}
self.addConnectionSignal.connect(self.addConnection) #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)
Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineInstanceChanged) Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineInstanceChanged)
addConnectionSignal = Signal() addConnectionSignal = Signal()
## Start looking for devices on network. ## Start looking for devices on network.
@ -31,7 +35,6 @@ class WifiOutputDevicePlugin(OutputDevicePlugin, SignalEmitter):
self._connections[address].connectionStateChanged.connect(self._onPrinterConnectionStateChanged) self._connections[address].connectionStateChanged.connect(self._onPrinterConnectionStateChanged)
else: else:
self._connections[address].close() self._connections[address].close()
print("on active machine instance changed" , active_machine_key)
## 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 addConnection(self, name, address, properties):