Change definition ID upon reading profile

Implements CURA-6713.
This commit is contained in:
Ghostkeeper 2019-09-03 15:38:41 +02:00
parent c41af1b9a0
commit 2f917c2841
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
2 changed files with 9 additions and 6 deletions

View file

@ -4,11 +4,11 @@
import configparser
from typing import List, Optional, Tuple
from UM.PluginRegistry import PluginRegistry
from UM.Logger import Logger
from UM.Settings.ContainerFormatError import ContainerFormatError
from UM.Settings.InstanceContainer import InstanceContainer # The new profile to make.
from cura.CuraApplication import CuraApplication
from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch
from cura.ReaderWriters.ProfileReader import ProfileReader
import zipfile
@ -92,6 +92,10 @@ class CuraProfileReader(ProfileReader):
except Exception as e:
Logger.log("e", "Error while trying to parse profile: %s", str(e))
return None
active_quality_definition = getMachineDefinitionIDForQualitySearch(CuraApplication.getInstance().getGlobalContainerStack().definition)
if profile.getMetaDataEntry("definition") != active_quality_definition:
profile.setMetaDataEntry("definition", active_quality_definition)
return profile
## Upgrade a serialized profile to the current profile format.