Lipu Fei 67cfb064e6 Fix upgrading custom FDM printers from 2.5
CURA-4188

Custom FDM printers in 2.5 don't have multi-extrusion support but they
do since 2.6. Upgrading from 2.5 to 2.6 will not create the missing
extruder stacks for the old custom FDM printers, which causes a crash.
This fix makes sure that all custom FDM printers will have 8 extruder
stacks during the upgrade so that Cura can still start normally and
those printers will still be usable.
2017-08-18 13:06:46 +02:00

68 lines
2.9 KiB
Python

# Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from . import VersionUpgrade26to27
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
upgrade = VersionUpgrade26to27.VersionUpgrade26to27()
def getMetaData():
return {
"version_upgrade": {
# From To Upgrade function
("machine_stack", 3000001): ("machine_stack", 3000002, upgrade.upgradeStack),
("extruder_train", 3000000): ("extruder_train", 3000002, upgrade.upgradeStack),
# In 2.6.x, Preferences are saved with "version = 4" and no setting_version.
# This means those Preferences files will still be treated as "4.0" as defined in VersionUpgrade25to26,
# so the 25to26 upgrade routine will be called again.
#
# To fix this, we first fix the upgrade routine for 25to26 so it actually upgrades to "4.1", and then
# here we can upgrade from "4.1" to "4.2" safely.
#
("preferences", 4000001): ("preferences", 4000002, upgrade.upgradePreferences),
# NOTE: All the instance containers share the same general/version, so we have to update all of them
# if any is updated.
("quality_changes", 2000001): ("quality_changes", 2000002, upgrade.upgradeOtherContainer),
("user", 2000001): ("user", 2000002, upgrade.upgradeOtherContainer),
("quality", 2000001): ("quality", 2000002, upgrade.upgradeOtherContainer),
("definition_changes", 2000001): ("definition_changes", 2000002, upgrade.upgradeOtherContainer),
("variant", 2000000): ("variant", 2000002, upgrade.upgradeOtherContainer)
},
"sources": {
"machine_stack": {
"get_version": upgrade.getCfgVersion,
"location": {"./machine_instances"}
},
"extruder_train": {
"get_version": upgrade.getCfgVersion,
"location": {"./extruders"}
},
"preferences": {
"get_version": upgrade.getCfgVersion,
"location": {"."}
},
"quality_changes": {
"get_version": upgrade.getCfgVersion,
"location": {"./quality"}
},
"user": {
"get_version": upgrade.getCfgVersion,
"location": {"./user"}
},
"definition_changes": {
"get_version": upgrade.getCfgVersion,
"location": {"./definition_changes"}
},
"variant": {
"get_version": upgrade.getCfgVersion,
"location": {"./variants"}
}
}
}
def register(app):
return { "version_upgrade": upgrade }