mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 15:13:56 -06:00
Added handling for when connection was never correctly added to list
CURA-1339
This commit is contained in:
parent
4f3489233c
commit
58b216828a
2 changed files with 10 additions and 6 deletions
|
@ -197,11 +197,15 @@ class USBPrinterManager(QObject, SignalEmitter, OutputDevicePlugin, Extension):
|
|||
self._printer_connections[serial_port] = connection
|
||||
|
||||
def _onPrinterConnectionStateChanged(self, serial_port):
|
||||
try:
|
||||
if self._printer_connections[serial_port].connectionState == ConnectionState.CONNECTED:
|
||||
self.getOutputDeviceManager().addOutputDevice(self._printer_connections[serial_port])
|
||||
else:
|
||||
self.getOutputDeviceManager().removeOutputDevice(serial_port)
|
||||
self.printerConnectionStateChanged.emit()
|
||||
except KeyError:
|
||||
pass # no output device by this device_id found in connection list.
|
||||
|
||||
|
||||
@pyqtProperty(QObject , notify = printerConnectionStateChanged)
|
||||
def connectedPrinterList(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue