__init__.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Copyright (c) 2018 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from typing import Any, Dict, TYPE_CHECKING
  4. from . import VersionUpgrade26to27
  5. if TYPE_CHECKING:
  6. from UM.Application import Application
  7. upgrade = VersionUpgrade26to27.VersionUpgrade26to27()
  8. def getMetaData() -> Dict[str, Any]:
  9. return {
  10. "version_upgrade": {
  11. # From To Upgrade function
  12. ("machine_stack", 3000001): ("machine_stack", 3000002, upgrade.upgradeStack),
  13. ("extruder_train", 3000000): ("extruder_train", 3000002, upgrade.upgradeStack),
  14. # In 2.6.x, Preferences are saved with "version = 4" and no setting_version.
  15. # This means those Preferences files will still be treated as "4.0" as defined in VersionUpgrade25to26,
  16. # so the 25to26 upgrade routine will be called again.
  17. #
  18. # To fix this, we first fix the upgrade routine for 25to26 so it actually upgrades to "4.1", and then
  19. # here we can upgrade from "4.1" to "4.2" safely.
  20. #
  21. ("preferences", 4000001): ("preferences", 4000002, upgrade.upgradePreferences),
  22. # NOTE: All the instance containers share the same general/version, so we have to update all of them
  23. # if any is updated.
  24. ("quality_changes", 2000001): ("quality_changes", 2000002, upgrade.upgradeOtherContainer),
  25. ("user", 2000001): ("user", 2000002, upgrade.upgradeOtherContainer),
  26. ("definition_changes", 2000001): ("definition_changes", 2000002, upgrade.upgradeOtherContainer),
  27. ("variant", 2000000): ("variant", 2000002, upgrade.upgradeOtherContainer)
  28. },
  29. "sources": {
  30. "machine_stack": {
  31. "get_version": upgrade.getCfgVersion,
  32. "location": {"./machine_instances"}
  33. },
  34. "extruder_train": {
  35. "get_version": upgrade.getCfgVersion,
  36. "location": {"./extruders"}
  37. },
  38. "preferences": {
  39. "get_version": upgrade.getCfgVersion,
  40. "location": {"."}
  41. },
  42. "quality_changes": {
  43. "get_version": upgrade.getCfgVersion,
  44. "location": {"./quality"}
  45. },
  46. "user": {
  47. "get_version": upgrade.getCfgVersion,
  48. "location": {"./user"}
  49. },
  50. "definition_changes": {
  51. "get_version": upgrade.getCfgVersion,
  52. "location": {"./definition_changes"}
  53. },
  54. "variant": {
  55. "get_version": upgrade.getCfgVersion,
  56. "location": {"./variants"}
  57. }
  58. }
  59. }
  60. def register(app: "Application") -> Dict[str, Any]:
  61. return { "version_upgrade": upgrade }