mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 04:55:54 +08:00
Update intent categories upon adding containers or changing configuration
Also upon start-up. Contributes to issue CURA-6597.
This commit is contained in:
parent
d2daa15a13
commit
bd2237dc45
@ -6,6 +6,7 @@ import collections
|
||||
|
||||
from cura.Settings.IntentManager import IntentManager
|
||||
from UM.Qt.ListModel import ListModel
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry #To update the list if anything changes.
|
||||
|
||||
from UM.i18n import i18nCatalog
|
||||
catalog = i18nCatalog("cura")
|
||||
@ -34,6 +35,12 @@ class IntentCategoryModel(ListModel):
|
||||
self.addRoleName(self.IntentCategoryRole, "intent_category")
|
||||
self.addRoleName(self.WeightRole, "weight")
|
||||
|
||||
ContainerRegistry.getInstance().containerAdded.connect(self._onChanged)
|
||||
ContainerRegistry.getInstance().containerRemoved.connect(self._onChanged)
|
||||
IntentManager.getInstance().configurationChanged.connect(self._onChanged)
|
||||
|
||||
self.update()
|
||||
|
||||
## Updates the list of intents.
|
||||
def update(self) -> None:
|
||||
available_categories = IntentManager.getInstance().currentAvailableIntentCategories()
|
||||
|
Loading…
x
Reference in New Issue
Block a user