Exemple #1
0
    def new_child(self, childtype, settings, children):

        # we don't catch the KeyError here, but in the DisplayFactory
        try:
            self.__group = targetregistry.create(childtype, self)
        except KeyError, exc:
            log("Error: %s\n" % `exc`)
    def new_child(self, childtype, settings, children):

        import targetregistry
        cid = settings["id"]

        child = targetregistry.create(childtype, self)
        only_one = targetregistry.one_child(self.get_name())

        if (only_one and len(self.__children) > 0):
            log("Warning: The %s container accepts only one child."
                % self.get_name(),
                is_warning = True)
        self._register_child(child, cid)
        child.get_widget().show()

        for t, s, c in children:
            child.new_child(t, s, c)

        for key, value in settings.items():
            child.set_xml_prop(key, value)

        return child