mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Only connect a cloud printer if it's the active one
By splitting up the correctly setting of metadata and actually connecting, the distinction can be made. CURA-7055
This commit is contained in:
parent
8386d094d3
commit
084e80bcda
1 changed files with 8 additions and 5 deletions
|
@ -226,11 +226,11 @@ class CloudOutputDeviceManager:
|
||||||
return
|
return
|
||||||
new_machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
|
new_machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
|
||||||
|
|
||||||
|
self._setOutputDeviceMetadata(device, new_machine)
|
||||||
|
|
||||||
if activate:
|
if activate:
|
||||||
CuraApplication.getInstance().getMachineManager().setActiveMachine(new_machine.getId())
|
CuraApplication.getInstance().getMachineManager().setActiveMachine(new_machine.getId())
|
||||||
|
|
||||||
self._connectToOutputDevice(device, new_machine)
|
|
||||||
|
|
||||||
def _connectToActiveMachine(self) -> None:
|
def _connectToActiveMachine(self) -> None:
|
||||||
"""Callback for when the active machine was changed by the user"""
|
"""Callback for when the active machine was changed by the user"""
|
||||||
|
|
||||||
|
@ -252,14 +252,17 @@ class CloudOutputDeviceManager:
|
||||||
# Remove device if it is not meant for the active machine.
|
# Remove device if it is not meant for the active machine.
|
||||||
output_device_manager.removeOutputDevice(device.key)
|
output_device_manager.removeOutputDevice(device.key)
|
||||||
|
|
||||||
def _connectToOutputDevice(self, device: CloudOutputDevice, machine: GlobalStack) -> None:
|
def _setOutputDeviceMetadata(self, device: CloudOutputDevice, machine: GlobalStack):
|
||||||
"""Connects to an output device and makes sure it is registered in the output device manager."""
|
|
||||||
|
|
||||||
machine.setName(device.name)
|
machine.setName(device.name)
|
||||||
machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
|
machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
|
||||||
machine.setMetaDataEntry("group_name", device.name)
|
machine.setMetaDataEntry("group_name", device.name)
|
||||||
machine.addConfiguredConnectionType(device.connectionType.value)
|
machine.addConfiguredConnectionType(device.connectionType.value)
|
||||||
|
|
||||||
|
def _connectToOutputDevice(self, device: CloudOutputDevice, machine: GlobalStack) -> None:
|
||||||
|
"""Connects to an output device and makes sure it is registered in the output device manager."""
|
||||||
|
|
||||||
|
self._setOutputDeviceMetadata(device, machine)
|
||||||
|
|
||||||
if not device.isConnected():
|
if not device.isConnected():
|
||||||
device.connect()
|
device.connect()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue