diff --git a/DiscoverUM3Action.py b/DiscoverUM3Action.py index 9ffb28c74d..c24f90674f 100644 --- a/DiscoverUM3Action.py +++ b/DiscoverUM3Action.py @@ -23,6 +23,9 @@ class DiscoverUM3Action(MachineAction): self._network_plugin.addPrinterSignal.connect(self._onPrinterDiscoveryChanged) self._network_plugin.removePrinterSignal.connect(self._onPrinterDiscoveryChanged) self.printersChanged.emit() + else: + # Restart bonjour discovery + self._network_plugin.startDiscovery() def _onPrinterDiscoveryChanged(self, *args): self.printersChanged.emit() diff --git a/DiscoverUM3Action.qml b/DiscoverUM3Action.qml index e679413770..2a70457f7c 100644 --- a/DiscoverUM3Action.qml +++ b/DiscoverUM3Action.qml @@ -45,6 +45,8 @@ Cura.MachineAction { anchors.fill: parent; id: discoverUM3Action + spacing: UM.Theme.getSize("default_margin").height + SystemPalette { id: palette } UM.I18nCatalog { id: catalog; name:"cura" } Label @@ -61,7 +63,16 @@ Cura.MachineAction id: pageDescription width: parent.width wrapMode: Text.WordWrap - text: catalog.i18nc("@label", "To print directly to your Ultimaker 3 printer over the network, please make sure your printer is connected to the network using a network cable or by connecting your printer to your WIFI network. \n\nIf you don't want to connect Cura with your Ultimaker 3 now, you can always use a USB drive to transfer g-code files to your printer.\n\nSelect your Ultimaker 3 from the list below:") + text: catalog.i18nc("@label", "To print directly to your Ultimaker 3 printer over the network, please make sure your printer is connected to the network using a network cable or by connecting your printer to your WIFI network. If you don't connect Cura with your Ultimaker 3, you can still use a USB drive to transfer g-code files to your printer.\n\nSelect your Ultimaker 3 from the list below:") + } + + Button + { + id: rediscoverButton + text: catalog.i18nc("@title", "Refresh") + onClicked: manager.startDiscovery() + anchors.right: parent.right + anchors.rightMargin: parent.width * 0.5 } Row diff --git a/NetworkPrinterOutputDevicePlugin.py b/NetworkPrinterOutputDevicePlugin.py index 6fada8364a..dbb40e4d77 100644 --- a/NetworkPrinterOutputDevicePlugin.py +++ b/NetworkPrinterOutputDevicePlugin.py @@ -29,6 +29,15 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin): ## Start looking for devices on network. def start(self): + self.startDiscovery() + + def startDiscovery(self): + if self._browser: + self._browser.cancel() + self._browser = None + self._printers = {} + self._zero_conf.__init__() + self._browser = ServiceBrowser(self._zero_conf, u'_ultimaker._tcp.local.', [self._onServiceChanged]) ## Stop looking for devices on network.