Hide adhesion & support options if they are disabled for the current printer

This commit is contained in:
fieldOfView 2017-08-23 13:26:47 +02:00
parent b58fb0d05d
commit 6656cd0c36

View File

@ -248,25 +248,30 @@ Item
} }
} }
Item Grid
{ {
id: helpersCell id: helpersCell
anchors.top: infillCellRight.bottom anchors.top: infillCellRight.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height * 2 anchors.topMargin: UM.Theme.getSize("default_margin").height * 2
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.right: parent.right anchors.right: parent.right
height: childrenRect.height anchors.rightMargin: UM.Theme.getSize("default_margin").width
columns: 2
columnSpacing: UM.Theme.getSize("default_margin").width
rowSpacing: UM.Theme.getSize("default_lining").height
Text Text
{ {
id: enableSupportLabel id: enableSupportLabel
anchors.left: parent.left visible: enableSupportCheckBox.visible
anchors.leftMargin: UM.Theme.getSize("default_margin").width height: enableSupportCheckBox.height
anchors.verticalCenter: enableSupportCheckBox.verticalCenter width: base.width * .45 - 3 * UM.Theme.getSize("default_margin").width
width: parent.width * .45 - 3 * UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Generate Support")
text: catalog.i18nc("@label", "Generate Support"); font: UM.Theme.getFont("default")
font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text")
color: UM.Theme.getColor("text"); verticalAlignment: Text.AlignVCenter
} }
CheckBox CheckBox
@ -274,14 +279,11 @@ Item
id: enableSupportCheckBox id: enableSupportCheckBox
property alias _hovered: enableSupportMouseArea.containsMouse property alias _hovered: enableSupportMouseArea.containsMouse
anchors.top: parent.top style: UM.Theme.styles.checkbox
anchors.left: enableSupportLabel.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
style: UM.Theme.styles.checkbox;
enabled: base.settingsEnabled enabled: base.settingsEnabled
visible: supportEnabled.properties.enabled == "True"
checked: supportEnabled.properties.value == "True"; checked: supportEnabled.properties.value == "True"
MouseArea MouseArea
{ {
@ -296,7 +298,7 @@ Item
} }
onEntered: onEntered:
{ {
base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x - UM.Theme.getSize("default_margin").width, 0),
catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")); catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing."));
} }
onExited: onExited:
@ -309,20 +311,20 @@ Item
Text Text
{ {
id: supportExtruderLabel id: supportExtruderLabel
visible: (supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1) visible: supportExtruderCombobox.visible
anchors.left: parent.left height: supportExtruderCombobox.height
anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: supportExtruderCombobox.verticalCenter width: base.width * .45 - 3 * UM.Theme.getSize("default_margin").width
width: parent.width * .45 - 3 * UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Support Extruder")
text: catalog.i18nc("@label", "Support Extruder"); font: UM.Theme.getFont("default")
font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text")
color: UM.Theme.getColor("text"); verticalAlignment: Text.AlignVCenter
} }
ComboBox ComboBox
{ {
id: supportExtruderCombobox id: supportExtruderCombobox
visible: (supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1) visible: height > 0
model: extruderModel model: extruderModel
property string color_override: "" // for manually setting values property string color_override: "" // for manually setting values
@ -339,20 +341,6 @@ Item
textRole: 'text' // this solves that the combobox isn't populated in the first time Cura is started textRole: 'text' // this solves that the combobox isn't populated in the first time Cura is started
anchors.top: enableSupportCheckBox.bottom
anchors.topMargin:
{
if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1))
{
return UM.Theme.getSize("default_margin").height;
}
else
{
return 0;
}
}
anchors.left: supportExtruderLabel.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
width: parent.width * .55 width: parent.width * .55
height: height:
{ {
@ -387,7 +375,7 @@ Item
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
onEntered: onEntered:
{ {
base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x - UM.Theme.getSize("default_margin").width, 0),
catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air."));
} }
onExited: onExited:
@ -409,14 +397,14 @@ Item
Text Text
{ {
id: adhesionHelperLabel id: adhesionHelperLabel
anchors.left: parent.left visible: adhesionCheckBox.visible
anchors.leftMargin: UM.Theme.getSize("default_margin").width height: adhesionCheckBox.height
anchors.verticalCenter: adhesionCheckBox.verticalCenter width: base.width * .45 - 3 * UM.Theme.getSize("default_margin").width
width: parent.width * .45 - 3 * UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Build Plate Adhesion")
text: catalog.i18nc("@label", "Build Plate Adhesion"); font: UM.Theme.getFont("default")
font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text")
color: UM.Theme.getColor("text");
elide: Text.ElideRight elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
} }
CheckBox CheckBox
@ -424,14 +412,10 @@ Item
id: adhesionCheckBox id: adhesionCheckBox
property alias _hovered: adhesionMouseArea.containsMouse property alias _hovered: adhesionMouseArea.containsMouse
anchors.top: supportExtruderCombobox.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height * 2
anchors.left: adhesionHelperLabel.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
//: Setting enable printing build-plate adhesion helper checkbox //: Setting enable printing build-plate adhesion helper checkbox
style: UM.Theme.styles.checkbox; style: UM.Theme.styles.checkbox;
enabled: base.settingsEnabled enabled: base.settingsEnabled
visible: platformAdhesionType.properties.enabled == "True"
checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none"
@ -459,7 +443,7 @@ Item
} }
onEntered: onEntered:
{ {
base.showTooltip(adhesionCheckBox, Qt.point(-adhesionCheckBox.x, 0), base.showTooltip(adhesionCheckBox, Qt.point(-adhesionCheckBox.x - UM.Theme.getSize("default_margin").width, 0),
catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards."));
} }
onExited: onExited:
@ -582,7 +566,7 @@ Item
containerStackId: Cura.MachineManager.activeMachineId containerStackId: Cura.MachineManager.activeMachineId
key: "adhesion_type" key: "adhesion_type"
watchedProperties: [ "value" ] watchedProperties: [ "value", "enabled" ]
storeIndex: 0 storeIndex: 0
} }
@ -592,7 +576,7 @@ Item
containerStackId: Cura.MachineManager.activeMachineId containerStackId: Cura.MachineManager.activeMachineId
key: "support_enable" key: "support_enable"
watchedProperties: [ "value", "description" ] watchedProperties: [ "value", "enabled", "description" ]
storeIndex: 0 storeIndex: 0
} }