From c9191beb6158fc5a341661b1ddced8705548e99c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 28 Aug 2019 11:11:13 +0200 Subject: [PATCH] Fix updating intents list when printer changes Contributes to issue CURA-6600. --- cura/Machines/Models/IntentModel.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/cura/Machines/Models/IntentModel.py b/cura/Machines/Models/IntentModel.py index 5a44883b76..c61d0bfcca 100644 --- a/cura/Machines/Models/IntentModel.py +++ b/cura/Machines/Models/IntentModel.py @@ -6,7 +6,6 @@ from typing import Optional, List, Dict, Any from PyQt5.QtCore import Qt, QObject, pyqtProperty, pyqtSignal from UM.Qt.ListModel import ListModel -from UM.Settings.ContainerRegistry import ContainerRegistry from cura.Machines.ContainerTree import ContainerTree from cura.Settings.IntentManager import IntentManager @@ -25,9 +24,9 @@ class IntentModel(ListModel): self._intent_category = "engineering" - ContainerRegistry.getInstance().containerAdded.connect(self._onChanged) - ContainerRegistry.getInstance().containerRemoved.connect(self._onChanged) - + machine_manager = cura.CuraApplication.CuraApplication.getInstance().getMachineManager() + machine_manager.globalContainerChanged.connect(self._update) + machine_manager.activeStackChanged.connect(self._update) self._update() intentCategoryChanged = pyqtSignal() @@ -42,10 +41,6 @@ class IntentModel(ListModel): def intentCategory(self) -> str: return self._intent_category - def _onChanged(self, container): - if container.getMetaDataEntry("type") == "intent": - self._update() - def _update(self) -> None: new_items = [] # type: List[Dict[str, Any]] global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()