mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-28 13:21:10 -07:00
Fix XML material upgrade
CURA-3756
This commit is contained in:
parent
bccd4187a3
commit
593697e0ed
4 changed files with 110 additions and 6 deletions
|
|
@ -1,11 +1,16 @@
|
|||
# Copyright (c) 2016 Ultimaker B.V.
|
||||
# Copyright (c) 2017 Ultimaker B.V.
|
||||
# Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
from . import XmlMaterialProfile
|
||||
from . import Upgrader
|
||||
|
||||
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
|
||||
from UM.i18n import i18nCatalog
|
||||
|
||||
|
||||
catalog = i18nCatalog("cura")
|
||||
upgrader = Upgrader.Upgrader()
|
||||
|
||||
|
||||
def getMetaData():
|
||||
return {
|
||||
|
|
@ -19,15 +24,36 @@ def getMetaData():
|
|||
"settings_container": {
|
||||
"type": "material",
|
||||
"mimetype": "application/x-ultimaker-material-profile"
|
||||
},
|
||||
"version_upgrade": {
|
||||
("materials", 1000000): ("materials", 1000001, upgrader.upgradeMaterial),
|
||||
},
|
||||
"sources": {
|
||||
"materials": {
|
||||
"get_version": upgrader.getXmlVersion,
|
||||
"location": {"./materials"}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def register(app):
|
||||
# add Mime type
|
||||
mime_type = MimeType(
|
||||
name = "application/x-ultimaker-material-profile",
|
||||
comment = "Ultimaker Material Profile",
|
||||
suffixes = [ "xml.fdm_material" ]
|
||||
)
|
||||
MimeTypeDatabase.addMimeType(mime_type)
|
||||
return { "settings_container": XmlMaterialProfile.XmlMaterialProfile("default_xml_material_profile") }
|
||||
|
||||
# add upgrade version
|
||||
from cura.CuraApplication import CuraApplication
|
||||
from UM.VersionUpgradeManager import VersionUpgradeManager
|
||||
VersionUpgradeManager.getInstance().setCurrentVersion(
|
||||
("materials", XmlMaterialProfile.XmlMaterialProfile.Version * 1000000 + CuraApplication.SettingVersion),
|
||||
(CuraApplication.ResourceTypes.MaterialInstanceContainer, "application/x-uranium-instancecontainer")
|
||||
)
|
||||
|
||||
return {"version_upgrade": upgrader,
|
||||
"settings_container": XmlMaterialProfile.XmlMaterialProfile("default_xml_material_profile"),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue