Fix updating intents list when printer changes

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-28 11:11:13 +02:00
parent 64a8aff627
commit c9191beb61
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276

View file

@ -6,7 +6,6 @@ from typing import Optional, List, Dict, Any
from PyQt5.QtCore import Qt, QObject, pyqtProperty, pyqtSignal from PyQt5.QtCore import Qt, QObject, pyqtProperty, pyqtSignal
from UM.Qt.ListModel import ListModel from UM.Qt.ListModel import ListModel
from UM.Settings.ContainerRegistry import ContainerRegistry
from cura.Machines.ContainerTree import ContainerTree from cura.Machines.ContainerTree import ContainerTree
from cura.Settings.IntentManager import IntentManager from cura.Settings.IntentManager import IntentManager
@ -25,9 +24,9 @@ class IntentModel(ListModel):
self._intent_category = "engineering" self._intent_category = "engineering"
ContainerRegistry.getInstance().containerAdded.connect(self._onChanged) machine_manager = cura.CuraApplication.CuraApplication.getInstance().getMachineManager()
ContainerRegistry.getInstance().containerRemoved.connect(self._onChanged) machine_manager.globalContainerChanged.connect(self._update)
machine_manager.activeStackChanged.connect(self._update)
self._update() self._update()
intentCategoryChanged = pyqtSignal() intentCategoryChanged = pyqtSignal()
@ -42,10 +41,6 @@ class IntentModel(ListModel):
def intentCategory(self) -> str: def intentCategory(self) -> str:
return self._intent_category return self._intent_category
def _onChanged(self, container):
if container.getMetaDataEntry("type") == "intent":
self._update()
def _update(self) -> None: def _update(self) -> None:
new_items = [] # type: List[Dict[str, Any]] new_items = [] # type: List[Dict[str, Any]]
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()