
    ep                     @    d dl mZ dgZ G d dej                        Zy)   )	QtWidgetsLayoutWidgetc                   J    e Zd ZdZddZd ZddZd ZddZddZ	dd	Z
d
 Zy)r   z
    Convenience class used for laying out QWidgets in a grid.
    (It's just a little less effort to use than QGridLayout)
    Nc                     t         j                  j                  | |       t        j                         | _        | j                  | j                         i | _        i | _        d| _        d| _	        y )N    )
r   QWidget__init__QGridLayoutlayout	setLayoutitemsrows
currentRow
currentCol)selfparents     @/usr/lib/python3/dist-packages/pyqtgraph/widgets/LayoutWidget.pyr	   zLayoutWidget.__init__
   sT    ""40++-t{{#
	    c                 <    | xj                   dz  c_         d| _        y)z2Advance to next row for automatic widget placement   r   N)r   r   )r   s    r   nextRowzLayoutWidget.nextRow   s    1r   c                 J    | xj                   |z  c_         | j                   |z
  S )zAdvance to next column, while returning the current column number 
        (generally only for internal use--called by addWidget))r   )r   colspans     r   
nextColumnzLayoutWidget.nextColumn   s!     	7"w&&r   c                 &     | j                   |i |S )zAlias of nextColumn)r   )r   argskargss      r   nextColzLayoutWidget.nextCol   s    t...r   c                 \    t        j                  |fi |}| j                  |||||       |S )z
        Create a QLabel with *text* and place it in the next available cell (or in the cell specified)
        All extra keyword arguments are passed to QLabel().
        Returns the created widget.
        )r   QLabel	addWidget)r   textrowcolrowspanr   r   s          r   addLabelzLayoutWidget.addLabel#   s2     ..tS#w8r   c                 F    t        di |}| j                  |||||       |S )a  
        Create an empty LayoutWidget and place it in the next available cell (or in the cell specified)
        All extra keyword arguments are passed to :func:`LayoutWidget.__init__ <pyqtgraph.LayoutWidget.__init__>`
        Returns the created widget.
         )r   r!   )r   r#   r$   r%   r   r   r   s          r   	addLayoutzLayoutWidget.addLayout-   s*     &&vsC':r   c                 H   |dk(  r| j                          | j                  }n|| j                  }|| j                  |      }|| j                  vri | j                  |<   || j                  |   |<   ||f| j                  |<   | j
                  j                  |||||       y)zp
        Add a widget to the layout and place it in the next available cell (or in the cell specified).
        nextN)r   r   r   r   r   r   r!   )r   itemr#   r$   r%   r   s         r   r!   zLayoutWidget.addWidget7   s     &=LLN//C[//C ;,,w'CdiiDIIcN"		#s:

4dCgw?r   c                 &    | j                   |   |   S )z#Return the widget in (*row*, *col*))r   )r   r#   r$   s      r   	getWidgetzLayoutWidget.getWidgetL   s    yy~c""r   )N)r   ) NNr   r   )NNr   r   )__name__
__module____qualname____doc__r	   r   r   r   r&   r)   r!   r.   r(   r   r   r   r      s0    

'/
@*#r   N)Qtr   __all__r   r   r(   r   r   <module>r6      s$    
J#9$$ J#r   