(self, node, x, y)
return x, y
Fix the position of the tree stemming from the given node.
Fix the position of the tree stemming from the given node.
Fix the position of the tree stemming from the given node .
def _fix_pos(self, node, x, y):
        """Fix the position of the tree stemming from the given node."""
        def brect(node):
            """Get the bounding box of the parent rect and all its children."""
            return node.boundingRect() | node.childrenBoundingRect()

        if node.branches and node.isOpen:
            for n in node.branches:
                x, _ = self._fix_pos(n, x, y + self._VSPACING + brect(node).height())
            x = (node.branches[0].pos().x() + node.branches[-1].pos().x()) / 2
            node.setPos(x, y)
            for e in node.graph_edges():
                e.update_ends()
        else:
            node.setPos(self.gx, y)
            self.gx += self._HSPACING + brect(node).width()
            x += self._HSPACING + brect(node).width()
            self.gy = max(y, self.gy)
        return x, y
def _fix_pos ( self , node , x , y ) : def brect ( node ) : """Get the bounding box of the parent rect and all its children.""" return node . boundingRect ( ) | node . childrenBoundingRect ( ) if node . branches and node . isOpen : for n in node . branches : x , _ = self . _fix_pos ( n , x , y + self . _VSPACING + brect ( node ) . height ( ) ) x = ( node . branches [ 0 ] . pos ( ) . x ( ) + node . branches [ - 1 ] . pos ( ) . x ( ) ) / 2 node . setPos ( x , y ) for e in node . graph_edges ( ) : e . update_ends ( ) else : node . setPos ( self . gx , y ) self . gx += self . _HSPACING + brect ( node ) . width ( ) x += self . _HSPACING + brect ( node ) . width ( ) self . gy = max ( y , self . gy ) return x , y