From d1337c9e22a9fbe7f02a5785f2962b28a913bde2 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 9 Apr 2020 16:39:47 +0200 Subject: [PATCH] Prevent printer from being added twice if it's in cloud and local CURA-7055 --- .../src/Cloud/CloudOutputDeviceManager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py index 20d4c0d9c3..e2249a621c 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py @@ -120,8 +120,11 @@ class CloudOutputDeviceManager: for cluster_data in clusters: device = CloudOutputDevice(self._api, cluster_data) # Create a machine if we don't already have it. Do not make it the active machine. - meta_data = {self.META_CLUSTER_ID: device.key} - if CuraApplication.getInstance().getMachineManager().getMachine(device.printerType, meta_data) is None: + machine_manager = CuraApplication.getInstance().getMachineManager() + + # We only need to add it if it wasn't already added by "local" network or by cloud. + if machine_manager.getMachine(device.printerType, {self.META_CLUSTER_ID: device.key}) is None \ + and machine_manager.getMachine(device.printerType, {self.META_NETWORK_KEY: cluster_data.host_name + "*"}) is None: # The host name is part of the network key. new_devices.append(device) if not new_devices: