Fix a bug that would pair a local and cloud printer when they were not the same

This commit is contained in:
ChrisTerBeke 2019-07-31 12:27:33 +02:00
parent 60d47fcbad
commit 7147c788ef
2 changed files with 4 additions and 3 deletions

View file

@ -128,7 +128,7 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
return True return True
# However, for manually added printers, the local IP address is used in lieu of a proper # However, for manually added printers, the local IP address is used in lieu of a proper
# network key, so check for that as well # network key, so check for that as well
if self.clusterData.host_internal_ip is not None and network_key.find(self.clusterData.host_internal_ip): if self.clusterData.host_internal_ip is not None and network_key in self.clusterData.host_internal_ip:
return True return True
return False return False

View file

@ -151,6 +151,7 @@ class CloudOutputDeviceManager:
if not active_machine: if not active_machine:
return return
output_device_manager = CuraApplication.getInstance().getOutputDeviceManager()
stored_cluster_id = active_machine.getMetaDataEntry(self.META_CLUSTER_ID) stored_cluster_id = active_machine.getMetaDataEntry(self.META_CLUSTER_ID)
local_network_key = active_machine.getMetaDataEntry(self.META_NETWORK_KEY) local_network_key = active_machine.getMetaDataEntry(self.META_NETWORK_KEY)
for device in self._remote_clusters.values(): for device in self._remote_clusters.values():
@ -161,9 +162,9 @@ class CloudOutputDeviceManager:
# Connect to it if we can match the local network key that was already present. # Connect to it if we can match the local network key that was already present.
active_machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key) active_machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
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) output_device_manager.removeOutputDevice(device.key)
## Connects to an output device and makes sure it is registered in the output device manager. ## Connects to an output device and makes sure it is registered in the output device manager.
@staticmethod @staticmethod