当前位置: 首页>>代码示例>>Python>>正文


Python MimeTypeDatabase.addMimeType方法代码示例

本文整理汇总了Python中UM.MimeTypeDatabase.MimeTypeDatabase.addMimeType方法的典型用法代码示例。如果您正苦于以下问题:Python MimeTypeDatabase.addMimeType方法的具体用法?Python MimeTypeDatabase.addMimeType怎么用?Python MimeTypeDatabase.addMimeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UM.MimeTypeDatabase.MimeTypeDatabase的用法示例。


在下文中一共展示了MimeTypeDatabase.addMimeType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
    def setUp(self):

        self._application = MagicMock()
        self._container_registry = MagicMock()
        self._machine_manager = MagicMock()

        self._mocked_mime = MagicMock()
        self._mocked_mime.preferredSuffix = "omg"
        self._mocked_mime.suffixes = ["omg"]
        self._mocked_mime.comment = "UnitTest!"

        self._mocked_container = MagicMock()
        self._mocked_container_data = "SOME DATA :D"
        self._mocked_container.serialize = MagicMock(return_value = self._mocked_container_data)

        self._containers_meta_data = [{"id": "test", "test_data": "omg"}]
        self._container_registry.findContainersMetadata = MagicMock(return_value = self._containers_meta_data)
        self._container_registry.getMimeTypeForContainer = MagicMock(return_value = self._mocked_mime)
        self._container_registry.findContainers = MagicMock(return_value = [self._mocked_container])
        self._application.getContainerRegistry = MagicMock(return_value = self._container_registry)
        self._application.getMachineManager = MagicMock(return_value = self._machine_manager)

        # Destroy the previous instance of the container manager
        if ContainerManager.getInstance() is not None:
            ContainerManager._ContainerManager__instance = None

        self._container_manager = ContainerManager(self._application)
        MimeTypeDatabase.addMimeType(self._mocked_mime)
开发者ID:TinkerGnome,项目名称:Cura,代码行数:30,代码来源:TestContainerManager.py

示例2: register

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
def register(app):
    mime_type = MimeType(
        name = "application/x-ultimaker-material-profile",
        comment = "Ultimaker Material Profile",
        suffixes = [ "xml.fdm_material" ]
    )
    MimeTypeDatabase.addMimeType(mime_type)
    return { "settings_container": XmlMaterialProfile.XmlMaterialProfile("default_xml_material_profile") }
开发者ID:3d20,项目名称:Cura,代码行数:10,代码来源:__init__.py

示例3: __init__

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
 def __init__(self) -> None:
     super().__init__()
     MimeTypeDatabase.addMimeType(
         MimeType(
             name = "application/x-cura-compressed-gcode-file",
             comment = "Cura Compressed GCode File",
             suffixes = ["gcode.gz"]
         )
     )
     self._supported_extensions = [".gcode.gz"]
开发者ID:TinkerGnome,项目名称:Cura,代码行数:12,代码来源:GCodeGzReader.py

示例4: __init__

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
    def __init__(self) -> None:
        super().__init__()

        MimeTypeDatabase.addMimeType(
            MimeType(
                name = "application/x-ufp",
                comment = "Ultimaker Format Package",
                suffixes = ["ufp"]
            )
        )
        self._supported_extensions = [".ufp"]
开发者ID:Ultimaker,项目名称:Cura,代码行数:13,代码来源:UFPReader.py

示例5: __init__

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
    def __init__(self):
        super().__init__(add_to_recent_files = False)

        MimeTypeDatabase.addMimeType(
            MimeType(
                name = "application/x-ufp",
                comment = "Ultimaker Format Package",
                suffixes = ["ufp"]
            )
        )

        self._snapshot = None
开发者ID:TinkerGnome,项目名称:Cura,代码行数:14,代码来源:UFPWriter.py

示例6: __init__

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
    def __init__(self) -> None:
        super().__init__()
        self._supported_extensions = [".amf"]
        self._namespaces = {}   # type: Dict[str, str]

        MimeTypeDatabase.addMimeType(
            MimeType(
                name="application/x-amf",
                comment="AMF",
                suffixes=["amf"]
            )
        )
开发者ID:Ultimaker,项目名称:Cura,代码行数:14,代码来源:AMFReader.py

