mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-04 02:25:12 +08:00
Meta data of the printer is now also visible
CURA-336
This commit is contained in:
parent
01eb65f303
commit
3b51c31772
@ -27,6 +27,6 @@ class DiscoverUM3Action(MachineAction):
|
||||
def foundDevices(self):
|
||||
if self._network_plugin:
|
||||
printers = self._network_plugin.getPrinters()
|
||||
return [printers[printer].getProperties().get(b"name").decode("utf-8") for printer in printers]
|
||||
return [printers[printer] for printer in printers]
|
||||
else:
|
||||
return []
|
||||
|
@ -8,7 +8,9 @@ import QtQuick.Window 2.1
|
||||
|
||||
Cura.MachineAction
|
||||
{
|
||||
id: base
|
||||
anchors.fill: parent;
|
||||
property var selectedPrinter: null
|
||||
Column
|
||||
{
|
||||
anchors.fill: parent;
|
||||
@ -39,6 +41,7 @@ Cura.MachineAction
|
||||
Row
|
||||
{
|
||||
width: parent.width
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
ScrollView
|
||||
{
|
||||
id: objectListContainer
|
||||
@ -54,10 +57,12 @@ Cura.MachineAction
|
||||
|
||||
ListView
|
||||
{
|
||||
id: listview
|
||||
model: manager.foundDevices
|
||||
width: parent.width
|
||||
height: 500
|
||||
currentIndex: activeIndex
|
||||
onCurrentIndexChanged: base.selectedPrinter = listview.model[currentIndex]
|
||||
delegate: Rectangle
|
||||
{
|
||||
height: childrenRect.height;
|
||||
@ -68,7 +73,7 @@ Cura.MachineAction
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width;
|
||||
anchors.right: parent.right;
|
||||
text: modelData
|
||||
text: listview.model[index].name
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
@ -80,13 +85,64 @@ Cura.MachineAction
|
||||
if(!parent.ListView.isCurrentItem)
|
||||
{
|
||||
parent.ListView.view.currentIndex = index;
|
||||
//base.itemActivated();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Column
|
||||
{
|
||||
width: parent.width * 0.5
|
||||
Label
|
||||
{
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: base.selectedPrinter ? base.selectedPrinter.name : ""
|
||||
font.pointSize: 16;
|
||||
}
|
||||
Grid
|
||||
{
|
||||
width: parent.width
|
||||
columns: 2
|
||||
Label
|
||||
{
|
||||
width: parent.width * 0.5
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "Type")
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: parent.width * 0.5
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "Ultimaker 3")
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: parent.width * 0.5
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "Firmware version")
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: parent.width * 0.5
|
||||
wrapMode: Text.WordWrap
|
||||
text: base.selectedPrinter ? base.selectedPrinter.firmwareVersion : ""
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: parent.width * 0.5
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "IP Address")
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: parent.width * 0.5
|
||||
wrapMode: Text.WordWrap
|
||||
text: base.selectedPrinter ? base.selectedPrinter.ipAddress : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -92,6 +92,21 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||
def getKey(self):
|
||||
return self._key
|
||||
|
||||
## Name of the printer (as returned from the zeroConf properties)
|
||||
@pyqtProperty(str, constant = True)
|
||||
def name(self):
|
||||
return self._properties.get(b"name", b"").decode("utf-8")
|
||||
|
||||
## Firmware version (as returned from the zeroConf properties)
|
||||
@pyqtProperty(str, constant=True)
|
||||
def firmwareVersion(self):
|
||||
return self._properties.get(b"firmware_version", b"").decode("utf-8")
|
||||
|
||||
## IPadress of this printer
|
||||
@pyqtProperty(str, constant=True)
|
||||
def ipAddress(self):
|
||||
return self._address
|
||||
|
||||
def _update_camera(self):
|
||||
## Request new image
|
||||
url = QUrl("http://" + self._address + ":8080/?action=snapshot")
|
||||
|
Loading…
x
Reference in New Issue
Block a user