From bd2237dc45371871c541a718a370eeaaa687b2f5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 4 Jul 2019 11:31:59 +0200 Subject: [PATCH] Update intent categories upon adding containers or changing configuration Also upon start-up. Contributes to issue CURA-6597. --- cura/Machines/Models/IntentCategoryModel.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cura/Machines/Models/IntentCategoryModel.py b/cura/Machines/Models/IntentCategoryModel.py index ac69191ca1..0766360892 100644 --- a/cura/Machines/Models/IntentCategoryModel.py +++ b/cura/Machines/Models/IntentCategoryModel.py @@ -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()