mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Fixed legacy profile reader
Updated some settings that were changed from 2.1 to 2.2. Also fixed some architecture changes that were not changed correctly (or at all) CURA-1493 and CURA-1779
This commit is contained in:
parent
286949dad1
commit
e3d4a33954
3 changed files with 13 additions and 8 deletions
|
@ -170,6 +170,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
profile.addMetaDataEntry("material", self._activeMaterialId())
|
profile.addMetaDataEntry("material", self._activeMaterialId())
|
||||||
else:
|
else:
|
||||||
profile.setDefinition(ContainerRegistry.getInstance().findDefinitionContainers(id="fdmprinter")[0])
|
profile.setDefinition(ContainerRegistry.getInstance().findDefinitionContainers(id="fdmprinter")[0])
|
||||||
|
|
||||||
ContainerRegistry.getInstance().addContainer(profile)
|
ContainerRegistry.getInstance().addContainer(profile)
|
||||||
|
|
||||||
## Gets a list of profile writer plugins
|
## Gets a list of profile writer plugins
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"source_version": "15.04",
|
"source_version": "15.04",
|
||||||
"target_version": 1,
|
"target_version": 2,
|
||||||
|
|
||||||
"translation": {
|
"translation": {
|
||||||
"machine_nozzle_size": "nozzle_size",
|
"machine_nozzle_size": "nozzle_size",
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
"retraction_amount": "retraction_amount",
|
"retraction_amount": "retraction_amount",
|
||||||
"retraction_speed": "retraction_speed",
|
"retraction_speed": "retraction_speed",
|
||||||
"retraction_min_travel": "retraction_min_travel",
|
"retraction_min_travel": "retraction_min_travel",
|
||||||
"retraction_hop": "retraction_hop",
|
"retraction_hop_enabled": "retraction_hop != 0",
|
||||||
"speed_print": "print_speed",
|
"speed_print": "print_speed",
|
||||||
"speed_infill": "infill_speed if (float(infill_speed) != 0) else print_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_0": "inset0_speed if (float(inset0_speed) != 0) else print_speed",
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
"speed_topbottom": "solidarea_speed if (float(solidarea_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_travel": "travel_speed if (float(travel_speed) != 0) else travel_speed",
|
||||||
"speed_layer_0": "bottom_layer_speed",
|
"speed_layer_0": "bottom_layer_speed",
|
||||||
"retraction_combing": "True if (retraction_combing == \"All\" or retraction_combing == \"No Skin\") else False",
|
"retraction_combing": "\"all\" if retraction_combing == \"All\" else \"noskin\" if retraction_combing == \"No Skin\" else \"off\"",
|
||||||
"cool_fan_enabled": "fan_enabled",
|
"cool_fan_enabled": "fan_enabled",
|
||||||
"cool_fan_speed_min": "fan_speed",
|
"cool_fan_speed_min": "fan_speed",
|
||||||
"cool_fan_speed_max": "fan_speed_max",
|
"cool_fan_speed_max": "fan_speed_max",
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
"meshfix_union_all_remove_holes": "fix_horrible_union_all_type_b",
|
"meshfix_union_all_remove_holes": "fix_horrible_union_all_type_b",
|
||||||
"meshfix_extensive_stitching": "fix_horrible_extensive_stitching",
|
"meshfix_extensive_stitching": "fix_horrible_extensive_stitching",
|
||||||
"meshfix_keep_open_polygons": "fix_horrible_use_open_bits",
|
"meshfix_keep_open_polygons": "fix_horrible_use_open_bits",
|
||||||
"magic_mesh_surface_mode": "simple_mode",
|
"magic_mesh_surface_mode": "\"surface\" if simple_mode else \"normal\"",
|
||||||
"magic_spiralize": "spiralize",
|
"magic_spiralize": "spiralize",
|
||||||
"prime_tower_enable": "wipe_tower",
|
"prime_tower_enable": "wipe_tower",
|
||||||
"prime_tower_size": "math.sqrt(float(wipe_tower_volume) / float(layer_height))",
|
"prime_tower_size": "math.sqrt(float(wipe_tower_volume) / float(layer_height))",
|
||||||
|
|
|
@ -111,7 +111,8 @@ class LegacyProfileReader(ProfileReader):
|
||||||
if "translation" not in dict_of_doom:
|
if "translation" not in dict_of_doom:
|
||||||
Logger.log("e", "Dictionary of Doom has no translation. Is it the correct JSON file?")
|
Logger.log("e", "Dictionary of Doom has no translation. Is it the correct JSON file?")
|
||||||
return None
|
return None
|
||||||
current_printer = Application.getInstance().getGlobalContainerStack().findContainer({ }, DefinitionContainer)
|
current_printer_definition = Application.getInstance().getGlobalContainerStack().getBottom()
|
||||||
|
profile.setDefinition(current_printer_definition)
|
||||||
for new_setting in dict_of_doom["translation"]: #Evaluate all new settings that would get a value from the translations.
|
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]
|
old_setting_expression = dict_of_doom["translation"][new_setting]
|
||||||
compiled = compile(old_setting_expression, new_setting, "eval")
|
compiled = compile(old_setting_expression, new_setting, "eval")
|
||||||
|
@ -121,10 +122,13 @@ class LegacyProfileReader(ProfileReader):
|
||||||
except Exception: #Probably some setting name that was missing or something else that went wrong in the ini file.
|
except Exception: #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.")
|
Logger.log("w", "Setting " + new_setting + " could not be set because the evaluation failed. Something is probably missing from the imported legacy profile.")
|
||||||
continue
|
continue
|
||||||
if new_value != value_using_defaults and current_printer.findDefinitions(key = new_setting).default_value != new_value: #Not equal to the default in the new Cura OR the default in the legacy Cura.
|
definitions = current_printer_definition.findDefinitions(key = new_setting)
|
||||||
profile.setSettingValue(new_setting, new_value) #Store the setting in the profile!
|
if definitions:
|
||||||
|
if new_value != value_using_defaults and definitions[0].default_value != new_value: # Not equal to the default in the new Cura OR the default in the legacy Cura.
|
||||||
|
profile.setProperty(new_setting, "value", new_value) # Store the setting in the profile!
|
||||||
|
|
||||||
if len(profile.getChangedSettings()) == 0:
|
if len(profile.getAllKeys()) == 0:
|
||||||
Logger.log("i", "A legacy profile was imported but everything evaluates to the defaults, creating an empty profile.")
|
Logger.log("i", "A legacy profile was imported but everything evaluates to the defaults, creating an empty profile.")
|
||||||
profile.setDirty(True)
|
profile.setDirty(True)
|
||||||
|
profile.addMetaDataEntry("type", "quality")
|
||||||
return profile
|
return profile
|
Loading…
Add table
Add a link
Reference in a new issue