XmlMaterialValidator.py 792 B

1234567891011121314151617181920212223242526272829
  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
  4. class XmlMaterialValidator:
  5. """Makes sure that the required metadata is present for a material."""
  6. @classmethod
  7. def validateMaterialMetaData(cls, validation_metadata: Dict[str, Any]):
  8. """Makes sure that the required metadata is present for a material."""
  9. if validation_metadata.get("GUID") is None:
  10. return "Missing GUID"
  11. if validation_metadata.get("brand") is None:
  12. return "Missing Brand"
  13. if validation_metadata.get("material") is None:
  14. return "Missing Material"
  15. if validation_metadata.get("version") is None:
  16. return "Missing Version"
  17. return None