__init__.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Copyright (c) 2015 Ultimaker B.V.
  2. # Uranium is released under the terms of the LGPLv3 or higher.
  3. import sys
  4. from UM.Logger import Logger
  5. try:
  6. from . import ThreeMFWriter
  7. except ImportError:
  8. Logger.log("w", "Could not import ThreeMFWriter; libSavitar may be missing")
  9. from . import ThreeMFWorkspaceWriter
  10. from UM.i18n import i18nCatalog
  11. from UM.Platform import Platform
  12. i18n_catalog = i18nCatalog("uranium")
  13. def getMetaData():
  14. # Workarround for osx not supporting double file extensions correctly.
  15. if Platform.isOSX():
  16. workspace_extension = "3mf"
  17. else:
  18. workspace_extension = "curaproject.3mf"
  19. metaData = {}
  20. if "3MFWriter.ThreeMFWriter" in sys.modules:
  21. metaData["mesh_writer"] = {
  22. "output": [{
  23. "extension": "3mf",
  24. "description": i18n_catalog.i18nc("@item:inlistbox", "3MF file"),
  25. "mime_type": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml",
  26. "mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode
  27. }]
  28. }
  29. metaData["workspace_writer"] = {
  30. "output": [{
  31. "extension": workspace_extension,
  32. "description": i18n_catalog.i18nc("@item:inlistbox", "Cura Project 3MF file"),
  33. "mime_type": "application/x-curaproject+xml",
  34. "mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
  35. }]
  36. }
  37. return metaData
  38. def register(app):
  39. if "3MFWriter.ThreeMFWriter" in sys.modules:
  40. return {"mesh_writer": ThreeMFWriter.ThreeMFWriter(),
  41. "workspace_writer": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter()}
  42. else:
  43. return {}