diff --git a/cura/Settings/ProfilesModel.py b/cura/Settings/ProfilesModel.py index 6ba38dcf48..65ac556e78 100644 --- a/cura/Settings/ProfilesModel.py +++ b/cura/Settings/ProfilesModel.py @@ -53,7 +53,7 @@ class ProfilesModel(InstanceContainersModel): def _fetchInstanceContainers(self): global_container_stack = Application.getInstance().getGlobalContainerStack() if global_container_stack is None: - return [] + return {}, {} global_stack_definition = global_container_stack.getBottom() # Get the list of extruders and place the selected extruder at the front of the list. @@ -83,7 +83,7 @@ class ProfilesModel(InstanceContainersModel): if quality.getMetaDataEntry("quality_type") not in quality_type_set: result.append(quality) - return result + return {item.getId():item for item in result}, {} ## Re-computes the items in this model, and adds the layer height role. def _recomputeItems(self): diff --git a/cura/Settings/QualityAndUserProfilesModel.py b/cura/Settings/QualityAndUserProfilesModel.py index 9d7d913d5e..06b9733249 100644 --- a/cura/Settings/QualityAndUserProfilesModel.py +++ b/cura/Settings/QualityAndUserProfilesModel.py @@ -18,7 +18,7 @@ class QualityAndUserProfilesModel(ProfilesModel): def _fetchInstanceContainers(self): global_container_stack = Application.getInstance().getGlobalContainerStack() if not global_container_stack: - return [] + return {}, {} # Fetch the list of quality changes. quality_manager = QualityManager.getInstance() @@ -50,19 +50,21 @@ class QualityAndUserProfilesModel(ProfilesModel): # The actual list of quality profiles come from the first extruder in the extruder list. quality_list = quality_manager.findAllUsableQualitiesForMachineAndExtruders(global_container_stack, extruder_stacks) + result = {quality.getId():quality for quality in quality_list} # Filter the quality_change by the list of available quality_types quality_type_set = set([x.getMetaDataEntry("quality_type") for x in quality_list]) if multiple_extrusion: # If the printer has multiple extruders then quality changes related to the current extruder are kept - filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and + filtered_quality_changes = {qc.getId():qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and qc.getMetaDataEntry("extruder") is not None and (qc.getMetaDataEntry("extruder") == active_extruder.definition.getMetaDataEntry("quality_definition") or - qc.getMetaDataEntry("extruder") == active_extruder.definition.getId())] + qc.getMetaDataEntry("extruder") == active_extruder.definition.getId())} else: # If not, the quality changes of the global stack are selected - filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and - qc.getMetaDataEntry("extruder") is None] + filtered_quality_changes = {qc.getId():qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and + qc.getMetaDataEntry("extruder") is None} + result.update(filtered_quality_changes) - return quality_list + filtered_quality_changes + return result, {} diff --git a/cura/Settings/UserProfilesModel.py b/cura/Settings/UserProfilesModel.py index aa815ef4aa..a5fc1bc7c2 100644 --- a/cura/Settings/UserProfilesModel.py +++ b/cura/Settings/UserProfilesModel.py @@ -18,7 +18,7 @@ class UserProfilesModel(ProfilesModel): def _fetchInstanceContainers(self): global_container_stack = Application.getInstance().getGlobalContainerStack() if not global_container_stack: - return [] + return {}, {} # Fetch the list of quality changes. quality_manager = QualityManager.getInstance() @@ -27,7 +27,7 @@ class UserProfilesModel(ProfilesModel): # Detecting if the machine has multiple extrusion multiple_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1 - # Get the list of extruders and place the selected extruder at the front of the list. + # Get the list of extruders and place the selected extruder at the front of the list. extruder_manager = ExtruderManager.getInstance() active_extruder = extruder_manager.getActiveExtruderStack() extruder_stacks = extruder_manager.getActiveExtruderStacks() @@ -56,13 +56,13 @@ class UserProfilesModel(ProfilesModel): if multiple_extrusion: # If the printer has multiple extruders then quality changes related to the current extruder are kept - filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and + filtered_quality_changes = {qc.getId():qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and qc.getMetaDataEntry("extruder") is not None and (qc.getMetaDataEntry("extruder") == active_extruder.definition.getMetaDataEntry("quality_definition") or - qc.getMetaDataEntry("extruder") == active_extruder.definition.getId())] + qc.getMetaDataEntry("extruder") == active_extruder.definition.getId())} else: # If not, the quality changes of the global stack are selected - filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and - qc.getMetaDataEntry("extruder") is None] + filtered_quality_changes = {qc.getId():qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and + qc.getMetaDataEntry("extruder") is None} - return filtered_quality_changes + return filtered_quality_changes, {}