示例7: mime_database

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
def mime_database():
    MimeTypeDatabase._MimeTypeDatabase__custom_mimetypes = []
    mime = MimeType(
        name = "application/x-test",
        comment = "Test Mimetype",
        suffixes = [ "test" ]
    )
    MimeTypeDatabase.addMimeType(mime)
    mime = MimeType(
        name = "application/x-long-test",
        comment = "Long Test Mimetype",
        suffixes = [ "long.test" ]
    )
    MimeTypeDatabase.addMimeType(mime)
    mime = MimeType(
        name = "application/x-multiple-test",
        comment = "Multiple Extension MIME Type",
        suffixes = [ "tost", "ost" ],
        preferred_suffix = "ost"
    )
    MimeTypeDatabase.addMimeType(mime)
    mime = MimeType(
        name = "image/jpeg",
        comment = "Custom JPEG MIME Type",
        suffixes = [ "jpg", "jpeg" ],
        preferred_suffix = "jpg"
    )
    MimeTypeDatabase.addMimeType(mime)

    return MimeTypeDatabase
开发者ID:senttech,项目名称:Uranium,代码行数:32,代码来源:TestMimeTypes.py

示例8: __init__

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
    def __init__(self) -> None:
        super().__init__()
        MimeTypeDatabase.addMimeType(
            MimeType(
                name = "application/x-cura-gcode-file",
                comment = "Cura GCode File",
                suffixes = ["gcode"]
            )
        )
        self._supported_extensions = [".gcode", ".g"]

        self._flavor_reader = None

        Application.getInstance().getPreferences().addPreference("gcodereader/show_caution", True)
开发者ID:rwreynolds,项目名称:Cura,代码行数:16,代码来源:GCodeReader.py

示例9: setup_module

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
def setup_module():
     MimeTypeDatabase.addMimeType(
        MimeType(
            name = "application/vnd.ms-package.3dmanufacturing-3dmodel+xml",
            comment = "3MF",
            suffixes = ["3mf"]
        )
     )

     MimeTypeDatabase.addMimeType(
         MimeType(
             name = "application/x-cura-gcode-file",
             comment = "Cura GCode File",
             suffixes = ["gcode"]
         )
     )
开发者ID:Ultimaker,项目名称:Cura,代码行数:18,代码来源:TestPrintInformation.py

示例10: __init__

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
    def __init__(self) -> None:
        super().__init__()

        MimeTypeDatabase.addMimeType(
            MimeType(
                name = "application/vnd.ms-package.3dmanufacturing-3dmodel+xml",
                comment="3MF",
                suffixes=["3mf"]
            )
        )

        self._supported_extensions = [".3mf"]
        self._root = None
        self._base_name = ""
        self._unit = None
        self._object_count = 0  # Used to name objects as there is no node name yet.
开发者ID:TinkerGnome,项目名称:Cura,代码行数:18,代码来源:ThreeMFReader.py

示例11: register

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
def register(app):
    # add Mime type
    mime_type = MimeType(
        name = "application/x-ultimaker-material-profile",
        comment = "Ultimaker Material Profile",
        suffixes = [ "xml.fdm_material" ]
    )
    MimeTypeDatabase.addMimeType(mime_type)

    # add upgrade version
    from cura.CuraApplication import CuraApplication
    from UM.VersionUpgradeManager import VersionUpgradeManager
    VersionUpgradeManager.getInstance().registerCurrentVersion(
        ("materials", XmlMaterialProfile.XmlMaterialProfile.Version * 1000000 + CuraApplication.SettingVersion),
        (CuraApplication.ResourceTypes.MaterialInstanceContainer, "application/x-ultimaker-material-profile")
    )

    return {"version_upgrade": upgrader,
            "settings_container": XmlMaterialProfile.XmlMaterialProfile("default_xml_material_profile"),
            }
开发者ID:CPS-3,项目名称:Cura,代码行数:22,代码来源:__init__.py

示例12: container_registry

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
def container_registry(application, test_containers_provider, plugin_registry: PluginRegistry):
    MimeTypeDatabase.addMimeType(
        MimeType(
            name = "application/x-uranium-definitioncontainer",
            comment = "Uranium Definition Container",
            suffixes = ["def.json"]
        )
    )

    MimeTypeDatabase.addMimeType(
        MimeType(
            name = "application/x-uranium-instancecontainer",
            comment = "Uranium Instance Container",
            suffixes = [ "inst.cfg" ]
        )
    )

    MimeTypeDatabase.addMimeType(
        MimeType(
            name = "application/x-uranium-containerstack",
            comment = "Uranium Container Stack",
            suffixes = [ "stack.cfg" ]
        )
    )

    ContainerRegistry._ContainerRegistry__instance = None # Reset the private instance variable every time
    registry = ContainerRegistry(application)

    #We need to mock the "priority" plug-in metadata field, but preferably without mocking an entire plug-in.
    with unittest.mock.patch("UM.PluginRegistry.PluginRegistry.getMetaData", unittest.mock.MagicMock(return_value = {"container_provider": {}})):
        registry.addProvider(test_containers_provider)

    UM.Settings.ContainerStack.setContainerRegistry(registry)
    UM.Settings.InstanceContainer.setContainerRegistry(registry)
    return registry
