diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2017-10-09 15:34:53 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2017-10-09 15:35:30 +0300 |
commit | 1c5d352b8819f6598d3bae2b2e4a68d3c01f0f43 (patch) | |
tree | 3a5014a71e4b5956e87d0af8e6c2e9480475c98c /cura | |
parent | 14936f799933d7ef91e6451845fa88e63da66f4b (diff) |
Fix the case when active_extruder is None
Diffstat (limited to 'cura')
-rw-r--r-- | cura/Settings/QualityAndUserProfilesModel.py | 3 | ||||
-rw-r--r-- | cura/Settings/UserProfilesModel.py | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/cura/Settings/QualityAndUserProfilesModel.py b/cura/Settings/QualityAndUserProfilesModel.py index f2728aff14..602f8768da 100644 --- a/cura/Settings/QualityAndUserProfilesModel.py +++ b/cura/Settings/QualityAndUserProfilesModel.py @@ -41,6 +41,9 @@ class QualityAndUserProfilesModel(ProfilesModel): new_extruder_stacks = []
if active_extruder is not None:
new_extruder_stacks = [active_extruder]
+ else:
+ # if there is no active extruder, use the first one in the active extruder stacks
+ active_extruder = extruder_stacks[0]
extruder_stacks = new_extruder_stacks + extruder_stacks
# Fetch the list of useable qualities across all extruders.
diff --git a/cura/Settings/UserProfilesModel.py b/cura/Settings/UserProfilesModel.py index 587e27f359..aa815ef4aa 100644 --- a/cura/Settings/UserProfilesModel.py +++ b/cura/Settings/UserProfilesModel.py @@ -41,6 +41,9 @@ class UserProfilesModel(ProfilesModel): new_extruder_stacks = []
if active_extruder is not None:
new_extruder_stacks = [active_extruder]
+ else:
+ # if there is no active extruder, use the first one in the active extruder stacks
+ active_extruder = extruder_stacks[0]
extruder_stacks = new_extruder_stacks + extruder_stacks
# Fetch the list of useable qualities across all extruders.
@@ -55,8 +58,8 @@ class UserProfilesModel(ProfilesModel): # 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") 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.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
|