HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyc
�
�)�Uc@shdZddlZddlmZddlmZmZddlm	Z	ddl
mZdfd��YZd	fd
��YZ
de
fd��YZd
e
fd��YZde
fd��YZde
fd��YZde
fd��YZdfd��YZdfd��YZdfd��YZdefd��YZdfd��YZde
fd ��YZdS(!s
GUI Neutral widgets

All of these widgets require you to predefine an Axes instance and
pass that as the first arg.  matplotlib doesn't try to be too smart in
layout -- you have to figure out how wide and tall you want your Axes
to be to accommodate your widget.
i����N(tdist(tCirclet	Rectangle(tLine2D(tblended_transform_factorytLockDrawcBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(sT
    some widgets, like the cursor, draw onto the canvas, and this is not
    desirable under all circumstaces, like when the toolbar is in
    zoom-to-rect mode and drawing a rectangle.  The module level "lock"
    allows someone to grab the lock and prevent other widgets from
    drawing.  Use matplotlib.widgets.lock(someobj) to pr
    cCs
d|_dS(N(tNonet_owner(tself((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt__init__scCs+|j|�std��n||_dS(sreserve the lock for osalready lockedN(t	availablet
ValueErrorR(Rto((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt__call__scCs+|j|�std��nd|_dS(srelease the locksyou do not own this lockN(R
RRR(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pytrelease"scCs|j�p|j|�S(sdrawing is available to o(tlockedtisowner(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR
(scCs
|j|kS(so owns the lock(R(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR,scCs
|jdk	S(sthe lock is heldN(RR(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR0s(	t__name__t
__module__t__doc__R	R
RR
RR(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs					tWidgetcBseZdZeZeZRS(sT
    OK, I couldn't resist; abstract base class for mpl GUI neutral
    widgets
    (RRRtTruetdrawonteventson(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR6stButtoncBsMeZdZd	ddd�Zd�Zd�Zd�Zd�Zd�Z	RS(
s>
    A GUI neutral button

    The following attributes are accesible

      ax    - the Axes the button renders into
      label - a text.Text instance
      color - the color of the button when not hovering
      hovercolor - the color of the button when hovering

    Call "on_clicked" to connect to the button
    s0.85s0.95c
Cs|d
k	r|j|�n|jdd|ddddd|j�|_d|_i|_||_|jj	j
d|j�|jj	j
d|j�|jj	j
d	|j
�|jt�|j|�|jg�|jg�||_||_||_d
S(s�
        ax is the Axes instance the button will be placed into

        label is a string which is the button text

        image if not None, is an image to place in the button -- can
          be any legal arg to imshow (numpy array, matplotlib Image
          instance, or PIL image)

        color is the color of the button when not activated

        hovercolor is the color of the button when the mouse is over
          it

        g�?tverticalalignmenttcenterthorizontalalignmentt	transformitbutton_press_eventtbutton_release_eventtmotion_notify_eventN(Rtimshowttextt	transAxestlabeltcntt	observerstaxtfiguretcanvastmpl_connectt_clickt_releaset_motiontset_navigatetFalsetset_axis_bgcolort
set_xtickst
set_ytickstcolort
hovercolort
_lastcolor(RR&R#timageR2R3((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	Os&			



		cCsR|j|jkrdS|js#dS|jj|jkrN|jj|j�ndS(N(tinaxesR&RR(t
mouse_grabbert
grab_mouse(Rtevent((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR*xs	cCs}|jj|jkrdS|jj|j�|js9dS|j|jkrOdSx'|jj�D]\}}||�q_WdS(N(R(R7R&t
release_mouseRR6R%titems(RR9tcidtfunc((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR+�s	cCsu|j|jkr|j}n	|j}||jkrq|jj|�||_|jrq|jjjj	�qqndS(N(
R6R&R3R2R4R/RR'R(tdraw(RR9tc((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR,�s			cCs)|j}||j|<|jd7_|S(s�
        When the button is clicked, call this func with event

        A connection id is returned which can be used to disconnect
        i(R$R%(RR=R<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt
on_clicked�s	
cCs&y|j|=Wntk
r!nXdS(s*remove the observer with connection id cidN(R%tKeyError(RR<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt
disconnect�s
N(
RRRRR	R*R+R,R@RB(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRAs(			
	tSlidercBsYeZdZddeed	d	ed�Zd�Zd�Zd�Zd�Z	d�Z
RS(
s+
    A slider representing a floating point range

    The following attributes are defined
      ax     : the slider axes.Axes instance
      val    : the current slider value
      vline  : a Line2D instance representing the initial value
      poly   : A patch.Polygon instance which is the slider
      valfmt : the format string for formatting the slider text
      label  : a text.Text instance, the slider label
      closedmin : whether the slider is closed on the minimum
      closedmax : whether the slider is closed on the maximum
      slidermin : another slider - if not None, this slider must be > slidermin
      slidermax : another slider - if not None, this slider must be < slidermax
      dragging : allow for mouse dragging on slider

    Call on_changed to connect to the slider event
    g�?s%1.2fc

Ks�||_||_||_||_||_|j||dd|�|_|j|dddddd�|_||_	|j
g�|j||f�|jg�|j
t�|jjjd|j�|jjjd|j�|r|jjjd|j�n|jd	d
|d|jdd
dd�|_|jdd
||d|jdd
dd�|_d|_i|_||_||_|	|_|
|_t|_dS(s�
        Create a slider from valmin to valmax in axes ax;

        valinit -  the slider initial position

        label - the slider label

        valfmt - used to format the slider value

        closedmin and closedmax - indicate whether the slider interval is closed

        slidermin and slidermax - be used to contrain the value of
          this slider to the values of other sliders.

        additional kwargs are passed on to self.poly which is the
        matplotlib.patches.Rectangle which draws the slider.  See the
        matplotlib.patches.Rectangle documentation for legal property
        names (eg facecolor, edgecolor, alpha, ...)
          iiR2trtlwRRRg{�G�z��g�?RRRRtrightgR���Q�?tleftN(R&tvalmintvalmaxtvaltvalinittaxvspantpolytaxvlinetvlinetvalfmtR1tset_xlimR0R-R.R'R(R)t_updateR!R"R#tvaltextR$R%t	closedmint	closedmaxt	slidermint	slidermaxtdrag_active(
RR&R#RHRIRKRPRTRURVRWtdraggingtkwargs((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	�s<					$	


							cCsj|jdkrdS|jdkrS|j|jkrSt|_|jj|j�n|js`dS|jdks�|jdkr�|j|jkr�t|_|jj	|j�dS|j
}||jkr�|js�dS|j}n(||j
kr	|js�dS|j
}n|jdk	r1||jjkr1dSn|jdk	rY||jjkrYdSn|j|�dS(supdate the slider positioniNRR(tbuttontnameR6R&RRXR(R8R.R:txdataRHRTRIRURVRRJRWtset_val(RR9RJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRR�s8!		!				cCs�|jj}|df|d<|df|d<||j_|jj|j|�|jrn|jjjj	�n||_
|js�dSx'|jj
�D]\}}||�q�WdS(Nii����ii����(RMtxyRStset_textRPRR&R'R(R>RJRR%R;(RRJR_R<R=((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR^s			cCs)|j}||j|<|jd7_|S(s�
        When the slider valud is changed, call this func with the new
        slider position

        A connection id is returned which can be used to disconnect
        i(R$R%(RR=R<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt
on_changed's	
cCs&y|j|=Wntk
r!nXdS(s*remove the observer with connection id cidN(R%RA(RR<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRB3s
cCs)|j|jkr%|j|j�ndS(s/reset the slider to the initial value if neededN(RJRKR^(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pytreset8sN(RRRRRR	RRR^RaRBRb(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRC�s;	$			tCheckButtonscBs2eZdZd�Zd�Zd�Zd�ZRS(s�
    A GUI neutral radio button

    The following attributes are exposed

     ax - the Axes instance the buttons are in
     labels - a list of text.Text instances
     lines - a list of (line1, line2) tuples for the x's in the check boxes.
             These lines exist for each box, but have set_visible(False) when
             box is not checked
     rectangles - a list of patch.Rectangle instances

    Connect to the CheckButtons with the on_clicked method
    cCs�|jg�|jg�|jt�t|�dkrodt|�d}tjd||t|��}nd}dg}d}|j�}g|_g|_	g|_
idd6dd	6|jd
6dd6}xvt||�D]e\}	}
|j
d|	|
d
|jd
ddd�}|d|d}}
d|	|
d}}	td||	fd|d|
d|d
|j�}t|||g|	|
|	g|�}t|||g|	|	|
g|�}|j||�|j||�|jj|�|j
j|�|j	j||f�|j|�|j|�|j|�|d7}q�W|jjjd|j�||_d|_i|_dS(s�
        Add check buttons to axes.Axes instance ax

        labels is a len(buttons) list of labels as strings

        actives is a len(buttons) list of booleans indicating whether
         the button is active

        ig�?g�?g�?itkR2g�?t	linewidthRtbutttsolid_capstyleRRGRRg@g�������?R_twidththeightt	facecolorRN(R0R1R-R.tlentnptlinspacetget_axis_bgcolortlabelstlinest
rectanglesR"tzipR!RRtset_visibletappendt	add_patchtadd_lineR'R(R)t_clickedR&R$R%(RR&RotactivestdytysR$taxcolort
lineparamstyR#tttwthtxtptl1tl2((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	NsN


"				
	&&


		c
Cs6|jdkrdS|j|jkr)dSx�t|j|j|j�D]�\}}}|j�j|j	|j
�s�|j�j|j	|j
�rE|\}}|j|j��|j|j��|}PqEqEWdS|j
r�|jjjj�n|jsdSx-|jj�D]\}}	|	|j��qWdS(Ni(R[R6R&RrRqRoRptget_window_extenttcontainsR�R}Rstget_visibleRR'R(R>RR%R;tget_text(
RR9R�R~RpR�R�tthistR<R=((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRw�s&+		cCs)|j}||j|<|jd7_|S(s�
        When the button is clicked, call this func with button label

        A connection id is returned which can be used to disconnect
        i(R$R%(RR=R<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR@�s	
cCs&y|j|=Wntk
r!nXdS(s*remove the observer with connection id cidN(R%RA(RR<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRB�s
(RRRR	RwR@RB(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRc?s
	@		tRadioButtonscBs8eZdZddd�Zd�Zd�Zd�ZRS(sN
    A GUI neutral radio button

    The following attributes are exposed

     ax - the Axes instance the buttons are in
     activecolor - the color of the button when clicked
     labels - a list of text.Text instances
     circles - a list of patch.Circle instances

    Connect to the RadioButtons with the on_clicked method
    itbluecCs�||_|jg�|jg�|jt�dt|�d}tjd||t|��}d}|j�}g|_	g|_
x�t||�D]�\}	}
|jd|	|
d|j
dddd	�}||kr�|}n|}td
d|	fdd
d|d|j
�}
|j	j|�|j
j|
�|j|
�|d7}q�W|jjjd|j�||_d|_i|_dS(s�
        Add radio buttons to axes.Axes instance ax

        labels is a len(buttons) list of labels as strings

        active is the index into labels for the button that is active

        activecolor is the color of the button when clicked
        g�?iig�?RRRGRRR_g333333�?tradiusg�������?RjRN(tactivecolorR0R1R-R.RkRlRmRnRotcirclesRrR!R"RRtRuR'R(R)RwR&R$R%(RR&RotactiveR�RyRzR$R{R}R#R~RjR�((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	�s6
	


				
		cs�|jdkrdS|j|jkr)dS|jjj�j|j|jf�}tj	|d|dg���fd�}xat
|j|j�D]F\}}|j
�j|j|j�s�||�r�|}|}Pq�q�WdSxE|jD]:}||kr|j}n|jj�}|j|�q�W|jrG|jjjj�n|jsTdSx-|jj�D]\}	}
|
|j��qdWdS(Niics9tj|jd|jdg�}t�|�|jkS(Nii(RltarrayRRR�(R�tpcirc(tpclicked(sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pytinside�s#(R[R6R&R"tinvertedttransform_pointR�R}RlR�RrR�RoR�R�R�Rnt
set_facecolorRR'R(R>RR%R;R�(RR9R_R�R�R~tinpR�R2R<R=((R�sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRw�s0'"*		cCs)|j}||j|<|jd7_|S(s�
        When the button is clicked, call this func with button label

        A connection id is returned which can be used to disconnect
        i(R$R%(RR=R<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR@s	
cCs&y|j|=Wntk
r!nXdS(s*remove the observer with connection id cidN(R%RA(RR<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRBs
(RRRR	RwR@RB(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s
1		tSubplotToolcBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s3
    A tool to adjust to subplot params of fig
    cs\|�_�jdddd�ddd��Y}�jd��_�jjd��jjt�t�jdd	d
|jj	dt��_
�j
j�j��jd��_
�j
jt�t�j
d
d	d
|jjdt��_�jj�j��jd��_�jjt�t�jdd	d
|jjdt��_�jj�j��jd��_�jjt�t�jdd	d
|jjdt��_�jj�j��jd��_�jjt�t�jdd	d
|jjdt��_�jj�j��jd��_�jjt�t�jdd	d
|jjdt��_�jj�j ��j�j
_!�j
�j_"�j�j_!�j�j_"�j#ddddg�}t$|d��_%�j
�j�j�j�j�jf����fd�}�jj&}t�j_&�j%j'|�|�j_&dS(s�
        targetfig is the figure to adjust

        toolfig is the figure to embed the the subplot tool into.  If
        None, a default pylab figure will be created.  If you are
        using this from the GUI
        RGg�������?RFg�������?t
toolbarfmtcBseZd�Zd�ZRS(cSs
||_dS(N(tslider(RR�((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	4scSs*d|jjj�|jjf}||S(Ns%s=%s(R�R#R�RP(RR�R}tfmt((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR
7s"(RRR	R
(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR�3s	i�s'Click on slider to adjust subplot paramiiRUi�tbottomi�RTi�ttopi�twspacei�thspaceg�������?g�������?g333333�?g333333�?tResetcs��j}t�_g}x'�D]}|j|j�t|_qWx�D]}|j�qIWx&t�|�D]\}}||_qmW|�_�jr��jj��jjj�ndS(N(RR.RtRbRrR(R>t	targetfig(R9t
thisdrawontbsR�tb(Rtslidersttoolfig(sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR=ls		



		
N(((R�tsubplots_adjusttadd_subplottaxleftt	set_titleR-R.RCtsubplotparsRGt
sliderleftRatfunclefttaxbottomR�tsliderbottomt
funcbottomtaxrightRFtsliderrightt	funcrighttaxtopR�t	slidertoptfunctoptaxwspaceR�tsliderwspacet
funcwspacetaxhspaceR�tsliderhspacet
funchspaceRWRVtadd_axesRtbuttonresettvalidateR@(RR�R�R�tbaxR=R�((RR�R�sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	(sR	******cCs3|jjd|�|jr/|jjj�ndS(NRG(R�R�RR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	cCs3|jjd|�|jr/|jjj�ndS(NRF(R�R�RR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	cCs3|jjd|�|jr/|jjj�ndS(NR�(R�R�RR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	cCs3|jjd|�|jr/|jjj�ndS(NR�(R�R�RR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	cCs3|jjd|�|jr/|jjj�ndS(NR�(R�R�RR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	cCs3|jjd|�|jr/|jjj�ndS(NR�(R�R�RR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	(
RRRR	R�R�R�R�R�R�(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR�$s	f					tCursorcBs5eZdZed�Zd�Zd�Zd�ZRS(sr
    A horizontal and vertical line span the axes that and move with
    the pointer.  You can turn off the hline or vline spectively with
    the attributes

      horizOn =True|False: controls visibility of the horizontal line
      vertOn =True|False: controls visibility of the horizontal line

    And the visibility of the cursor itself with visible attribute
    cKs�||_|jj|_|jjd|j�|jjd|j�t|_t|_t|_	||_
|r{t|d<n|j|j�ddt
|�|_|j|j�ddt
|�|_d|_t
|_dS(s�
        Add a cursor to ax.  If useblit=True, use the backend
        dependent blitting features for faster updates (GTKAgg only
        now).  lineprops is a dictionary of line properties.  See
        examples/widgets/cursor.py.
        Rt
draw_eventtanimateditvisibleN(R&R'R(R)tonmovetclearRR�thorizOntvertOntuseblittaxhlinet
get_yboundR.tlinehRNt
get_xboundtlinevRt
backgroundt	needclear(RR&R�t	lineprops((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	�s					
%%	cCsK|jr'|jj|jj�|_n|jjt�|j	jt�dS(sclear the cursorN(
R�R(tcopy_from_bboxR&tbboxR�R�RsR.R�(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	cCs�|j|jkrX|jjt�|jjt�|jrT|jj�t|_ndSt	|_|j
sndS|jj|j|jf�|jj
|j|jf�|jj|j
o�|j�|jj|j
o�|j�|j�dS(s*on mouse motion draw the cursor if visibleN(R6R&R�RsR.R�R�R(R>RR�t	set_xdataR]t	set_ydatatydataR�R�RR(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	
		cCs~|jrm|jdk	r.|jj|j�n|jj|j�|jj|j�|jj	|jj
�n
|jj�tS(N(
R�R�RR(trestore_regionR&tdraw_artistR�R�tblitR�t	draw_idleR.(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRR�s	
(RRRR.R	R�R�RR(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s

		tMultiCursorcBs5eZdZed�Zd�Zd�Zd�ZRS(s�
    Provide a vertical line cursor shared between multiple axes

    from matplotlib.widgets import MultiCursor
    from pylab import figure, show, nx

    t = nx.arange(0.0, 2.0, 0.01)
    s1 = nx.sin(2*nx.pi*t)
    s2 = nx.sin(4*nx.pi*t)
    fig = figure()
    ax1 = fig.add_subplot(211)
    ax1.plot(t, s1)


    ax2 = fig.add_subplot(212, sharex=ax1)
    ax2.plot(t, s2)

    multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1)
    show()

    c	Ks�||_||_|dj�\}}d||}|rIt|d<ng|D]}|j|dt|�^qP|_t|_||_d|_
t|_|jjd|j
�|jjd|j�dS(Ni����g�?R�R�RR�(R(taxestget_xlimRRNR.RpR�R�RR�R�R)R�R�(	RR(R�R�R�txmintxmaxtxmidR&((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	
s		
.				cCsO|jr*|jj|jjj�|_nx|jD]}|jt�q4WdS(sclear the cursorN(	R�R(R�R'R�R�RpRsR.(RR9tline((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR�!s	!cCs�|jdkrdS|jjj|�s,dSt|_|jsBdSx:|jD]/}|j	|j
|j
f�|j|j�qLW|j�dS(N(
R6RR(t
widgetlockR
RR�R�RpR�R]RsRR(RR9R�((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR�(s		cCs�|jr}|jdk	r.|jj|j�nx0t|j|j�D]\}}|j|�qDW|jj	|jj
j�n
|jj�dS(N(
R�R�RR(R�RrR�RpR�R�R'R�R�(RR&R�((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRR4s	"(RRRRR	R�R�RR(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s
		tSpanSelectorcBsbeZdZd	ed	d	d�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�ZRS(
sg
    Select a min/max range of the x or y axes for a matplotlib Axes

    Example usage:

      ax = subplot(111)
      ax.plot(x,y)

      def onselect(vmin, vmax):
          print vmin, vmax
      span = SpanSelector(ax, onselect, 'horizontal')

      onmove_callback is an optional callback that will be called on mouse move
      with the span range

    cCs�|d	kr$tdddd�}n|d
ks<td��||_d	|_d	|_t|_g|_d	|_	d	|_
d	|_||_||_
||_||_||_t|_d|_|j|�d	S(s
        Create a span selector in ax.  When a selection is made, clear
        the span and call onselect with

          onselect(vmin, vmax)

        and clear the span.

        direction must be 'horizontal' or 'vertical'

        If minspan is not None, ignore events smaller than minspan

        The span rect is drawn with rectprops; default
          rectprops = dict(facecolor='red', alpha=0.5)

        set the visible attribute to False if you want to turn off
        the functionality of the span selector


        Rjtredtalphag�?t
horizontaltverticals0Must choose horizontal or vertical for directioniN(R�R�(ii(RtdicttAssertionErrort	directionR&R(RR�tcidstrectR�tpressvt	rectpropstonselecttonmove_callbackR�tminspanR.t
buttonDowntprevtnew_axes(RR&R�R�R�R�R�R�((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	Rs&															c	Cs�||_|j|jjk	r�x!|jD]}|jj|�q(W|jj|_|jj|jjd|j��|jj|jjd|j��|jj|jjd|j	��|jj|jjd|j
��n|jdkrt|jj
|jj�}d
\}}n't|jj|jj
�}d\}}td||d|d	t|j�|_|js�|jj|j�ndS(
NRRRR�R�iiRR�(ii(ii(ii(R&R(R'R�tmpl_disconnectRtR)R�tpressRtupdate_backgroundR�Rt	transDataR"RR.R�R�R�Ru(RR&R<ttransRR�((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s(	"""%	cCs+|jr'|jj|jj�|_ndS(s!force an update of the backgroundN(R�R(R�R&R�R�(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	cCs)|j|jkp(|jp(|jdkS(s&return True if event should be ignoredi(R6R&R�R[(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pytignore�scCs]|j|�rdSt|_|jj|j�|jdkrM|j|_n|j	|_t
S(son button press eventNR�(R�RR�R�RsR�R�R]R�R�R.(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	cCs�|jdks(|j|�r,|jr,dSt|_|jjt�|jj�|j}|j	dkr�|j
p}|jd}n|jp�|jd}||kr�||}}n||}|j
dk	r�||j
kr�dS|j||�d|_tS(son button release eventNR�ii(R�RR�R�R.R�RsR(R>R�R]R�R�R�R�(RR9tvmintvmaxtspan((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR�s"(	
	
	cCsk|jrZ|jdk	r.|jj|j�n|jj|j�|jj|jj	�n
|jj
�tS(sBdraw using newfangled blit or oldfangled draw depending on useblitN(R�R�RR(R�R&R�R�R�R�R�R.(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pytupdate�s	
c	Cs{|jdks|j|�r"dS|j|j}}||f|_|jdkr\|}n|}||j}}||kr�||}}n|jdkr�|jj|�|jj	||�n$|jj
|�|jj||�|jdk	rm|j}|jdkr(|jp"|jd}n|jp;|jd}||krZ||}}n|j||�n|j
�tS(son motion notify eventNR�ii(R�RR�R]R�R�R�R�tset_xt	set_widthtset_yt
set_heightR�R�R.(	RR9R�R}tvtminvtmaxvR�R�((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s2		
N(
RRRRR.R	R�R�R�R�RR�R�(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR�@s1				
		tHorizontalSpanSelectorcBseZd�ZRS(cKs9ddl}|jdt�tj|||d|�dS(Ni����sUse SpanSelector instead!R�(twarningstwarntDeprecationWarningR�R	(RR&R�RZR((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	�s(RRR	(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR�stRectangleSelectorc	BsweZdZdddeddddd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
RS(
s�
    Select a min/max range of the x axes for a matplotlib Axes

    Example usage::

        from matplotlib.widgets import  RectangleSelector
        from pylab import *

        def onselect(eclick, erelease):
          'eclick and erelease are matplotlib events at press and release'
          print ' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata)
          print ' endposition   : (%f, %f)' % (erelease.xdata, erelease.ydata)
          print ' used button   : ', eclick.button

        def toggle_selector(event):
            print ' Key pressed.'
            if event.key in ['Q', 'q'] and toggle_selector.RS.active:
                print ' RectangleSelector deactivated.'
                toggle_selector.RS.set_active(False)
            if event.key in ['A', 'a'] and not toggle_selector.RS.active:
                print ' RectangleSelector activated.'
                toggle_selector.RS.set_active(True)

        x = arange(100)/(99.0)
        y = sin(x)
        fig = figure
        ax = subplot(111)
        ax.plot(x,y)

        toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='line')
        connect('key_press_event', toggle_selector)
        show()
    tboxtdatac	CsV||_t|_|jj|_|jjd|j�|jjd|j�|jjd|j�|jjd|j	�t|_
d|_d|_
|dkr�d}t|_n|dkr.|dkr�tdd	d
ddd
dt�}n||_tddddt|j�|_|jj|j�n|dkr�|dkrjtdddddddd
�}n||_tddgddgdt|j�|_|jj|j�n||_||_||_||_|
dks�t|
t�r�|
|_nt|
t�r|
g|_n|	dks.t�|	|_||_ d|_!d|_"dS(s�
        Create a selector in ax.  When a selection is made, clear
        the span and call onselect with

          onselect(pos_1, pos_2)

        and clear the drawn box/line. There pos_i are arrays of length 2
        containing the x- and y-coordinate.

        If minspanx is not None then events smaller than minspanx
        in x direction are ignored(it's the same for y).

        The rect is drawn with rectprops; default
          rectprops = dict(facecolor='red', edgecolor = 'black',
                           alpha=0.5, fill=False)

        The line is drawn with lineprops; default
          lineprops = dict(color='black', linestyle='-',
                           linewidth = 2, alpha=0.5)

        Use type if you want the mouse to draw a line, a box or nothing
        between click and actual position ny setting

        drawtype = 'line', drawtype='box' or drawtype = 'none'.

        spancoords is one of 'data' or 'pixels'.  If 'data', minspanx
        and minspanx will be interpreted in the same coordinates as
        the x and ya axis, if 'pixels', they are in pixels

        button is a list of integers indicating which mouse buttons should
        be used for rectangle selection.  You can also specify a single
        integer if only a single button is desired.  Default is None, which
        does not limit which button can be used.
        Note, typically:
         1 = left mouse button
         2 = center mouse button (scroll wheel)
         3 = right mouse button
        RRRR�tnoneR�RRjtwhitet	edgecolortblackR�g�?tfilliiR�R2t	linestylet-ReiRtpixelsN(ii(sdataR(#R&RR�R'R(R)R�R�RR�R�Rtto_drawR�R.R�R�RRuR�RRvR�R�tminspanxtminspanyt
isinstancetlisttvalidButtonstintR�t
spancoordstdrawtypet
eventpressteventrelease(RR&R�RRRR�R�R�RR[((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	sP+						!	*							cCs+|jr'|jj|jj�|_ndS(s!force an update of the backgroundN(R�R(R�R&R�R�(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR�{s	cCs�|js
tS|jjj|�s&tS|jdk	rN|j|jkrNtSn|jdkrm|j	|j
kS|j	|j
kp�|j|jjkS(s&return True if event should be ignoredN(R�RR(R�R
RRR[RR6R&(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	cCs3|j|�rdS|jj|j�||_tS(son button press eventN(R�RRsR�RR.(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s
	c

Cs�|jdks|j|�r"dS|jjt�|jj�||_|j	dkr�|jj
|jj}}|jj
|jj}}nP|j	dkr�|jj|jj
}}|jj|jj
}}ntd��||kr�||}}n||kr||}}n||}||}|jdk	oC||jk}|jdk	oa||jk}	|jdkr�|s|	r�dS|jdkr�|r�|	r�dS|j|j|j�d|_d|_tS(son button release eventNRRs%spancoords must be "data" or "pixels"RR�(RRR�RRsR.R(R>RRR]R�R�R}RRRRR�(
RR9R�tyminR�tymaxtspanxtspanyt	xproblemst	yproblems((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR�s8
	

		cCsk|jrZ|jdk	r.|jj|j�n|jj|j�|jj|jj	�n
|jj
�tS(sBdraw using newfangled blit or oldfangled draw depending on useblitN(R�R�RR(R�R&R�RR�R�R�R.(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s	
cCsD|jdks|j|�r"dS|j|j}}|jdkr�|jj|}}|jj|}}||kr�||}}n||kr�||}}n|jj|�|jj|�|jj	||�|jj
||�|j�tS|jdkr@|jj
|jj|g|jj|g�|j�tSdS(s,on motion notify event if box/line is wantedNRR�(RRR�R]R�RRR�RRRR�R.tset_data(RR9R�R}tminxtmaxxtminytmaxy((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR��s*

cCs
||_dS(s� Use this to activate / deactivate the RectangleSelector

            from your program with an boolean variable 'active'.
        N(R�(RR�((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt
set_active�scCs|jS(s0 to get status of active mode (boolean variable)(R�(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt
get_active�sN(RRRRR.R	R�R�R�RR�R�R+R,(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR
�s!		Z			
	(			tLassocBs)eZded�Zd�Zd�ZRS(c	Cs||_|j|_|jj|_||_|rQ|jj|jj�|_n|\}}||fg|_t|g|gdddddd�|_	|jj
|j	�||_g|_|jj
|jjd|j��|jj
|jjd|j��dS(	NRRR2RREiRR(R�R'R(R�R�R�R�tvertsRR�RvtcallbackR�RtR)t	onreleaseR�(RR&R_R/R�R�R}((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR	�s		*		"cCs�|jdk	rl|jj|j|jf�t|j�dkrS|j|j�n|jjj	|j
�nd|_x!|jD]}|jj
|�qWdS(Ni(R.RRtR]R�RkR/R�RptremoveR�R�R(R�(RR9R<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR0s	cCs�|jdkrdS|j|jkr)dS|jdkr<dS|jj|j|jf�|jj	t
|j��|jr�|jj
|j�|jj|j�|jj|jj�n
|jj�dS(Ni(R.RR6R�R[RtR]R�R�R&RrR�R(R�R�R�R�R�R�(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR�s	N(RRRRR	R0R�(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR-�s	
(RtnumpyRltmlabRtpatchesRRRpRt
transformsRRRRRCRcR�R�R�R�R�RR
R-(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt<module>s&%f�wn�PI��