开发者ID:Ultimaker,项目名称:Uranium,代码行数:37,代码来源:conftest.py

示例13: __init__

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        mime = MimeType(
            name = "application/x-uranium-definitioncontainer",
            comment = "Uranium Definition Container",
            suffixes = [ "def.json" ]
        )
        MimeTypeDatabase.addMimeType(mime)
        mime = MimeType(
            name = "application/x-uranium-instancecontainer",
            comment = "Uranium Instance Container",
            suffixes = [ "inst.cfg" ]
        )
        MimeTypeDatabase.addMimeType(mime)
        mime = MimeType(
            name = "application/x-uranium-containerstack",
            comment = "Uranium Container Stack",
            suffixes = [ "stack.cfg" ]
        )
        MimeTypeDatabase.addMimeType(mime)

        self._emptyInstanceContainer = _EmptyInstanceContainer("empty")

        self._containers = [ self._emptyInstanceContainer ]

        self._id_container_cache = {}

        self._resource_types = [Resources.DefinitionContainers]
开发者ID:TimurAykutYildirim,项目名称:Uranium,代码行数:31,代码来源:ContainerRegistry.py

示例14: container_registry

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
def container_registry(application):
    MimeTypeDatabase.addMimeType(
        MimeType(
            name = "application/x-uranium-definitioncontainer",
            comment = "Uranium Definition Container",
            suffixes = ["def.json"]
        )
    )

    MimeTypeDatabase.addMimeType(
        MimeType(
            name = "application/x-uranium-instancecontainer",
            comment = "Uranium Instance Container",
            suffixes = [ "inst.cfg" ]
        )
    )

    MimeTypeDatabase.addMimeType(
        MimeType(
            name = "application/x-uranium-containerstack",
            comment = "Uranium Container Stack",
            suffixes = [ "stack.cfg" ]
        )
    )

    Resources.addSearchPath(os.path.dirname(os.path.abspath(__file__)))
    ContainerRegistry._ContainerRegistry__instance = None # Reset the private instance variable every time

    ContainerRegistry.setApplication(application)

    UM.Settings.ContainerStack.setContainerRegistry(ContainerRegistry.getInstance())
    UM.Settings.InstanceContainer.setContainerRegistry(ContainerRegistry.getInstance())
    return ContainerRegistry.getInstance()
开发者ID:senttech,项目名称:Uranium,代码行数:35,代码来源:conftest.py

示例15: container_registry

# 需要导入模块: from UM.MimeTypeDatabase import MimeTypeDatabase [as 别名]
# 或者: from UM.MimeTypeDatabase.MimeTypeDatabase import addMimeType [as 别名]
def container_registry(application):
    MimeTypeDatabase.addMimeType(
        MimeType(
            name = "application/x-uranium-definitioncontainer",
            comment = "Uranium Definition Container",
            suffixes = ["def.json"]
        )
    )

    MimeTypeDatabase.addMimeType(
        MimeType(
            name = "application/x-uranium-instancecontainer",
            comment = "Uranium Instance Container",
            suffixes = [ "inst.cfg" ]
        )
    )

    MimeTypeDatabase.addMimeType(
        MimeType(
            name = "application/x-uranium-containerstack",
            comment = "Uranium Container Stack",
            suffixes = [ "stack.cfg" ]
        )
    )

    Resources.addSearchPath(os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "Settings")))
    ContainerRegistry._ContainerRegistry__instance = None # Reset the private instance variable every time
    PluginRegistry.getInstance().removeType("settings_container")

    ContainerRegistry.getInstance().load()

    return ContainerRegistry.getInstance()
开发者ID:senttech,项目名称:Uranium,代码行数:34,代码来源:BenchmarkContainerRegistry.py


注:本文中的UM.MimeTypeDatabase.MimeTypeDatabase.addMimeType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。