mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 14:13:55 -06:00
Fix quality profile import
CURA-4946
This commit is contained in:
parent
fa9dc7a1df
commit
0655ef0bc5
1 changed files with 4 additions and 3 deletions
|
@ -204,7 +204,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
global_profile = profile_or_list[0]
|
global_profile = profile_or_list[0]
|
||||||
else:
|
else:
|
||||||
for profile in profile_or_list:
|
for profile in profile_or_list:
|
||||||
if not profile.getMetaDataEntry("extruder"):
|
if not profile.getMetaDataEntry("position"):
|
||||||
global_profile = profile
|
global_profile = profile
|
||||||
break
|
break
|
||||||
if not global_profile:
|
if not global_profile:
|
||||||
|
@ -296,7 +296,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
else: #More extruders in the imported file than in the machine.
|
else: #More extruders in the imported file than in the machine.
|
||||||
continue #Delete the additional profiles.
|
continue #Delete the additional profiles.
|
||||||
|
|
||||||
result = self._configureProfile(profile, profile_id, new_name)
|
result = self._configureProfile(profile, profile_id, new_name, expected_machine_definition)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
return {"status": "error", "message": catalog.i18nc(
|
return {"status": "error", "message": catalog.i18nc(
|
||||||
"@info:status Don't translate the XML tags <filename> or <message>!",
|
"@info:status Don't translate the XML tags <filename> or <message>!",
|
||||||
|
@ -324,7 +324,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
# \param new_name The new name for the profile.
|
# \param new_name The new name for the profile.
|
||||||
#
|
#
|
||||||
# \return None if configuring was successful or an error message if an error occurred.
|
# \return None if configuring was successful or an error message if an error occurred.
|
||||||
def _configureProfile(self, profile: InstanceContainer, id_seed: str, new_name: str) -> Optional[str]:
|
def _configureProfile(self, profile: InstanceContainer, id_seed: str, new_name: str, machine_definition_id: str) -> Optional[str]:
|
||||||
profile.setDirty(True) # Ensure the profiles are correctly saved
|
profile.setDirty(True) # Ensure the profiles are correctly saved
|
||||||
|
|
||||||
new_id = self.createUniqueName("quality_changes", "", id_seed, catalog.i18nc("@label", "Custom profile"))
|
new_id = self.createUniqueName("quality_changes", "", id_seed, catalog.i18nc("@label", "Custom profile"))
|
||||||
|
@ -334,6 +334,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
# Set the unique Id to the profile, so it's generating a new one even if the user imports the same profile
|
# Set the unique Id to the profile, so it's generating a new one even if the user imports the same profile
|
||||||
# It also solves an issue with importing profiles from G-Codes
|
# It also solves an issue with importing profiles from G-Codes
|
||||||
profile.setMetaDataEntry("id", new_id)
|
profile.setMetaDataEntry("id", new_id)
|
||||||
|
profile.setMetaDataEntry("definition", machine_definition_id)
|
||||||
|
|
||||||
if "type" in profile.getMetaData():
|
if "type" in profile.getMetaData():
|
||||||
profile.setMetaDataEntry("type", "quality_changes")
|
profile.setMetaDataEntry("type", "quality_changes")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue