__init__.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright (c) 2015 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from typing import Dict
  4. import sys
  5. from UM.Logger import Logger
  6. try:
  7. from . import ThreeMFReader
  8. except ImportError:
  9. Logger.log("w", "Could not import ThreeMFReader; libSavitar may be missing")
  10. from . import ThreeMFWorkspaceReader
  11. from UM.i18n import i18nCatalog
  12. from UM.Platform import Platform
  13. catalog = i18nCatalog("cura")
  14. def getMetaData() -> Dict:
  15. # Workarround for osx not supporting double file extensions correctly.
  16. if Platform.isOSX():
  17. workspace_extension = "3mf"
  18. else:
  19. workspace_extension = "curaproject.3mf"
  20. metaData = {}
  21. if "3MFReader.ThreeMFReader" in sys.modules:
  22. metaData["mesh_reader"] = [
  23. {
  24. "extension": "3mf",
  25. "description": catalog.i18nc("@item:inlistbox", "3MF File")
  26. }
  27. ]
  28. metaData["workspace_reader"] = [
  29. {
  30. "extension": workspace_extension,
  31. "description": catalog.i18nc("@item:inlistbox", "3MF File")
  32. }
  33. ]
  34. return metaData
  35. def register(app):
  36. if "3MFReader.ThreeMFReader" in sys.modules:
  37. return {"mesh_reader": ThreeMFReader.ThreeMFReader(),
  38. "workspace_reader": ThreeMFWorkspaceReader.ThreeMFWorkspaceReader()}
  39. else:
  40. return {}