__init__.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #Copyright (c) 2018 Ultimaker B.V.
  2. #Cura is released under the terms of the LGPLv3 or higher.
  3. import sys
  4. from UM.Logger import Logger
  5. try:
  6. from . import UFPWriter
  7. except ImportError:
  8. Logger.log("w", "Could not import UFPWriter; libCharon may be missing")
  9. from UM.i18n import i18nCatalog #To translate the file format description.
  10. from UM.Mesh.MeshWriter import MeshWriter #For the binary mode flag.
  11. from UM.MimeTypeDatabase import MimeTypeDatabase, MimeType
  12. MimeTypeDatabase.addMimeType(
  13. MimeType(
  14. name = "application/x-cura-stl-file",
  15. comment = "Cura UFP File",
  16. suffixes = ["ufp"]
  17. )
  18. )
  19. i18n_catalog = i18nCatalog("cura")
  20. def getMetaData():
  21. if "UFPWriter.UFPWriter" not in sys.modules:
  22. return {}
  23. return {
  24. "mesh_writer": {
  25. "output": [
  26. {
  27. "mime_type": "application/x-ufp",
  28. "mode": MeshWriter.OutputMode.BinaryMode,
  29. "extension": "ufp",
  30. "description": i18n_catalog.i18nc("@item:inlistbox", "Ultimaker Format Package")
  31. }
  32. ]
  33. }
  34. }
  35. def register(app):
  36. if "UFPWriter.UFPWriter" not in sys.modules:
  37. return {}
  38. return { "mesh_writer": UFPWriter.UFPWriter() }