
    eR                     L    d dl mZ d dlmZmZmZ ddlmZ dgZ G d de      Zy)   )GradientEditorItem)QtCoreQtGui	QtWidgets   )GraphicsViewGradientWidgetc                   z    e Zd ZdZ ej
                  e      Z ej
                  e      ZddZ	d Z
d	dZd Zd Zy)
r	   z
    Widget displaying an editable color gradient. The user may add, move, recolor,
    or remove colors from the gradient. Additionally, a context menu allows the 
    user to select from pre-defined gradients.
    Nc                 0   t        j                  | |dd       d| _        d|d<   t        |i || _        | j                  j
                  j                  | j
                         | j                  j                  j                  | j                         | j                  | j                         | j                  |       | j                  | j                  j                         | j                  t        j                  j                   j"                  t        j                  j                   j$                  z         t&        j(                  j*                  j,                  t&        j(                  j.                  j0                  z  }| j3                  |       y)a*  
        The *orientation* argument may be 'bottom', 'top', 'left', or 'right' 
        indicating whether the gradient is displayed horizontally (top, bottom)
        or vertically (left, right) and on what side of the gradient the editable 
        ticks will appear.
        
        All other arguments are passed to 
        :func:`GradientEditorItem.__init__ <pyqtgraph.GradientEditorItem.__init__>`.
        
        Note: For convenience, this class wraps methods from 
        :class:`GradientEditorItem <pyqtgraph.GradientEditorItem>`.
        FN)	useOpenGL
background   ktickPen)r   __init__maxDimr   itemsigGradientChangedconnectsigGradientChangeFinishedsetCentralItemsetOrientationsetCacheModeCacheModeFlag	CacheNonesetRenderHintsr   QPainter
RenderHintAntialiasingTextAntialiasingr   QFrameShapeNoFrameShadowPlainsetFrameStyle)selfparentorientationargskargsframe_styles         B/usr/lib/python3/dist-packages/pyqtgraph/widgets/GradientWidget.pyr   zGradientWidget.__init__   s    	dFeMi&66			$$,,T-D-DE		++33D4R4RSDII&K($,,667ENN55BBU^^E^E^EoEoop&&,,44y7G7G7N7N7T7TT;'    c                 h    | j                   j                  |       || _        | j                          y)z^Set the orientation of the widget. May be one of 'bottom', 'top', 
        'left', or 'right'.N)r   r   r)   	setMaxDim)r'   orts     r-   r   zGradientWidget.setOrientation1   s(     			  %r.   c                     || j                   }n|| _         | j                  dv r#| j                  |       | j                  d       y | j	                  |       | j                  d       y )N)bottomtopi )r   r)   setFixedHeightsetMaximumWidthsetFixedWidthsetMaximumHeight)r'   mxs     r-   r0   zGradientWidget.setMaxDim8   s^    :BDK00#  *r"!!(+r.   c                 .    t        | j                  |      S N)getattrr   )r'   attrs     r-   __getattr__zGradientWidget.__getattr__E   s    tyy$''r.   c                 H    | j                   | j                  | j                  fS r;   )r   	saveStaterestoreState)r'   s    r-   widgetGroupInterfacez#GradientWidget.widgetGroupInterfaceI   s    ''9J9JKKr.   )Nr3   r;   )__name__
__module____qualname____doc__r   Signalobjectr   r   r   r   r0   r>   rB    r.   r-   r	   r	      sF    
 'v. -f 5(@,(Lr.   N)	 graphicsItems.GradientEditorItemr   Qtr   r   r   r   __all__r	   rI   r.   r-   <module>rM      s)    A ) ) &
BL\ BLr.   