Merge branch '2.1' of https://github.com/Ultimaker/Cura into 2.1

This commit is contained in:
Tamara Hogenhout 2016-01-13 17:33:12 +01:00
commit 0887eeb075
2 changed files with 16 additions and 13 deletions

View File

@ -6,14 +6,13 @@
"line_width": "nozzle_size",
"layer_height": "layer_height",
"layer_height_0": "bottom_thickness",
"shell_thickness": "wall_thickness",
"wall_thickness": "wall_thickness",
"top_bottom_thickness": "solid_layer_thickness",
"top_thickness": "0 if (solid_top == \"False\") else solid_layer_thickness",
"bottom_thickness": "0 if (solid_bottom == \"False\") else solid_layer_thickness",
"skin_no_small_gaps_heuristic": "fix_horrible_extensive_stitching",
"infill_sparse_density": "fill_density",
"infill_overlap": "fill_overlap",
"infill_before_walls": "perimeter_before_infill",
"infill_before_walls": "False if (perimeter_before_infill == \"True\") else True",
"material_print_temperature": "print_temperature",
"material_bed_temperature": "print_bed_temperature",
"material_diameter": "filament_diameter",
@ -24,13 +23,13 @@
"retraction_min_travel": "retraction_min_travel",
"retraction_hop": "retraction_hop",
"speed_print": "print_speed",
"speed_infill": "infill_speed",
"speed_wall_0": "inset0_speed",
"speed_wall_x": "insetx_speed",
"speed_topbottom": "solidarea_speed",
"speed_travel": "travel_speed",
"speed_infill": "infill_speed if (float(infill_speed) != 0) else print_speed",
"speed_wall_0": "inset0_speed if (float(inset0_speed) != 0) else print_speed",
"speed_wall_x": "insetx_speed if (float(insetx_speed) != 0) else print_speed",
"speed_topbottom": "solidarea_speed if (float(solidarea_speed) != 0) else print_speed",
"speed_travel": "travel_speed if (float(travel_speed) != 0) else travel_speed",
"speed_layer_0": "bottom_layer_speed",
"retraction_combing": "retraction_combing",
"retraction_combing": "True if (retraction_combing == \"All\" or retraction_combing == \"No Skin\") else False",
"cool_fan_enabled": "fan_enabled",
"cool_fan_speed_min": "fan_speed",
"cool_fan_speed_max": "fan_speed_max",

View File

@ -96,7 +96,11 @@ class LegacyProfileReader(ProfileReader):
for new_setting in dict_of_doom["translation"]: #Evaluate all new settings that would get a value from the translations.
old_setting_expression = dict_of_doom["translation"][new_setting]
compiled = compile(old_setting_expression, new_setting, "eval")
try:
new_value = eval(compiled, {"math": math}, legacy_settings) #Pass the legacy settings as local variables to allow access to in the evaluation.
if profile.getSettingValue(new_setting) != new_value: #Not equal to the default.
profile.setSettingValue(new_setting, new_value) #Store the setting in the profile!
except Exception as e: #Probably some setting name that was missing or something else that went wrong in the ini file.
Logger.log("w", "Setting " + new_setting + " could not be set because the evaluation failed. Something is probably missing from the imported legacy profile.")
return profile