예제 #1
0
    def create_grid_layout ( self, rows = 0, columns = 1, v_margin = 0,
                                   h_margin = 0 ):
        """ Returns a new GUI toolkit neutral grid layout manager which
            supports a (rows,columns) sized grid, with each grid element
            having (v_margin,h_margin) pixels of space around it.

            If rows is 0, the number of rows is not predefined, but will be
            determined by the actual number of controls added to the layout.
        """
        layout = QGridLayout()
        layout.setHorizontalSpacing( h_margin )
        layout.setVerticalSpacing(   v_margin )
        layout.setAlignment( Qt.AlignTop )
        layout.setMargin( 4 )

        return layout_adapter( layout, columns = columns )
예제 #2
0
    def create_box_layout ( self, is_vertical = True, align = '' ):
        """ Returns a new GUI toolkit neutral 'box' layout manager.
        """
        if is_vertical:
            layout    = QVBoxLayout()
            alignment = Qt.AlignTop
            if align == 'bottom':
                alignment = Qt.AlignBottom

            layout.setAlignment( alignment )
        else:
            layout    = QHBoxLayout()
            alignment = Qt.AlignLeft
            if align == 'right':
                alignment = Qt.AlignRight

            layout.setAlignment( alignment )

        layout.setSpacing( 0 )
        layout.setMargin(  0 )

        return layout_adapter( layout, is_vertical )
예제 #3
0
 def create_layout ( self, layout ):
     """ Creates a new GUI toolkit neutral layout manager for the specified
         GUI toolkit specific layout manager or implementor of the
         IAbstractLayout interface.
     """
     return layout_adapter( layout )