mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-23 22:29:41 +08:00
65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
# Copyright (c) 2015 Ultimaker B.V.
|
|
# Cura is released under the terms of the LGPLv3 or higher.
|
|
from typing import Dict
|
|
import sys
|
|
|
|
from UM.Logger import Logger
|
|
try:
|
|
from . import ThreeMFReader
|
|
except ImportError:
|
|
Logger.log("w", "Could not import ThreeMFReader; libSavitar may be missing")
|
|
|
|
from . import ThreeMFWorkspaceReader
|
|
|
|
from UM.i18n import i18nCatalog
|
|
from UM.Platform import Platform
|
|
from UM.MimeTypeDatabase import MimeTypeDatabase, MimeType
|
|
catalog = i18nCatalog("cura")
|
|
|
|
MimeTypeDatabase.addMimeType(
|
|
MimeType(
|
|
name = "application/x-cura-project-file",
|
|
comment = "Cura Project File",
|
|
suffixes = ["curaproject.3mf"]
|
|
)
|
|
)
|
|
MimeTypeDatabase.addMimeType(
|
|
MimeType(
|
|
name = "application/x-cura-project-file",
|
|
comment = "Cura Project File",
|
|
suffixes = ["3mf"]
|
|
)
|
|
)
|
|
|
|
def getMetaData() -> Dict:
|
|
# Workarround for osx not supporting double file extensions correctly.
|
|
if Platform.isOSX():
|
|
workspace_extension = "3mf"
|
|
else:
|
|
workspace_extension = "curaproject.3mf"
|
|
|
|
metaData = {}
|
|
if "3MFReader.ThreeMFReader" in sys.modules:
|
|
metaData["mesh_reader"] = [
|
|
{
|
|
"extension": "3mf",
|
|
"description": catalog.i18nc("@item:inlistbox", "3MF File")
|
|
}
|
|
]
|
|
metaData["workspace_reader"] = [
|
|
{
|
|
"extension": workspace_extension,
|
|
"description": catalog.i18nc("@item:inlistbox", "3MF File")
|
|
}
|
|
]
|
|
|
|
return metaData
|
|
|
|
|
|
def register(app):
|
|
if "3MFReader.ThreeMFReader" in sys.modules:
|
|
return {"mesh_reader": ThreeMFReader.ThreeMFReader(app),
|
|
"workspace_reader": ThreeMFWorkspaceReader.ThreeMFWorkspaceReader()}
|
|
else:
|
|
return {}
|