diff --git a/cura/Machines/Models/FirstStartMachineActionsModel.py b/cura/Machines/Models/FirstStartMachineActionsModel.py index aad5372cde..240571e6dc 100644 --- a/cura/Machines/Models/FirstStartMachineActionsModel.py +++ b/cura/Machines/Models/FirstStartMachineActionsModel.py @@ -35,6 +35,8 @@ class FirstStartMachineActionsModel(ListModel): self._application = application self._application.initializationFinished.connect(self._initialize) + self._previous_global_stack = None + def _initialize(self) -> None: self._application.getMachineManager().globalContainerChanged.connect(self._update) self._update() @@ -86,6 +88,12 @@ class FirstStartMachineActionsModel(ListModel): self.setItems([]) return + # Do not update if the machine has not been switched. This can cause the SettingProviders on the Machine + # Setting page to do a force update, but they can use potential outdated cached values. + if self._previous_global_stack is not None and global_stack.getId() == self._previous_global_stack.getId(): + return + self._previous_global_stack = global_stack + definition_id = global_stack.definition.getId() first_start_actions = self._application.getMachineActionManager().getFirstStartActions(definition_id) diff --git a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml index 007db41f2b..3b31a5de36 100644 --- a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml @@ -285,18 +285,30 @@ Item optionModel: ListModel { id: extruderCountModel + Component.onCompleted: { - extruderCountModel.clear() + update() + } + + function update() + { + clear() for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++) { // Use String as value. JavaScript only has Number. PropertyProvider.setPropertyValue() // takes a QVariant as value, and Number gets translated into a float. This will cause problem // for integer settings such as "Number of Extruders". - extruderCountModel.append({ text: String(i), value: String(i) }) + append({ text: String(i), value: String(i) }) } } } + + Connections + { + target: Cura.MachineManager + onGlobalContainerChanged: extruderCountModel.update() + } } } } diff --git a/resources/qml/MachineSettings/GcodeTextArea.qml b/resources/qml/MachineSettings/GcodeTextArea.qml index d1f8f51f01..3914687fc8 100644 --- a/resources/qml/MachineSettings/GcodeTextArea.qml +++ b/resources/qml/MachineSettings/GcodeTextArea.qml @@ -69,6 +69,7 @@ UM.TooltipArea background: Rectangle { color: UM.Theme.getColor("main_background") + anchors.fill: parent border.color: { diff --git a/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml b/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml index 236f9a7dd0..2eaaed4524 100644 --- a/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml +++ b/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml @@ -76,6 +76,4 @@ NumericTextFieldWithUnit forceUpdateOnChangeFunction() } } - - // TODO: add forceUpdateOnChangeFunction: }