Complete interface for selecting cloud printer.

CURA-9278
This commit is contained in:
Remco Burema 2022-09-09 11:05:05 +02:00
parent d955a05d55
commit 6adf05bbf0
4 changed files with 83 additions and 32 deletions

View file

@ -10,19 +10,65 @@ import Cura 1.0 as Cura
UM.Dialog
{
property var manager
id: base
title: catalog.i18nc("@title:window", "Select Printer")
backgroundColor: UM.Theme.getColor("background_2")
property string machine_id_filter: ""
width: minimumWidth
minimumWidth: 550 * screenScaleFactor
height: minimumHeight
minimumHeight: 550 * screenScaleFactor
modality: Qt.ApplicationModal
ScrollView
{
// Workaround for Windowing bugs in Qt:
width: 550 * screenScaleFactor - 3 * UM.Theme.getSize("default_margin").width
height: 550 * screenScaleFactor - 3 * UM.Theme.getSize("default_margin").height
UM.I18nCatalog
{
id: catalog
name: "cura"
}
anchors.fill: parent
Column
{
anchors.fill: parent
spacing: UM.Theme.getSize("default_margin").height
Item
{
width: parent.width
height: childrenRect.height
UM.Label
{
anchors.left: parent.left
text: catalog.i18nc("@title:label", "Compatible Printers")
font: UM.Theme.getFont("large")
}
UM.SimpleButton
{
anchors.right: parent.right
width: UM.Theme.getSize("small_button").width
height: UM.Theme.getSize("small_button").height
iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight")
color: UM.Theme.getColor("text_link")
hoverColor: UM.Theme.getColor("text_scene_hover")
onClicked: manager.refresh()
}
}
Repeater
{
id: contents
@ -32,9 +78,17 @@ UM.Dialog
delegate: Cura.PrintSelectorCard
{
name: model.name
unique_id: model.unique_id
extruders: model.extruders
manager: base.manager
}
}
UM.Label
{
visible: contents.count < 1
text: catalog.i18nc("@description", "No compatible printers, that are currently online, where found.")
}
}
}
}

View file

@ -11,7 +11,9 @@ import Cura 1.0 as Cura
Rectangle
{
property alias name: printerTitle.text
property string unique_id
property var extruders
property var manager
width: parent.width
height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height
@ -63,7 +65,7 @@ Rectangle
id: extruderIcon
anchors.top: parent.top
anchors.left: parent.left
materialColor: modelData.materials.length == 1 ? modelData.materials[0].color : "white"
materialColor: modelData.materials.length == 1 ? modelData.materials[0].hexcolor : "white"
iconSize: UM.Theme.getSize("medium_button_icon").width
}
@ -82,6 +84,7 @@ Rectangle
id: singleMaterialText
anchors.left: extruderCore.right
anchors.verticalCenter: extruderCore.verticalCenter
anchors.leftMargin: UM.Theme.getSize("default_margin").width
text: modelData.materials.length == 1 ? modelData.materials[0].brand + " " + modelData.materials[0].name : ""
visible: modelData.materials.length == 1
}
@ -119,7 +122,7 @@ Rectangle
{
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("border_accent_1")
color: control.hovered ? UM.Theme.getColor("toolbar_button_hover"): UM.Theme.getColor("background_1")
color: printButton.hovered ? UM.Theme.getColor("toolbar_button_hover"): UM.Theme.getColor("background_1")
}
contentItem: Item
@ -133,6 +136,8 @@ Rectangle
height: width
}
}
onClicked: manager.printerSelected(unique_id)
}
}
}