mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 00:07:51 -06:00
Translate profile names too
Not all profile name translations are entered yet, I think. I just did the material ones. Contributes to issue CURA-844.
This commit is contained in:
parent
7939a03114
commit
f07598a228
2 changed files with 23 additions and 3 deletions
|
@ -66,10 +66,13 @@ class MachineInstance:
|
||||||
config.set("general", "type", self._type_name)
|
config.set("general", "type", self._type_name)
|
||||||
config.set("general", "version", "2") # Hard-code version 2, since if this number changes the programmer MUST change this entire function.
|
config.set("general", "version", "2") # Hard-code version 2, since if this number changes the programmer MUST change this entire function.
|
||||||
|
|
||||||
|
import VersionUpgrade21to22 # Import here to prevent circular dependencies.
|
||||||
|
active_profile = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateProfile(self._active_profile_name)
|
||||||
|
active_material = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateProfile(self._active_material_name)
|
||||||
containers = [
|
containers = [
|
||||||
self._name,
|
self._name,
|
||||||
self._active_profile_name,
|
active_profile,
|
||||||
self._active_material_name,
|
active_material,
|
||||||
self._variant_name,
|
self._variant_name,
|
||||||
self._type_name
|
self._type_name
|
||||||
]
|
]
|
||||||
|
@ -78,7 +81,6 @@ class MachineInstance:
|
||||||
config.add_section("metadata")
|
config.add_section("metadata")
|
||||||
config.set("metadata", "type", "machine")
|
config.set("metadata", "type", "machine")
|
||||||
|
|
||||||
import VersionUpgrade21to22 # Import here to prevent circular dependencies.
|
|
||||||
VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateSettings(self._machine_setting_overrides)
|
VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateSettings(self._machine_setting_overrides)
|
||||||
config.add_section("values")
|
config.add_section("values")
|
||||||
for key, value in self._machine_setting_overrides.items():
|
for key, value in self._machine_setting_overrides.items():
|
||||||
|
|
|
@ -9,6 +9,13 @@ from . import MachineInstance # To upgrade machine instances.
|
||||||
from . import Preferences #To upgrade preferences.
|
from . import Preferences #To upgrade preferences.
|
||||||
from . import Profile # To upgrade profiles.
|
from . import Profile # To upgrade profiles.
|
||||||
|
|
||||||
|
## How to translate profile names from the old version to the new.
|
||||||
|
_profile_translation = {
|
||||||
|
"PLA": "generic_pla",
|
||||||
|
"ABS": "generic_abs",
|
||||||
|
"CPE": "generic_cpe"
|
||||||
|
}
|
||||||
|
|
||||||
## 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.
|
||||||
|
@ -69,6 +76,17 @@ class VersionUpgrade21to22(VersionUpgrade):
|
||||||
printers[index] = "ultimaker2_plus"
|
printers[index] = "ultimaker2_plus"
|
||||||
return printers
|
return printers
|
||||||
|
|
||||||
|
## Translates a built-in profile name that might have changed since the
|
||||||
|
# last version.
|
||||||
|
#
|
||||||
|
# \param profile A profile name in the old version.
|
||||||
|
# \return The corresponding profile name in the new version.
|
||||||
|
@staticmethod
|
||||||
|
def translateProfile(profile):
|
||||||
|
if profile in _profile_translation:
|
||||||
|
return _profile_translation[profile]
|
||||||
|
return profile
|
||||||
|
|
||||||
## Updates settings for the change from Cura 2.1 to 2.2.
|
## Updates settings for the change from Cura 2.1 to 2.2.
|
||||||
#
|
#
|
||||||
# The keys and values of settings are changed to what they should be in
|
# The keys and values of settings are changed to what they should be in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue