mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07: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,11 +230,13 @@ 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.
|
## 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):
|
def _onConnectionStateChanged(self, serial_port):
|
||||||
|
success = True
|
||||||
try:
|
try:
|
||||||
if self._usb_output_devices[serial_port].connectionState == ConnectionState.connected:
|
if self._usb_output_devices[serial_port].connectionState == ConnectionState.connected:
|
||||||
self.getOutputDeviceManager().addOutputDevice(self._usb_output_devices[serial_port])
|
self.getOutputDeviceManager().addOutputDevice(self._usb_output_devices[serial_port])
|
||||||
else:
|
else:
|
||||||
self.getOutputDeviceManager().removeOutputDevice(serial_port)
|
success = success and self.getOutputDeviceManager().removeOutputDevice(serial_port)
|
||||||
|
if success:
|
||||||
self.connectionStateChanged.emit()
|
self.connectionStateChanged.emit()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
Logger.log("w", "Connection state of %s changed, but it was not found in the list")
|
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