Просмотр исходного кода

Emit activeStackChanged as documented when containers in the active stack change

This fixes updating the intent models when you switch nozzles. Among other things, probably.

Contributes to issue CURA-6600.
Ghostkeeper 5 лет назад
Родитель
Сommit
f4a2f3efa6

+ 1 - 0
cura/Machines/Models/QualityProfilesDropDownMenuModel.py

@@ -45,6 +45,7 @@ class QualityProfilesDropDownMenuModel(ListModel):
 
         application.globalContainerStackChanged.connect(self._onChange)
         machine_manager.activeQualityGroupChanged.connect(self._onChange)
+        machine_manager.activeStackChanged.connect(self._onChange)
         machine_manager.extruderChanged.connect(self._onChange)
 
         self._layer_height_unit = ""  # This is cached

+ 4 - 1
cura/Settings/MachineManager.py

@@ -46,7 +46,6 @@ catalog = i18nCatalog("cura")
 from cura.Settings.GlobalStack import GlobalStack
 if TYPE_CHECKING:
     from cura.CuraApplication import CuraApplication
-    from cura.Settings.CuraContainerStack import CuraContainerStack
     from cura.Machines.MaterialNode import MaterialNode
     from cura.Machines.QualityChangesGroup import QualityChangesGroup
     from cura.Machines.QualityGroup import QualityGroup
@@ -265,7 +264,11 @@ class MachineManager(QObject):
 
     def _onActiveExtruderStackChanged(self) -> None:
         self.blurSettings.emit()  # Ensure no-one has focus.
+        if self._active_container_stack is not None:
+            self._active_container_stack.pyqtContainersChanged.disconnect(self.activeStackChanged)  # Unplug from the old one.
         self._active_container_stack = ExtruderManager.getInstance().getActiveExtruderStack()
+        if self._active_container_stack is not None:
+            self._active_container_stack.pyqtContainersChanged.connect(self.activeStackChanged)  # Plug into the new one.
 
     def __emitChangedSignals(self) -> None:
         self.activeQualityChanged.emit()