__init__.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. "extension": "ucp",
  30. "description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project"),
  31. "mime_type": "application/x-ucp",
  32. "mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode
  33. }
  34. ]
  35. }
  36. metaData["workspace_writer"] = {
  37. "output": [
  38. {
  39. "extension": workspace_extension,
  40. "description": i18n_catalog.i18nc("@item:inlistbox", "Cura Project 3MF file"),
  41. "mime_type": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml",
  42. "mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
  43. },
  44. {
  45. "extension": "ucp",
  46. "description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project"),
  47. "mime_type": "application/x-ucp",
  48. "mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
  49. }
  50. ]
  51. }
  52. return metaData
  53. def register(app):
  54. if "3MFWriter.ThreeMFWriter" in sys.modules:
  55. qmlRegisterType(SettingsExportGroup, "ThreeMFWriter", 1, 0, "SettingsExportGroup")
  56. return {"mesh_writer": ThreeMFWriter.ThreeMFWriter(),
  57. "workspace_writer": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter()}
  58. else:
  59. return {}