mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Fix updating intents list when printer changes
Contributes to issue CURA-6600.
This commit is contained in:
parent
64a8aff627
commit
c9191beb61
1 changed files with 3 additions and 8 deletions
|
@ -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()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue