mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Don't emit devices changed signal if remove wasn't successful
The same could be done for adding but let's keep it at this for now. Hopefully fixes #2238.
This commit is contained in:
parent
37eb74e99e
commit
3951239513
1 changed files with 4 additions and 2 deletions
|
@ -230,12 +230,14 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension):
|
|||
|
||||
## If one of the states of the connected devices change, we might need to add / remove them from the global list.
|
||||
def _onConnectionStateChanged(self, serial_port):
|
||||
success = True
|
||||
try:
|
||||
if self._usb_output_devices[serial_port].connectionState == ConnectionState.connected:
|
||||
self.getOutputDeviceManager().addOutputDevice(self._usb_output_devices[serial_port])
|
||||
else:
|
||||
self.getOutputDeviceManager().removeOutputDevice(serial_port)
|
||||
self.connectionStateChanged.emit()
|
||||
success = success and self.getOutputDeviceManager().removeOutputDevice(serial_port)
|
||||
if success:
|
||||
self.connectionStateChanged.emit()
|
||||
except KeyError:
|
||||
Logger.log("w", "Connection state of %s changed, but it was not found in the list")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue