Add warning icons for extruder visibility in SimulationView

Introduces warning icons in the SimulationView menu to indicate when extruder visibility is low or unchecked. Updates layout logic to accommodate the new icons and increments the plugin version to 1.0.2.
This commit is contained in:
HellAholic 2025-11-19 09:54:41 +01:00
parent f38516e764
commit 6b01d85fb1
2 changed files with 46 additions and 9 deletions

View file

@ -53,17 +53,38 @@ Cura.ExpandableComponent
UM.Label
{
id: lineTypeLabel
text: layerTypeCombobox.currentText
anchors
{
left: colorSchemeLabel.right
leftMargin: UM.Theme.getSize("default_margin").width
right: parent.right
}
anchors.left: colorSchemeLabel.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
height: parent.height
elide: Text.ElideRight
font: UM.Theme.getFont("medium")
}
UM.ColorImage
{
id: warningIcon
anchors
{
left: lineTypeLabel.right
leftMargin: UM.Theme.getSize("narrow_margin").width
verticalCenter: parent.verticalCenter
}
width: UM.Theme.getSize("section_icon").width
height: UM.Theme.getSize("section_icon").height
source: UM.Theme.getIcon("Warning")
color: UM.Theme.getColor("warning")
visible: {
// Check if any extruder is unchecked
for (var i = 0; i < viewSettings.extruder_opacities.length; i++) {
if (viewSettings.extruder_opacities[i] <= 0.5 && viewSettings.extruder_opacities[i] !== undefined && viewSettings.extruder_opacities[i] !== "") {
return true;
}
}
return false;
}
}
}
contentItem: Column
@ -212,11 +233,27 @@ Cura.ExpandableComponent
{
verticalCenter: parent.verticalCenter
left: extrudersModelCheckBox.left
right: extrudersModelCheckBox.right
right: extruderWarningIcon.visible ? extruderWarningIcon.left : swatch.left
leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2)
rightMargin: UM.Theme.getSize("default_margin").width * 2
rightMargin: UM.Theme.getSize("narrow_margin").width
}
}
UM.ColorImage
{
id: extruderWarningIcon
anchors
{
verticalCenter: parent.verticalCenter
right: swatch.left
rightMargin: UM.Theme.getSize("narrow_margin").width
}
width: UM.Theme.getSize("section_icon").width
height: UM.Theme.getSize("section_icon").height
source: UM.Theme.getIcon("Warning")
color: UM.Theme.getColor("warning")
visible: !extrudersModelCheckBox.checked
}
}
}