diff --git a/plugins/LegacyProfileReader/DictionaryOfDoom.json b/plugins/LegacyProfileReader/DictionaryOfDoom.json index 6ff6dac4dd..cc6d867066 100644 --- a/plugins/LegacyProfileReader/DictionaryOfDoom.json +++ b/plugins/LegacyProfileReader/DictionaryOfDoom.json @@ -1,19 +1,18 @@ { "source_version": "15.04", "target_version": 1, - + "translation": { "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", diff --git a/plugins/LegacyProfileReader/LegacyProfileReader.py b/plugins/LegacyProfileReader/LegacyProfileReader.py index 5d89a85978..b32a317688 100644 --- a/plugins/LegacyProfileReader/LegacyProfileReader.py +++ b/plugins/LegacyProfileReader/LegacyProfileReader.py @@ -74,7 +74,7 @@ class LegacyProfileReader(ProfileReader): try: with open(os.path.join(PluginRegistry.getInstance().getPluginPath("LegacyProfileReader"), "DictionaryOfDoom.json"), "r", -1, "utf-8") as f: - dict_of_doom = json.load(f) #Parse the Dictionary of Doom. + dict_of_doom = json.load(f) #Parse the Dictionary of Doom. except IOError as e: Logger.log("e", "Could not open DictionaryOfDoom.json for reading: %s", str(e)) return None @@ -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") - new_value = eval(compiled, {"math": math}, legacy_settings) #Pass the legacy settings as local variables to allow access to in the evaluation. - profile.setSettingValue(new_setting, new_value) #Store the setting in the profile! + 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 \ No newline at end of file