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 = { item = {
"id": "", "id": "",
"name": catalog.i18nc("@menuitem", "Not overridden"), "name": catalog.i18nc("@menuitem", "Not overridden"),
"enabled": True,
"color": "#ffffff", "color": "#ffffff",
"index": -1, "index": -1,
"definition": "" "definition": ""

View file

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

View file

@ -26,9 +26,20 @@ SettingItem
textRole: "name" textRole: "name"
onActivated: onActivated:
{
if (model.getItem(index).enabled)
{ {
forceActiveFocus(); forceActiveFocus();
propertyProvider.setPropertyValue("value", model.getItem(index).index); 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: onActiveFocusChanged:
@ -192,7 +203,14 @@ SettingItem
{ {
text: model.name text: model.name
renderType: Text.NativeRendering 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") font: UM.Theme.getFont("default")
elide: Text.ElideRight elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter