mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 06:45:09 -06:00
Merge branch '4.0' of github.com:Ultimaker/Cura
This commit is contained in:
commit
e02fcd664c
11 changed files with 130 additions and 27 deletions
|
@ -12,7 +12,23 @@ Button
|
|||
id: configurationItem
|
||||
|
||||
property var configuration: null
|
||||
hoverEnabled: true
|
||||
hoverEnabled: isValidMaterial
|
||||
|
||||
property bool isValidMaterial:
|
||||
{
|
||||
var extruderConfigurations = configuration.extruderConfigurations
|
||||
|
||||
for (var index in extruderConfigurations)
|
||||
{
|
||||
var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : ""
|
||||
|
||||
if (name == "" || name == "Unknown")
|
||||
{
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
|
@ -40,17 +56,104 @@ Button
|
|||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("wide_margin").width
|
||||
}
|
||||
|
||||
height: childrenRect.height
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Repeater
|
||||
{
|
||||
id: repeater
|
||||
model: configuration.extruderConfigurations
|
||||
|
||||
delegate: PrintCoreConfiguration
|
||||
{
|
||||
width: Math.round(parent.width / 2)
|
||||
printCoreConfiguration: modelData
|
||||
visible: configurationItem.isValidMaterial
|
||||
}
|
||||
}
|
||||
|
||||
// Unknown material
|
||||
Item
|
||||
{
|
||||
id: unknownMaterial
|
||||
height: unknownMaterialMessage.height + UM.Theme.getSize("thin_margin").width / 2
|
||||
width: parent.width
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: UM.Theme.getSize("thin_margin").width / 2
|
||||
|
||||
visible: !configurationItem.isValidMaterial
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: icon
|
||||
anchors.verticalCenter: unknownMaterialMessage.verticalCenter
|
||||
|
||||
source: UM.Theme.getIcon("warning")
|
||||
color: UM.Theme.getColor("warning")
|
||||
width: UM.Theme.getSize("section_icon").width
|
||||
height: width
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: unknownMaterialMessage
|
||||
text:
|
||||
{
|
||||
var extruderConfigurations = configuration.extruderConfigurations
|
||||
var unknownMaterials = []
|
||||
for (var index in extruderConfigurations)
|
||||
{
|
||||
var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : ""
|
||||
if (name == "" || name == "Unknown")
|
||||
{
|
||||
var materialType = extruderConfigurations[index].material.type
|
||||
if (extruderConfigurations[index].material.type == "")
|
||||
{
|
||||
materialType = "Unknown"
|
||||
}
|
||||
|
||||
var brand = extruderConfigurations[index].material.brand
|
||||
if (brand == "")
|
||||
{
|
||||
brand = "Unknown"
|
||||
}
|
||||
|
||||
name = materialType + " (" + brand + ")"
|
||||
unknownMaterials.push(name)
|
||||
}
|
||||
}
|
||||
|
||||
unknownMaterials = "<b>" + unknownMaterials + "</b>"
|
||||
var draftResult = catalog.i18nc("@label", "This configuration is not available because %1 is not recognized. Please visit %2 to download the correct material profile.");
|
||||
var result = draftResult.arg(unknownMaterials).arg("<a href=' '>" + catalog.i18nc("@label","Marketplace") + "</a> ")
|
||||
|
||||
return result
|
||||
}
|
||||
width: extruderRow.width
|
||||
|
||||
anchors.left: icon.right
|
||||
anchors.right: unknownMaterial.right
|
||||
anchors.leftMargin: UM.Theme.getSize("wide_margin").height
|
||||
anchors.top: unknownMaterial.top
|
||||
|
||||
wrapMode: Text.WordWrap
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
linkColor: UM.Theme.getColor("text_link")
|
||||
|
||||
onLinkActivated:
|
||||
{
|
||||
Cura.Actions.browsePackages.trigger()
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
cursorShape: unknownMaterialMessage.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
acceptedButtons: Qt.NoButton
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +228,9 @@ Button
|
|||
|
||||
onClicked:
|
||||
{
|
||||
Cura.MachineManager.applyRemoteConfiguration(configuration)
|
||||
if(isValidMaterial)
|
||||
{
|
||||
Cura.MachineManager.applyRemoteConfiguration(configuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import Cura 1.0 as Cura
|
|||
|
||||
Instantiator
|
||||
{
|
||||
model: Cura.PrintersModel {}
|
||||
model: Cura.GlobalStacksModel {}
|
||||
|
||||
MenuItem
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ import Cura 1.0 as Cura
|
|||
|
||||
Instantiator
|
||||
{
|
||||
model: Cura.PrintersModel {}
|
||||
model: Cura.GlobalStacksModel {}
|
||||
MenuItem
|
||||
{
|
||||
text: model.metadata["connect_group_name"]
|
||||
|
|
|
@ -93,14 +93,16 @@ Cura.ExpandablePopup
|
|||
width: scroll.width - scroll.leftPadding - scroll.rightPadding
|
||||
property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height
|
||||
|
||||
onHeightChanged:
|
||||
// We use an extra property here, since we only want to to be informed about the content size changes.
|
||||
onContentHeightChanged:
|
||||
{
|
||||
scroll.height = Math.min(height, maximumHeight)
|
||||
scroll.height = Math.min(contentHeight, maximumHeight)
|
||||
popup.height = scroll.height + buttonRow.height
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
scroll.height = Math.min(height, maximumHeight)
|
||||
scroll.height = Math.min(contentHeight, maximumHeight)
|
||||
popup.height = scroll.height + buttonRow.height
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ import Cura 1.0 as Cura
|
|||
ListView
|
||||
{
|
||||
id: listView
|
||||
height: childrenRect.height
|
||||
model: Cura.PrintersModel {}
|
||||
model: Cura.GlobalStacksModel {}
|
||||
section.property: "hasRemoteConnection"
|
||||
property real contentHeight: childrenRect.height
|
||||
|
||||
section.delegate: Label
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue