mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-02 16:54:23 +08:00

Two big things had to happen for this: The resource types of quality and machine stack have to be defined before the initialisation of the version upgrade manager, since the version upgrade manager needs to know those storage locations at initialisation. But the storage location is still prefaced with '.config/UM' at this point, so instead we pass on the resource type (but the resource type still has to be defined before the init). The other big change is that we now have to name the configuration type 'quality' and 'machine_stack' instead of 'instance_container' and 'container_stack' to coincide with the resource type. This allows us to be more consistent in later plug-ins when we also have to upgrade other instance container types. Contributes to issue CURA-844.
44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
# Copyright (c) 2016 Ultimaker B.V.
|
|
# Cura is released under the terms of the AGPLv3 or higher.
|
|
|
|
from . import VersionUpgrade21to22
|
|
|
|
from UM.i18n import i18nCatalog
|
|
catalog = i18nCatalog("cura")
|
|
|
|
upgrade = VersionUpgrade21to22.VersionUpgrade21to22()
|
|
|
|
def getMetaData():
|
|
return {
|
|
"plugin": {
|
|
"name": catalog.i18nc("@label", "Version Upgrade 2.1 to 2.2"),
|
|
"author": "Ultimaker",
|
|
"version": "1.0",
|
|
"description": catalog.i18nc("@info:whatsthis", "Upgrades configurations from Cura 2.1 to Cura 2.2."),
|
|
"api": 3
|
|
},
|
|
"version_upgrade": {
|
|
# From To Upgrade function
|
|
("profile", 1): ("quality", 2, upgrade.upgradeProfile),
|
|
("machine_instance", 1): ("machine_stack", 2, upgrade.upgradeMachineInstance),
|
|
("preferences", 2): ("preferences", 3, upgrade.upgradePreferences)
|
|
},
|
|
"sources": {
|
|
"profile": {
|
|
"get_version": upgrade.getCfgVersion,
|
|
"location": {"./profiles", "./instance_profiles"}
|
|
},
|
|
"machine_instance": {
|
|
"get_version": upgrade.getCfgVersion,
|
|
"location": {"./machine_instances"}
|
|
},
|
|
"preferences": {
|
|
"get_version": upgrade.getCfgVersion,
|
|
"location": {"."}
|
|
}
|
|
}
|
|
}
|
|
|
|
def register(app):
|
|
return { "version_upgrade": upgrade }
|