def copy(self, memo): c = Block.copy(self, memo) diagram = self.diagram().copy(memo) diagram.set_parent(c) c.__diagram = diagram.tag memo[self.__diagram] = c.__diagram return c
def remove(self, child): Block.remove(self, child) self.resize()
def insert(self, child, index): Block.insert(child, index) self.resize()
def append(self, child): Block.append(self, child) if self.canvas: self.resize()
def iter(self, mode=''): if mode == 'tree_node': return iter([self.diagram()]) else: return Block.iter(self, mode)
def accept(self, visitor, mode='DLR'): if mode == 'DLR': Block.accept(self, visitor, mode) self.diagram().accept(visitor, mode) if mode == 'LRD': Block.accept(self, visitor, mode)
def construct(self, parent): Block.construct(self, parent) diagram = Diagram(self.dict, 'Sub Diagram') diagram.construct(self) self.__diagram = diagram.tag return self
def __init__(self, cd=None, name=''): Block.__init__(self, cd, name, '用户自定义功能') self.__diagram = None