mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 16:27:51 -06:00
Working on fixing several issues with profiles - CURA-4327
This commit is contained in:
parent
0fa3bdd68b
commit
cf94c8d37d
4 changed files with 88 additions and 30 deletions
|
@ -25,17 +25,30 @@ class UserProfilesModel(ProfilesModel):
|
|||
machine_definition = quality_manager.getParentMachineDefinition(global_container_stack.getBottom())
|
||||
quality_changes_list = quality_manager.findAllQualityChangesForMachine(machine_definition)
|
||||
|
||||
# Fetch the list of qualities
|
||||
quality_list = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack,
|
||||
ExtruderManager.getInstance().getActiveExtruderStacks())
|
||||
# Detecting if the machine has multiple extrusion
|
||||
multiple_extrusion = False
|
||||
# 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()
|
||||
if active_extruder in extruder_stacks:
|
||||
multiple_extrusion = True
|
||||
extruder_stacks.remove(active_extruder)
|
||||
extruder_stacks = [active_extruder] + extruder_stacks
|
||||
|
||||
# Fetch the list of useable qualities across all extruders.
|
||||
# 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)
|
||||
|
||||
# Filter the quality_change by the list of available quality_types
|
||||
quality_type_set = set([x.getMetaDataEntry("quality_type") for x in quality_list])
|
||||
filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set]
|
||||
|
||||
#Only display the global quality changes.
|
||||
#Otherwise you get multiple copies of every quality changes profile.
|
||||
#The actual profile switching goes by profile name (not ID), and as long as the names are consistent, switching to any of the profiles will cause all stacks to switch.
|
||||
filtered_quality_changes = list(filter(lambda quality_changes: quality_changes.getMetaDataEntry("extruder") is None, filtered_quality_changes))
|
||||
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 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]
|
||||
|
||||
return filtered_quality_changes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue