def autoLayoutNodes( self, 
                         nodes, 
                         padX = None, 
                         padY = None, 
                         direction = Qt.Horizontal,
                         layout = 'Layered',
                         animate = 0,
                         centerOn = None,
                         center = None,
                         debug=False):
        """
        Automatically lays out all the nodes in the scene using the private \
        autoLayoutNodes method.
        
        :param      nodes | [<XNode>, ..]
                    padX | <int> || None | default is 2 * cell width
                    padY | <int> || None | default is 2 * cell height
                    direction | <Qt.Direction>
                    layout | <str> | name of the layout plugin to use
                    animate | <int> | number of seconds to animate over
        
        :return     {<XNode>: <QRectF>, ..} | new rects per affected node
        """
        plugin = XNodeLayout.plugin(layout)
        if not plugin:
            return 0
        
        if not animate:
            plugin.setTesting(debug)
            results = plugin.layout(self, nodes, center, padX, padY, direction)
            if centerOn:
                self.mainView().centerOn(centerOn)
            return results
        else:
            anim_group = QParallelAnimationGroup(self)
            plugin.setTesting(debug)
            results = plugin.layout(self,
                                   nodes,
                                   center,
                                   padX,
                                   padY,
                                   direction,
                                   anim_group)
            
            if isinstance(centerOn, XNode):
                if centerOn in results:
                    end_center = results[centerOn] + centerOn.rect().center()
                else:
                    end_center = centerOn.sceneRect().center()
                
                anim = XObjectAnimation(self.mainView(), 'centerOn')
                anim.setStartValue(self.mainView().viewportRect().center())
                anim.setEndValue(end_center)
                anim_group.addAnimation(anim)
            
            for i in range(anim_group.animationCount()):
                anim = anim_group.animationAt(i)
                anim.setDuration(1000 * animate)
            
            anim_group.finished.connect(anim_group.deleteLater)
            anim_group.start()
            return results
def autoLayoutNodes ( self , nodes , padX = None , padY = None , direction = Qt . Horizontal , layout = 'Layered' , animate = 0 , centerOn = None , center = None , debug = False ) : plugin = XNodeLayout . plugin ( layout ) if not plugin : return 0 if not animate : plugin . setTesting ( debug ) results = plugin . layout ( self , nodes , center , padX , padY , direction ) if centerOn : self . mainView ( ) . centerOn ( centerOn ) return results else : anim_group = QParallelAnimationGroup ( self ) plugin . setTesting ( debug ) results = plugin . layout ( self , nodes , center , padX , padY , direction , anim_group ) if isinstance ( centerOn , XNode ) : if centerOn in results : end_center = results [ centerOn ] + centerOn . rect ( ) . center ( ) else : end_center = centerOn . sceneRect ( ) . center ( ) anim = XObjectAnimation ( self . mainView ( ) , 'centerOn' ) anim . setStartValue ( self . mainView ( ) . viewportRect ( ) . center ( ) ) anim . setEndValue ( end_center ) anim_group . addAnimation ( anim ) for i in range ( anim_group . animationCount ( ) ) : anim = anim_group . animationAt ( i ) anim . setDuration ( 1000 * animate ) anim_group . finished . connect ( anim_group . deleteLater ) anim_group . start ( ) return results
Automatically lays out all the nodes in the scene using the private \
        autoLayoutNodes method.
        
        :param      nodes | [<XNode>, ..]
                    padX | <int> || None | default is 2 * cell width
                    padY | <int> || None | default is 2 * cell height
                    direction | <Qt.Direction>
                    layout | <str> | name of the layout plugin to use
                    animate | <int> | number of seconds to animate over
        
        :return     {<XNode>: <QRectF>, ..} | new rects per affected node