mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
All found devices are now listed in the discover action
CURA-336
This commit is contained in:
parent
f199d490bb
commit
9a4fc0345c
3 changed files with 24 additions and 3 deletions
|
@ -26,7 +26,7 @@ class DiscoverUM3Action(MachineAction):
|
||||||
@pyqtProperty("QVariantList", notify = printerDetected)
|
@pyqtProperty("QVariantList", notify = printerDetected)
|
||||||
def foundDevices(self):
|
def foundDevices(self):
|
||||||
if self._network_plugin:
|
if self._network_plugin:
|
||||||
print(list(self._network_plugin.getPrinters().keys()))
|
|
||||||
return list(self._network_plugin.getPrinters().keys())
|
return list(self._network_plugin.getPrinters().keys())
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -9,7 +9,7 @@ import QtQuick.Window 2.1
|
||||||
Cura.MachineAction
|
Cura.MachineAction
|
||||||
{
|
{
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
Item
|
Column
|
||||||
{
|
{
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
id: discoverUM3Action
|
id: discoverUM3Action
|
||||||
|
@ -27,5 +27,26 @@ Cura.MachineAction
|
||||||
text: "Start looking!"
|
text: "Start looking!"
|
||||||
onClicked: manager.startDiscovery()
|
onClicked: manager.startDiscovery()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListView
|
||||||
|
{
|
||||||
|
model: manager.foundDevices
|
||||||
|
width: parent.width
|
||||||
|
height: 500
|
||||||
|
delegate: Rectangle
|
||||||
|
{
|
||||||
|
height: childrenRect.height;
|
||||||
|
color: "white"
|
||||||
|
width: parent.width
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
text: modelData
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -67,7 +67,7 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
|
||||||
if state_change == ServiceStateChange.Added:
|
if state_change == ServiceStateChange.Added:
|
||||||
info = zeroconf.get_service_info(service_type, name)
|
info = zeroconf.get_service_info(service_type, name)
|
||||||
if info:
|
if info:
|
||||||
if info.properties.get(b"type", None):
|
if info.properties.get(b"type", None) == b'printer':
|
||||||
address = '.'.join(map(lambda n: str(n), info.address))
|
address = '.'.join(map(lambda n: str(n), info.address))
|
||||||
self.addPrinterSignal.emit(str(name), address, info.properties)
|
self.addPrinterSignal.emit(str(name), address, info.properties)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue