__init__.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # Copyright (c) 2015 Ultimaker B.V.
  2. # Uranium is released under the terms of the LGPLv3 or higher.
  3. import sys
  4. from PyQt6.QtQml import qmlRegisterType
  5. from UM.Logger import Logger
  6. try:
  7. from . import ThreeMFWriter
  8. from .SettingsExportGroup import SettingsExportGroup
  9. threemf_writer_was_imported = True
  10. except ImportError:
  11. Logger.log("w", "Could not import ThreeMFWriter; libSavitar may be missing")
  12. threemf_writer_was_imported = False
  13. from . import ThreeMFWorkspaceWriter
  14. from UM.i18n import i18nCatalog
  15. i18n_catalog = i18nCatalog("cura")
  16. def getMetaData():
  17. workspace_extension = "3mf"
  18. metaData = {}
  19. if threemf_writer_was_imported:
  20. metaData["mesh_writer"] = {
  21. "output": [
  22. {
  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. }
  30. metaData["workspace_writer"] = {
  31. "output": [
  32. {
  33. "extension": workspace_extension,
  34. "description": i18n_catalog.i18nc("@item:inlistbox", "Cura Project 3MF file"),
  35. "mime_type": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml",
  36. "mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
  37. },
  38. {
  39. "extension": "3mf",
  40. "description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project"),
  41. "mime_type": "application/x-ucp",
  42. "mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
  43. }
  44. ]
  45. }
  46. return metaData
  47. def register(app):
  48. if "3MFWriter.ThreeMFWriter" in sys.modules:
  49. qmlRegisterType(SettingsExportGroup, "ThreeMFWriter", 1, 0, "SettingsExportGroup")
  50. return {"mesh_writer": ThreeMFWriter.ThreeMFWriter(),
  51. "workspace_writer": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter()}
  52. else:
  53. return {}