Updated UX of detected printers

CURA-336
This commit is contained in:
Jaime van Kessel 2016-06-23 14:39:50 +02:00
parent 0cee5b78df
commit e94f94767e
2 changed files with 56 additions and 16 deletions

View file

@ -27,6 +27,6 @@ class DiscoverUM3Action(MachineAction):
def foundDevices(self): def foundDevices(self):
if self._network_plugin: if self._network_plugin:
printers = self._network_plugin.getPrinters() printers = self._network_plugin.getPrinters()
return([printers[printer].getProperties().get(b"name").decode("utf-8") for printer in printers]) return [printers[printer].getProperties().get(b"name").decode("utf-8") for printer in printers]
else: else:
return [] return []

View file

@ -13,38 +13,78 @@ Cura.MachineAction
{ {
anchors.fill: parent; anchors.fill: parent;
id: discoverUM3Action id: discoverUM3Action
SystemPalette { id: palette }
UM.I18nCatalog { id: catalog; name:"cura"} UM.I18nCatalog { id: catalog; name:"cura"}
Label Label
{ {
id: pageTitle id: pageTitle
width: parent.width width: parent.width
text: catalog.i18nc("@title", "Discover Printer") text: catalog.i18nc("@title", "Connect to Networked Printer")
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.pointSize: 18; font.pointSize: 18;
} }
Label
{
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 ptiner is connected to the network using a network cable of by connecting your printer to your WIFI network. \n\n If 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\n Select your Ultimaker 3 from the list below:")
}
Button Button
{ {
text: "Start looking!" text: "Start looking!"
onClicked: manager.startDiscovery() onClicked: manager.startDiscovery()
} }
Row
ListView
{ {
model: manager.foundDevices
width: parent.width width: parent.width
height: 500 ScrollView
delegate: Rectangle
{ {
height: childrenRect.height; id: objectListContainer
color: "white" frameVisible: true;
width: parent.width width: parent.width * 0.5
Label
Rectangle
{ {
anchors.left: parent.left; parent: viewport
anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.fill: parent
anchors.right: parent.right; color: palette.light
text: modelData }
elide: Text.ElideRight
ListView
{
model: manager.foundDevices
width: parent.width
height: 500
currentIndex: activeIndex
delegate: Rectangle
{
height: childrenRect.height;
color: ListView.isCurrentItem ? palette.highlight : index % 2 ? palette.base : palette.alternateBase
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
}
MouseArea
{
anchors.fill: parent;
onClicked:
{
if(!parent.ListView.isCurrentItem)
{
parent.ListView.view.currentIndex = index;
//base.itemActivated();
}
}
}
}
} }
} }
} }