mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 07:03: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
|
self._printer_connections[serial_port] = connection
|
||||||
|
|
||||||
def _onPrinterConnectionStateChanged(self, serial_port):
|
def _onPrinterConnectionStateChanged(self, serial_port):
|
||||||
if self._printer_connections[serial_port].connectionState == ConnectionState.CONNECTED:
|
try:
|
||||||
self.getOutputDeviceManager().addOutputDevice(self._printer_connections[serial_port])
|
if self._printer_connections[serial_port].connectionState == ConnectionState.CONNECTED:
|
||||||
else:
|
self.getOutputDeviceManager().addOutputDevice(self._printer_connections[serial_port])
|
||||||
self.getOutputDeviceManager().removeOutputDevice(serial_port)
|
else:
|
||||||
self.printerConnectionStateChanged.emit()
|
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)
|
@pyqtProperty(QObject , notify = printerConnectionStateChanged)
|
||||||
def connectedPrinterList(self):
|
def connectedPrinterList(self):
|
||||||
|
|
|
@ -117,7 +117,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
|
|
||||||
def _homeBed(self):
|
def _homeBed(self):
|
||||||
self._sendCommand("G28 Z")
|
self._sendCommand("G28 Z")
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def startPrint(self):
|
def startPrint(self):
|
||||||
self.writeStarted.emit(self)
|
self.writeStarted.emit(self)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue