cura_empty_instance_containers.py 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # Copyright (c) 2019 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. import copy
  4. from UM.Settings.constant_instance_containers import EMPTY_CONTAINER_ID, empty_container
  5. from UM.i18n import i18nCatalog
  6. catalog = i18nCatalog("cura")
  7. # Empty definition changes
  8. EMPTY_DEFINITION_CHANGES_CONTAINER_ID = "empty_definition_changes"
  9. empty_definition_changes_container = copy.deepcopy(empty_container)
  10. empty_definition_changes_container.setMetaDataEntry("id", EMPTY_DEFINITION_CHANGES_CONTAINER_ID)
  11. empty_definition_changes_container.setMetaDataEntry("type", "definition_changes")
  12. # Empty variant
  13. EMPTY_VARIANT_CONTAINER_ID = "empty_variant"
  14. empty_variant_container = copy.deepcopy(empty_container)
  15. empty_variant_container.setMetaDataEntry("id", EMPTY_VARIANT_CONTAINER_ID)
  16. empty_variant_container.setMetaDataEntry("type", "variant")
  17. # Empty material
  18. EMPTY_MATERIAL_CONTAINER_ID = "empty_material"
  19. empty_material_container = copy.deepcopy(empty_container)
  20. empty_material_container.setMetaDataEntry("id", EMPTY_MATERIAL_CONTAINER_ID)
  21. empty_material_container.setMetaDataEntry("type", "material")
  22. empty_material_container.setMetaDataEntry("base_file", "empty_material")
  23. empty_material_container.setMetaDataEntry("GUID", "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")
  24. empty_material_container.setMetaDataEntry("material", "empty")
  25. empty_material_container.setMetaDataEntry("brand", "empty_brand")
  26. # Empty quality
  27. EMPTY_QUALITY_CONTAINER_ID = "empty_quality"
  28. empty_quality_container = copy.deepcopy(empty_container)
  29. empty_quality_container.setMetaDataEntry("id", EMPTY_QUALITY_CONTAINER_ID)
  30. empty_quality_container.setName(catalog.i18nc("@info:not supported profile", "Not supported"))
  31. empty_quality_container.setMetaDataEntry("quality_type", "not_supported")
  32. empty_quality_container.setMetaDataEntry("type", "quality")
  33. empty_quality_container.setMetaDataEntry("supported", False)
  34. # Empty quality changes
  35. EMPTY_QUALITY_CHANGES_CONTAINER_ID = "empty_quality_changes"
  36. empty_quality_changes_container = copy.deepcopy(empty_container)
  37. empty_quality_changes_container.setMetaDataEntry("id", EMPTY_QUALITY_CHANGES_CONTAINER_ID)
  38. empty_quality_changes_container.setMetaDataEntry("type", "quality_changes")
  39. empty_quality_changes_container.setMetaDataEntry("quality_type", "not_supported")
  40. empty_quality_changes_container.setMetaDataEntry("intent_category", "not_supported")
  41. # Empty intent
  42. EMPTY_INTENT_CONTAINER_ID = "empty_intent"
  43. empty_intent_container = copy.deepcopy(empty_container)
  44. empty_intent_container.setMetaDataEntry("id", EMPTY_INTENT_CONTAINER_ID)
  45. empty_intent_container.setMetaDataEntry("type", "intent")
  46. empty_intent_container.setMetaDataEntry("intent_category", "default")
  47. empty_intent_container.setName(catalog.i18nc("@info:No intent profile selected", "Default"))
  48. # All empty container IDs set
  49. ALL_EMPTY_CONTAINER_ID_SET = {
  50. EMPTY_CONTAINER_ID,
  51. EMPTY_DEFINITION_CHANGES_CONTAINER_ID,
  52. EMPTY_VARIANT_CONTAINER_ID,
  53. EMPTY_MATERIAL_CONTAINER_ID,
  54. EMPTY_QUALITY_CONTAINER_ID,
  55. EMPTY_QUALITY_CHANGES_CONTAINER_ID,
  56. EMPTY_INTENT_CONTAINER_ID
  57. }
  58. # Convenience function to check if a container ID represents an empty container.
  59. def isEmptyContainer(container_id: str) -> bool:
  60. return container_id in ALL_EMPTY_CONTAINER_ID_SET
  61. __all__ = ["EMPTY_CONTAINER_ID",
  62. "empty_container", # For convenience
  63. "EMPTY_DEFINITION_CHANGES_CONTAINER_ID",
  64. "empty_definition_changes_container",
  65. "EMPTY_VARIANT_CONTAINER_ID",
  66. "empty_variant_container",
  67. "EMPTY_MATERIAL_CONTAINER_ID",
  68. "empty_material_container",
  69. "EMPTY_QUALITY_CHANGES_CONTAINER_ID",
  70. "empty_quality_changes_container",
  71. "EMPTY_QUALITY_CONTAINER_ID",
  72. "empty_quality_container",
  73. "ALL_EMPTY_CONTAINER_ID_SET",
  74. "isEmptyContainer",
  75. "EMPTY_INTENT_CONTAINER_ID",
  76. "empty_intent_container"
  77. ]