# Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.

from UM.PluginRegistry import PluginRegistry

##  Central class to manage all Setting containers.
#
#
class ContainerRegistry:
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._containers = []

        PluginRegistry.getInstance().addType("settings_container", self.addContainerType)

    ##  Find all DefinitionContainer objects matching certain criteria.
    #
    #   \param filter \type{dict} A dictionary containing keys and values that need to match the metadata of the DefinitionContainer.
    def findDefinitionContainers(self, filter):
        return []

    ##  Find all InstanceContainer objects matching certain criteria.
    #
    #   \param filter \type{dict} A dictionary containing keys and values that need to match the metadata of the InstanceContainer.
    def findInstanceContainers(self, filter):
        return []

    ##  Find all ContainerStack objects matching certain criteria.
    #
    #   \param filter \type{dict} A dictionary containing keys and values that need to match the metadata of the ContainerStack.
    def findContainerStacks(self, filter):
        return []

    ##  Add a container type that will be used to serialize/deserialize containers.
    #
    #   \param container An instance of the container type to add.
    def addContainerType(self, container):
        pass

    ##  Get the singleton instance for this class.
    @classmethod
    def getInstance(cls):
        if not cls.__instance:
            cls.__instance = ContainerRegistry()

        return cls.__instance

    __instance = None

@@ -137,16 +137,75 @@
 Registry
+%0Afrom UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
 %0A%0A##  Ce
@@ -363,16 +363,706 @@
 wargs)%0A%0A
+        mime = MimeType(%0A            name = %22application/x-uranium-definitioncontainer%22,%0A            comment = %22Uranium Definition Container%22,%0A            suffixes = %5B %22def.json%22 %5D%0A        )%0A        MimeTypeDatabase.addMimeType(mime)%0A        mime = MimeType(%0A            name = %22application/x-uranium-instancecontainer%22,%0A            comment = %22Uranium Instance Container%22,%0A            suffixes = %5B %22inst.cfg%22 %5D%0A        )%0A        MimeTypeDatabase.addMimeType(mime)%0A        mime = MimeType(%0A            name = %22application/x-uranium-containerstack%22,%0A            comment = %22Uranium Container Stack%22,%0A            suffixes = %5B %22stack.cfg%22 %5D%0A        )%0A        MimeTypeDatabase.addMimeType(mime)%0A%0A
         

Add Container specific mime types in ContainerRegistry's ctor