Update the active extruder index when the global container changes. This

fixes a problem when Cura starts with a single extruder printer but the
user then choose a multiextruder printer - CURA-4386
Also added a quality definition in UM3E extruder with the ids of the UM3
extruders, so that the profiles for UM3 are also valid for UM3E and viceversa - CURA-4389
All are related issues with profiles and multiextruder printers
This commit is contained in:
Diego Prado Gesto 2017-09-28 18:02:39 +02:00
parent 61e65d5cb0
commit afb83fac88
8 changed files with 37 additions and 36 deletions

View file

@ -31,16 +31,10 @@ class UserProfilesModel(ProfilesModel):
extruder_manager = ExtruderManager.getInstance()
active_extruder = extruder_manager.getActiveExtruderStack()
extruder_stacks = extruder_manager.getActiveExtruderStacks()
if extruder_stacks:
if multiple_extrusion:
# Place the active extruder at the front of the list.
if active_extruder in extruder_stacks:
extruder_stacks.remove(active_extruder)
extruder_stacks = [active_extruder] + extruder_stacks
else:
# The active extruder is the first in the list and only the active extruder is use to compute the usable qualities
active_extruder = None
extruder_stacks = []
if multiple_extrusion:
# Place the active extruder at the front of the list.
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.
@ -52,9 +46,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 qc.getMetaDataEntry("extruder") == active_extruder.definition.getMetaDataEntry("quality_definition")]
filtered_quality_changes = [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()]
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 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