示例#1
0
    def __iadd__(self, config):
        """Add a new IObjFillerTool to a tree."""

        nchild = len(self)
        if type(config) != type([]):
            # Check if this is a duplicate:
            if hasattr(self, config.getName()):
                self.__logger.warning("Duplicate D3PDObject with name \"" +
                                      config.ObjectName + "\" ignored")
                return self
            # If not then add it to the algorithm:
            self.__logger.info("Adding D3PDObject with name \"" +
                               config.ObjectName + "\" and prefix \"" +
                               config.Prefix + "\"")
            self.Tools += [config]
            self.Prefixes += [config.Prefix]
            self.ClassNames += [config.ObjectName]
            config = [config]
        else:
            for c in config:
                self.__iadd__(c)
                pass
            return self

        super(MultiReaderAlg, self).__iadd__(config)

        # Rescan all children to set the proper collection getter registry.
        self._setRegistry(self)

        # Execute the hooks as well. They are needed after all...
        for c in self.getChildren()[nchild:]:
            D3PDObject.runHooks(c)
            pass

        return self
示例#2
0
    def __iadd__(self, configs):
        """Add a new IObjFillerTool to a tree."""

        # FIXME: should make sure name is unique within alg.
        nchild = len(self)
        if type(configs) != type([]):
            configs = [configs]
        self.Tools += configs
        super(MakerAlg, self).__iadd__(configs)

        for c in self.getChildren()[nchild:]:
            # Scan children to set the proper collection getter registry.
            self._setRegistry(c)

            D3PDObject.runHooks(c)
        return self