Signal are being emmitted before settings are updated. This is causing the combobox to update with the previous value. Only when using infill_pattern setting though. No idea what is causing this. This is a workaround for now.

CURA-9793
This commit is contained in:
Joey de l'Arago 2022-12-07 17:16:26 +01:00
parent 443252ae10
commit 8012cb5360

View File

@ -44,6 +44,10 @@ Cura.ComboBox {
if (propertyProvider.properties.value == key) if (propertyProvider.properties.value == key)
{ {
print("propertyProvider.properties.value: " + propertyProvider.properties.value)
print("key: " + key)
print("currentIndex: " + currentIndex)
print("i: " + i)
// The combobox is cleared after each value change so the currentIndex must be set each time. // The combobox is cleared after each value change so the currentIndex must be set each time.
currentIndex = i currentIndex = i
} }
@ -51,6 +55,17 @@ Cura.ComboBox {
} }
} }
// Updates to the setting are delayed by interval. The signal onIsValueUsedChanged() is emitted early for some reason.
// This causes the selected value in the combobox to be updated to the previous value. (This issue is present with infill_pattern setting)
// This is a hack. If you see this in the future, try removing it and see if the combobox still works.
Timer
{
id: updateTimer
interval: 100
repeat: false
onTriggered: comboboxModel.updateModel(false)
}
property UM.SettingPropertyProvider propertyProvider: UM.SettingPropertyProvider property UM.SettingPropertyProvider propertyProvider: UM.SettingPropertyProvider
{ {
id: propertyProvider id: propertyProvider
@ -61,8 +76,8 @@ Cura.ComboBox {
Connections Connections
{ {
target: propertyProvider target: propertyProvider
function onContainerStackChanged() { comboboxModel.updateModel() } function onContainerStackChanged() { updateTimer.restart() }
function onIsValueUsedChanged() { comboboxModel.updateModel() } function onIsValueUsedChanged() { updateTimer.restart() }
} }
onCurrentIndexChanged: parseValueAndUpdateSetting() onCurrentIndexChanged: parseValueAndUpdateSetting()
@ -80,6 +95,7 @@ Cura.ComboBox {
{ {
if (updateAllExtruders) if (updateAllExtruders)
{ {
print("UPDATING ALL WITH VALUE: " + value)
Cura.MachineManager.setSettingForAllExtruders(propertyProvider.key, "value", value) Cura.MachineManager.setSettingForAllExtruders(propertyProvider.key, "value", value)
} }
else else