__init__.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright (c) 2015 Ultimaker B.V.
  2. # Cura is released under the terms of the AGPLv3 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 correclty.
  16. if Platform.isOSX():
  17. workspace_extension = "3mf"
  18. else:
  19. workspace_extension = "curaproject.3mf"
  20. metaData = {
  21. "plugin": {
  22. "name": catalog.i18nc("@label", "3MF Reader"),
  23. "author": "Ultimaker",
  24. "version": "1.0",
  25. "description": catalog.i18nc("@info:whatsthis", "Provides support for reading 3MF files."),
  26. "api": 3
  27. }
  28. }
  29. if "3MFReader.ThreeMFReader" in sys.modules:
  30. metaData["mesh_reader"] = [
  31. {
  32. "extension": "3mf",
  33. "description": catalog.i18nc("@item:inlistbox", "3MF File")
  34. }
  35. ]
  36. metaData["workspace_reader"] = [
  37. {
  38. "extension": workspace_extension,
  39. "description": catalog.i18nc("@item:inlistbox", "3MF File")
  40. }
  41. ]
  42. return metaData
  43. def register(app):
  44. if "3MFReader.ThreeMFReader" in sys.modules:
  45. return {"mesh_reader": ThreeMFReader.ThreeMFReader(),
  46. "workspace_reader": ThreeMFWorkspaceReader.ThreeMFWorkspaceReader()}
  47. else:
  48. return {}