mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 05:23:58 -06:00
Only remove output device if it actually existed
This commit is contained in:
parent
dc826ab456
commit
60d47fcbad
1 changed files with 3 additions and 2 deletions
|
@ -22,7 +22,7 @@ I18N_CATALOG = i18nCatalog("cura")
|
||||||
|
|
||||||
## The NetworkOutputDeviceManager is responsible for discovering and managing local networked clusters.
|
## The NetworkOutputDeviceManager is responsible for discovering and managing local networked clusters.
|
||||||
class NetworkOutputDeviceManager:
|
class NetworkOutputDeviceManager:
|
||||||
|
|
||||||
META_NETWORK_KEY = "um_network_key"
|
META_NETWORK_KEY = "um_network_key"
|
||||||
|
|
||||||
MANUAL_DEVICES_PREFERENCE_KEY = "um3networkprinting/manual_instances"
|
MANUAL_DEVICES_PREFERENCE_KEY = "um3networkprinting/manual_instances"
|
||||||
|
@ -97,12 +97,13 @@ class NetworkOutputDeviceManager:
|
||||||
if not active_machine:
|
if not active_machine:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
output_device_manager = CuraApplication.getInstance().getOutputDeviceManager()
|
||||||
stored_device_id = active_machine.getMetaDataEntry(self.META_NETWORK_KEY)
|
stored_device_id = active_machine.getMetaDataEntry(self.META_NETWORK_KEY)
|
||||||
for device in self._discovered_devices.values():
|
for device in self._discovered_devices.values():
|
||||||
if device.key == stored_device_id:
|
if device.key == stored_device_id:
|
||||||
# Connect to it if the stored key matches.
|
# Connect to it if the stored key matches.
|
||||||
self._connectToOutputDevice(device, active_machine)
|
self._connectToOutputDevice(device, active_machine)
|
||||||
else:
|
elif device.key in output_device_manager.getOutputDeviceIds():
|
||||||
# Remove device if it is not meant for the active machine.
|
# Remove device if it is not meant for the active machine.
|
||||||
CuraApplication.getInstance().getOutputDeviceManager().removeOutputDevice(device.key)
|
CuraApplication.getInstance().getOutputDeviceManager().removeOutputDevice(device.key)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue