CURA-4400 optional_extruders cannot be set to disabled extruders anymore

This commit is contained in:
Jack Ha 2018-03-15 15:00:13 +01:00
parent c21b19a910
commit 05cd937df3
3 changed files with 24 additions and 4 deletions

View file

@ -210,6 +210,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
item = {
"id": "",
"name": catalog.i18nc("@menuitem", "Not overridden"),
"enabled": True,
"color": "#ffffff",
"index": -1,
"definition": ""

View file

@ -215,7 +215,8 @@ SettingItem
{
text: model.name
renderType: Text.NativeRendering
color: {
color:
{
if (model.enabled) {
UM.Theme.getColor("setting_control_text")
} else {

View file

@ -27,8 +27,19 @@ SettingItem
onActivated:
{
forceActiveFocus();
propertyProvider.setPropertyValue("value", model.getItem(index).index);
if (model.getItem(index).enabled)
{
forceActiveFocus();
propertyProvider.setPropertyValue("value", model.getItem(index).index);
} else
{
if (propertyProvider.properties.value == -1)
{
control.currentIndex = model.rowCount() - 1; // we know the last item is "Not overriden"
} else {
control.currentIndex = propertyProvider.properties.value; // revert to the old value
}
}
}
onActiveFocusChanged:
@ -192,7 +203,14 @@ SettingItem
{
text: model.name
renderType: Text.NativeRendering
color: UM.Theme.getColor("setting_control_text")
color:
{
if (model.enabled) {
UM.Theme.getColor("setting_control_text")
} else {
UM.Theme.getColor("action_button_disabled_text");
}
}
font: UM.Theme.getFont("default")
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter