From beac50d44f10a723061a3bf22fb3c5e19f7cb918 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 26 Feb 2025 13:02:41 +0100 Subject: [PATCH 1/2] Fix fallback for when a material was selected that didn't have the current intent. CURA-12406 --- cura/Machines/Models/ActiveIntentQualitiesModel.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py index f9acb9a970..41119f2c10 100644 --- a/cura/Machines/Models/ActiveIntentQualitiesModel.py +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -72,6 +72,12 @@ class ActiveIntentQualitiesModel(ListModel): new_items.append(intent) added_quality_type_set.add(intent["quality_type"]) + # If there aren't any possibilities when the Intent is kept the same, set it 'back' to default. + if len(new_items) == 0 and self._intent_category != "default": + IntentManager.getInstance().selectIntent("default", global_stack.quality.getMetaDataEntry("quality_type")) + self._update() + return + new_items = sorted(new_items, key=lambda x: x["layer_height"]) self.setItems(new_items) From 4e7807b0fc729bcb93e07c08f926860b5ffd265c Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 26 Feb 2025 13:25:02 +0100 Subject: [PATCH 2/2] Prevent crash when the quality-type is _actually_ not supported. part of CURA-12406 --- cura/Machines/Models/ActiveIntentQualitiesModel.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py index 41119f2c10..ce0e958368 100644 --- a/cura/Machines/Models/ActiveIntentQualitiesModel.py +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -72,9 +72,10 @@ class ActiveIntentQualitiesModel(ListModel): new_items.append(intent) added_quality_type_set.add(intent["quality_type"]) - # If there aren't any possibilities when the Intent is kept the same, set it 'back' to default. - if len(new_items) == 0 and self._intent_category != "default": - IntentManager.getInstance().selectIntent("default", global_stack.quality.getMetaDataEntry("quality_type")) + # If there aren't any possibilities when the Intent is kept the same, attempt to set it 'back' to default. + current_quality_type = global_stack.quality.getMetaDataEntry("quality_type") + if len(new_items) == 0 and self._intent_category != "default" and current_quality_type != "not_supported": + IntentManager.getInstance().selectIntent("default", current_quality_type) self._update() return