diff --git a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py index b5f0c3bb4b..606a28357d 100644 --- a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py @@ -57,10 +57,14 @@ class LocalClusterOutputDeviceManager: ## Stop network discovery and clean up discovered devices. def stop(self) -> None: self._zero_conf_client.stop() - # Cleanup all manual devices. for instance_name in list(self._discovered_devices): self._onDiscoveredDeviceRemoved(instance_name) + ## Restart discovery on the local network. + def startDiscovery(self): + self.stop() + self.start() + ## Add a networked printer manually by address. def addManualDevice(self, address: str, callback: Optional[Callable[[bool, str], None]] = None) -> None: api_client = ClusterApiClient(address, lambda error: print(error)) @@ -210,12 +214,12 @@ class LocalClusterOutputDeviceManager: if Version(device.firmwareVersion) < self.MIN_SUPPORTED_CLUSTER_VERSION: LegacyDeviceNoLongerSupportedMessage().show() return - + # Tell the user that they cannot connect to a non-host printer. if device.clusterSize < 1: NotClusterHostMessage().show() return - + device.connect() machine.addConfiguredConnectionType(device.connectionType.value) CuraApplication.getInstance().getOutputDeviceManager().addOutputDevice(device) diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 64180491fe..20388ac491 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -37,6 +37,10 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._network_output_device_manager.stop() self._cloud_output_device_manager.stop() + ## Restart network discovery. + def startDiscovery(self) -> None: + self._network_output_device_manager.startDiscovery() + ## Force refreshing the network connections. def refreshConnections(self) -> None: self._network_output_device_manager.refreshConnections()