ApplicationMetadata.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Copyright (c) 2022 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. # ---------
  4. # General constants used in Cura
  5. # ---------
  6. DEFAULT_CURA_APP_NAME = "cura"
  7. DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura"
  8. DEFAULT_CURA_VERSION = "dev"
  9. DEFAULT_CURA_BUILD_TYPE = ""
  10. DEFAULT_CURA_DEBUG_MODE = False
  11. DEFAULT_CURA_LATEST_URL = "https://software.ultimaker.com/latest.json"
  12. # Each release has a fixed SDK version coupled with it. It doesn't make sense to make it configurable because, for
  13. # example Cura 3.2 with SDK version 6.1 will not work. So the SDK version is hard-coded here and left out of the
  14. # CuraVersion.py.in template.
  15. CuraSDKVersion = "8.2.0"
  16. try:
  17. from cura.CuraVersion import CuraLatestURL
  18. if CuraLatestURL == "":
  19. CuraLatestURL = DEFAULT_CURA_LATEST_URL
  20. except ImportError:
  21. CuraLatestURL = DEFAULT_CURA_LATEST_URL
  22. try:
  23. from cura.CuraVersion import CuraAppName # type: ignore
  24. if CuraAppName == "":
  25. CuraAppName = DEFAULT_CURA_APP_NAME
  26. except ImportError:
  27. CuraAppName = DEFAULT_CURA_APP_NAME
  28. try:
  29. from cura.CuraVersion import CuraVersion # type: ignore
  30. if CuraVersion == "":
  31. CuraVersion = DEFAULT_CURA_VERSION
  32. except ImportError:
  33. CuraVersion = DEFAULT_CURA_VERSION # [CodeStyle: Reflecting imported value]
  34. # CURA-6569
  35. # This string indicates what type of version it is. For example, "enterprise". By default it's empty which indicates
  36. # a default/normal Cura build.
  37. try:
  38. from cura.CuraVersion import CuraBuildType # type: ignore
  39. except ImportError:
  40. CuraBuildType = DEFAULT_CURA_BUILD_TYPE
  41. try:
  42. from cura.CuraVersion import CuraDebugMode # type: ignore
  43. except ImportError:
  44. CuraDebugMode = DEFAULT_CURA_DEBUG_MODE
  45. # CURA-6569
  46. # Various convenience flags indicating what kind of Cura build it is.
  47. __ENTERPRISE_VERSION_TYPE = "enterprise"
  48. IsEnterpriseVersion = CuraBuildType.lower() == __ENTERPRISE_VERSION_TYPE
  49. IsAlternateVersion = CuraBuildType.lower() not in [DEFAULT_CURA_BUILD_TYPE, __ENTERPRISE_VERSION_TYPE]
  50. # NOTE: IsAlternateVersion is to make it possibile to have 'non-numbered' versions, at least as presented to the user.
  51. # (Internally, it'll still have some sort of version-number, but the user is never meant to see it in the GUI).
  52. # Warning: This will also change (some of) the icons/splash-screen to the 'work in progress' alternatives!
  53. try:
  54. from cura.CuraVersion import CuraAppDisplayName # type: ignore
  55. if CuraAppDisplayName == "":
  56. CuraAppDisplayName = DEFAULT_CURA_DISPLAY_NAME
  57. if IsEnterpriseVersion:
  58. CuraAppDisplayName = CuraAppDisplayName + " Enterprise"
  59. except ImportError:
  60. CuraAppDisplayName = DEFAULT_CURA_DISPLAY_NAME
  61. DEPENDENCY_INFO = {}
  62. try:
  63. from pathlib import Path
  64. conan_install_info = Path(__file__).parent.parent.joinpath("conan_install_info.json")
  65. if conan_install_info.exists():
  66. import json
  67. with open(conan_install_info, "r") as f:
  68. DEPENDENCY_INFO = json.loads(f.read())
  69. except:
  70. pass