__init__.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. workspace_extension = "3mf"
  16. metaData = {}
  17. if "3MFReader.ThreeMFReader" in sys.modules:
  18. metaData["mesh_reader"] = [
  19. {
  20. "extension": "3mf",
  21. "description": catalog.i18nc("@item:inlistbox", "3MF File")
  22. }
  23. ]
  24. metaData["workspace_reader"] = [
  25. {
  26. "extension": workspace_extension,
  27. "description": catalog.i18nc("@item:inlistbox", "3MF File")
  28. }
  29. ]
  30. return metaData
  31. def register(app):
  32. if "3MFReader.ThreeMFReader" in sys.modules:
  33. return {"mesh_reader": ThreeMFReader.ThreeMFReader(),
  34. "workspace_reader": ThreeMFWorkspaceReader.ThreeMFWorkspaceReader()}
  35. else:
  36. return {}