mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 15:37:27 -06:00
Add "refresh" button to list of network printers
CURA-2035
This commit is contained in:
parent
bd6e36f487
commit
7f83c22f74
3 changed files with 24 additions and 1 deletions
|
@ -23,6 +23,9 @@ class DiscoverUM3Action(MachineAction):
|
||||||
self._network_plugin.addPrinterSignal.connect(self._onPrinterDiscoveryChanged)
|
self._network_plugin.addPrinterSignal.connect(self._onPrinterDiscoveryChanged)
|
||||||
self._network_plugin.removePrinterSignal.connect(self._onPrinterDiscoveryChanged)
|
self._network_plugin.removePrinterSignal.connect(self._onPrinterDiscoveryChanged)
|
||||||
self.printersChanged.emit()
|
self.printersChanged.emit()
|
||||||
|
else:
|
||||||
|
# Restart bonjour discovery
|
||||||
|
self._network_plugin.startDiscovery()
|
||||||
|
|
||||||
def _onPrinterDiscoveryChanged(self, *args):
|
def _onPrinterDiscoveryChanged(self, *args):
|
||||||
self.printersChanged.emit()
|
self.printersChanged.emit()
|
||||||
|
|
|
@ -45,6 +45,8 @@ Cura.MachineAction
|
||||||
{
|
{
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
id: discoverUM3Action
|
id: discoverUM3Action
|
||||||
|
spacing: UM.Theme.getSize("default_margin").height
|
||||||
|
|
||||||
SystemPalette { id: palette }
|
SystemPalette { id: palette }
|
||||||
UM.I18nCatalog { id: catalog; name:"cura" }
|
UM.I18nCatalog { id: catalog; name:"cura" }
|
||||||
Label
|
Label
|
||||||
|
@ -61,7 +63,16 @@ Cura.MachineAction
|
||||||
id: pageDescription
|
id: pageDescription
|
||||||
width: parent.width
|
width: parent.width
|
||||||
wrapMode: Text.WordWrap
|
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
|
Row
|
||||||
|
|
|
@ -29,6 +29,15 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
|
||||||
|
|
||||||
## Start looking for devices on network.
|
## Start looking for devices on network.
|
||||||
def start(self):
|
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])
|
self._browser = ServiceBrowser(self._zero_conf, u'_ultimaker._tcp.local.', [self._onServiceChanged])
|
||||||
|
|
||||||
## Stop looking for devices on network.
|
## Stop looking for devices on network.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue