mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Move translateVariant to VersionUpgrade21to22
Also make it a dictionary look-up, like the rest, instead of a series of if-statements. Contributes to issue CURA-844.
This commit is contained in:
parent
439629d0b5
commit
93041191c2
2 changed files with 31 additions and 25 deletions
|
@ -70,30 +70,7 @@ class MachineInstance:
|
||||||
type_name = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translatePrinter(self._type_name)
|
type_name = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translatePrinter(self._type_name)
|
||||||
active_profile = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateProfile(self._active_profile_name)
|
active_profile = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateProfile(self._active_profile_name)
|
||||||
active_material = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateProfile(self._active_material_name)
|
active_material = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateProfile(self._active_material_name)
|
||||||
if type_name == "ultimaker2_plus":
|
variant = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateVariant(self._variant_name, type_name)
|
||||||
if self._variant_name == "0.25 mm":
|
|
||||||
variant = "ultimaker2_plus_0.25"
|
|
||||||
elif self._variant_name == "0.4 mm":
|
|
||||||
variant = "ultimaker2_plus_0.4"
|
|
||||||
elif self._variant_name == "0.6 mm":
|
|
||||||
variant = "ultimaker2_plus_0.6"
|
|
||||||
elif self._variant_name == "0.8 mm":
|
|
||||||
variant = "ultimaker2_plus_0.8"
|
|
||||||
else:
|
|
||||||
variant = self._variant_name
|
|
||||||
elif type_name == "ultimaker2_extended_plus":
|
|
||||||
if self._variant_name == "0.25 mm":
|
|
||||||
variant = "ultimaker2_extended_plus_0.25"
|
|
||||||
elif self._variant_name == "0.4 mm":
|
|
||||||
variant = "ultimaker2_extended_plus_0.4"
|
|
||||||
elif self._variant_name == "0.6 mm":
|
|
||||||
variant = "ultimaker2_extended_plus_0.6"
|
|
||||||
elif self._variant_name == "0.8 mm":
|
|
||||||
variant = "ultimaker2_extended_plus_0.8"
|
|
||||||
else:
|
|
||||||
variant = self._variant_name
|
|
||||||
else:
|
|
||||||
variant = self._variant_name
|
|
||||||
|
|
||||||
containers = [
|
containers = [
|
||||||
self._name,
|
self._name,
|
||||||
|
|
|
@ -26,6 +26,23 @@ _setting_name_translation = {
|
||||||
"speed_support_lines": "speed_support_infill"
|
"speed_support_lines": "speed_support_infill"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## How to translate variants of specific machines from the old version to the
|
||||||
|
# new.
|
||||||
|
_variant_translation = {
|
||||||
|
"ultimaker2_plus": {
|
||||||
|
"0.25 mm": "ultimaker2_plus_0.25",
|
||||||
|
"0.4 mm": "ultimaker2_plus_0.4",
|
||||||
|
"0.6 mm": "ultimaker2_plus_0.6",
|
||||||
|
"0.8 mm": "ultimaker2_plus_0.8"
|
||||||
|
},
|
||||||
|
"ultimaker2_extended_plus": {
|
||||||
|
"0.25 mm": "ultimaker2_extended_plus_0.25",
|
||||||
|
"0.4 mm": "ultimaker2_extended_plus_0.4",
|
||||||
|
"0.6 mm": "ultimaker2_extended_plus_0.6",
|
||||||
|
"0.8 mm": "ultimaker2_extended_plus_0.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
## Converts configuration from Cura 2.1's file formats to Cura 2.2's.
|
## Converts configuration from Cura 2.1's file formats to Cura 2.2's.
|
||||||
#
|
#
|
||||||
# It converts the machine instances and profiles.
|
# It converts the machine instances and profiles.
|
||||||
|
@ -124,3 +141,15 @@ class VersionUpgrade21to22(VersionUpgrade):
|
||||||
if setting in _setting_name_translation:
|
if setting in _setting_name_translation:
|
||||||
return _setting_name_translation[setting]
|
return _setting_name_translation[setting]
|
||||||
return setting #Doesn't need to be translated.
|
return setting #Doesn't need to be translated.
|
||||||
|
|
||||||
|
## Translates a variant name for the change from Cura 2.1 to 2.2
|
||||||
|
#
|
||||||
|
# \param variant The name of a variant in Cura 2.1.
|
||||||
|
# \param machine The name of the machine this variant is part of in Cura
|
||||||
|
# 2.2's naming.
|
||||||
|
# \return The name of the corresponding variant in Cura 2.2.
|
||||||
|
@staticmethod
|
||||||
|
def translateVariant(variant, machine):
|
||||||
|
if machine in _variant_translation and variant in _variant_translation[machine]:
|
||||||
|
return _variant_translation[machine][variant]
|
||||||
|
return variant
|
Loading…
Add table
Add a link
Reference in a new issue