ó
±éRc           @  s�  d  Z  d d l m Z d d l Z d d l m Z d d l m Z m	 Z	 d d l
 m Z d d l m Z d f  d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d  e f d! „  ƒ  YZ d" e f d# „  ƒ  YZ d S($   s†  
GUI Neutral widgets
===================

Widgets that are designed to work for any of the GUI backends.
All of these widgets require you to predefine an :class:`matplotlib.axes.Axes`
instance and pass that as the first arg.  matplotlib doesn't try to
be too smart with respect to layout -- you will have to figure out how
wide and tall you want your Axes to be to accommodate your widget.
iÿÿÿÿ(   t   print_functionN(   t   dist(   t   Circlet	   Rectangle(   t   Line2D(   t   blended_transform_factoryt   LockDrawc           B  sD   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sY  
    Some widgets, like the cursor, draw onto the canvas, and this is not
    desirable under all circumstances, 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
    c         C  s   d  |  _ d  S(   N(   t   Nonet   _owner(   t   self(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt   __init__   s    c         C  s+   |  j  | ƒ s t d ƒ ‚ n  | |  _ d S(   s   reserve the lock for *o*s   already lockedN(   t	   availablet
   ValueErrorR   (   R	   t   o(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt   __call__"   s    c         C  s+   |  j  | ƒ s t d ƒ ‚ n  d |  _ d S(   s   release the locks   you do not own this lockN(   R   R   R   R   (   R	   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt   release(   s    c         C  s   |  j  ƒ  p |  j | ƒ S(   s   drawing is available to *o*(   t   lockedt   isowner(   R	   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR   .   s    c         C  s   |  j  | k S(   s!   Return True if *o* owns this lock(   R   (   R	   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR   2   s    c         C  s   |  j  d k	 S(   s5   Return True if the lock is currently held by an ownerN(   R   R   (   R	   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR   6   s    (	   t   __name__t
   __module__t   __doc__R
   R   R   R   R   R   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR      s   					t   Widgetc           B  s   e  Z d  Z e Z e Z RS(   s5   
    Abstract base class for GUI neutral widgets
    (   R   R   R   t   Truet   drawont   eventson(    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR   ;   s   t
   AxesWidgetc           B  s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   sv  Widget that is connected to a single :class:`~matplotlib.axes.Axes`.

    Attributes:

    *ax* : :class:`~matplotlib.axes.Axes`
        The parent axes for the widget
    *canvas* : :class:`~matplotlib.backend_bases.FigureCanvasBase` subclass
        The parent figure canvas for the widget.
    *active* : bool
        If False, the widget does not respond to events.
    c         C  s.   | |  _  | j j |  _ g  |  _ t |  _ d  S(   N(   t   axt   figuret   canvast   cidsR   t   active(   R	   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   O   s    		c         C  s)   |  j  j | | ƒ } |  j j | ƒ d S(   s±   Connect callback with an event.

        This should be used in lieu of `figure.canvas.mpl_connect` since this
        function stores call back ids for later clean up.
        N(   R   t   mpl_connectR   t   append(   R	   t   eventt   callbackt   cid(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt   connect_eventU   s    c         C  s(   x! |  j  D] } |  j j | ƒ q
 Wd S(   s-   Disconnect all events created by this widget.N(   R   R   t   mpl_disconnect(   R	   t   c(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt   disconnect_events^   s    c         C  s   |  j  S(   s›   Return True if event should be ignored.

        This method (or a version of it) should be called at the beginning
        of any event callback.
        (   R   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt   ignorec   s    (   R   R   R   R
   R$   R'   R(   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR   C   s
   				t   Buttonc           B  sM   e  Z d  Z d	 d d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(
   s–  
    A GUI neutral button

    The following attributes are accessible

      *ax*
        The :class:`matplotlib.axes.Axes` the button renders into.

      *label*
        A :class:`matplotlib.text.Text` instance.

      *color*
        The color of the button when not hovering.

      *hovercolor*
        The color of the button when hovering.

    Call :meth:`on_clicked` to connect to the button
    s   0.85s   0.95c      
   C  s÷   t  j |  | ƒ | d
 k	 r, | j | ƒ n  | j d d | d d d d d | j ƒ|  _ d |  _ i  |  _ |  j	 d |  j
 ƒ |  j	 d |  j ƒ |  j	 d	 |  j ƒ | j t ƒ | j | ƒ | j g  ƒ | j g  ƒ | |  _ | |  _ | |  _ d
 S(   s  
        *ax*
            The :class:`matplotlib.axes.Axes` instance the button
            will be placed into.

        *label*
            The button text. Accepts string.

        *image*
            The image to place in the button, if not *None*.
            Can be any legal arg to imshow (numpy array,
            matplotlib Image instance, or PIL image).

        *color*
            The color of the button when not activated

        *hovercolor*
            The color of the button when the mouse is over it
        g      à?t   verticalalignmentt   centert   horizontalalignmentt	   transformi    t   button_press_eventt   button_release_eventt   motion_notify_eventN(   R   R
   R   t   imshowt   textt	   transAxest   labelt   cntt	   observersR$   t   _clickt   _releaset   _motiont   set_navigatet   Falset   set_axis_bgcolort
   set_xtickst
   set_ytickst   colort
   hovercolort
   _lastcolor(   R	   R   R4   t   imageR?   R@   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   �   s&    				c         C  se   |  j  | ƒ r d  S| j |  j k r) d  S|  j s6 d  S| j j |  j k ra | j j |  j ƒ n  d  S(   N(   R(   t   inaxesR   R   R   t   mouse_grabbert
   grab_mouse(   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR7   ®   s    	c         C  s�   |  j  | ƒ r d  S| j j |  j k r, d  S| j j |  j ƒ |  j sL d  S| j |  j k rb d  Sx' |  j j ƒ  D] \ } } | | ƒ qr Wd  S(   N(	   R(   R   RD   R   t   release_mouseR   RC   R6   t	   iteritems(   R	   R!   R#   t   func(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR8   ¸   s    	c         C  sˆ   |  j  | ƒ r d  S| j |  j k r1 |  j } n	 |  j } | |  j k r„ |  j j | ƒ | |  _ |  j r„ |  j j j	 j
 ƒ  q„ n  d  S(   N(   R(   RC   R   R@   R?   RA   R<   R   R   R   t   draw(   R	   R!   R&   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR9   Å   s    			c         C  s)   |  j  } | |  j | <|  j  d 7_  | S(   sŽ   
        When the button is clicked, call this *func* with event

        A connection id is returned which can be used to disconnect
        i   (   R5   R6   (   R	   RH   R#   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt
   on_clickedÒ   s    	c         C  s&   y |  j  | =Wn t k
 r! n Xd S(   s,   remove the observer with connection id *cid*N(   R6   t   KeyError(   R	   R#   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt
   disconnectÝ   s    N(
   R   R   R   R   R
   R7   R8   R9   RJ   RL   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR)   l   s   ,	
			t   Sliderc           B  sY   e  Z d  Z d d e e d	 d	 e d „ Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(
   sX  
    A slider representing a floating point range

    The following attributes are defined
      *ax*        : the slider :class:`matplotlib.axes.Axes` instance

      *val*       : the current slider value

      *vline*     : a :class:`matplotlib.lines.Line2D` instance
                     representing the initial value of the slider

      *poly*      : A :class:`matplotlib.patches.Polygon` instance
                     which is the slider knob

      *valfmt*    : the format string for formatting the slider text

      *label*     : a :class:`matplotlib.text.Text` instance
                     for 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
                     greater than *slidermin*

      *slidermax* : another slider - if not *None*, this slider must be
                     less than *slidermax*

      *dragging*  : allow for mouse dragging on slider

    Call :meth:`on_changed` to connect to the slider event
    g      à?s   %1.2fc      
   K  sœ  t  j |  | ƒ | |  _ | |  _ | |  _ | |  _ | j | | d d | � |  _ | j | d d d d d d ƒ|  _	 | |  _
 | j g  ƒ | j | | f ƒ | j g  ƒ | j t ƒ |  j d |  j ƒ |  j d |  j ƒ | rû |  j d |  j ƒ n  | j d	 d
 | d | j d d d d ƒ|  _ | j d d
 | | d | j d d d d ƒ|  _ d |  _ i  |  _ | |  _ | |  _ |	 |  _ |
 |  _ t |  _ d S(   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*
            Used to constrain the value of this slider to the values
            of other sliders.

        additional kwargs are passed on to ``self.poly`` which is the
        :class:`matplotlib.patches.Rectangle` which draws the slider
        knob.  See the :class:`matplotlib.patches.Rectangle` documentation
        valid property names (e.g., *facecolor*, *edgecolor*, *alpha*, ...)
        i    i   R?   t   rt   lwR.   R/   R0   g{®Gáz”¿g      à?R-   R*   R+   R,   t   rightgR¸…ëQð?t   leftN(   R   R
   t   valmint   valmaxt   valt   valinitt   axvspant   polyt   axvlinet   vlinet   valfmtR>   t   set_xlimR=   R:   R;   R$   t   _updateR2   R3   R4   t   valtextR5   R6   t	   closedmint	   closedmaxt	   slidermint	   slidermaxt   drag_active(   R	   R   R4   RR   RS   RU   RZ   R^   R_   R`   Ra   t   draggingt   kwargs(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
     s<    				$								c         C  s§  |  j  | ƒ r d S| j d k r& d S| j d k rf | j |  j k rf t |  _ | j j |  j ƒ n  |  j ss d S| j d k s£ | j d k rÃ | j |  j k rÃ t	 |  _ | j j
 |  j ƒ d S| j } | |  j k rô |  j sè d S|  j } n( | |  j k r|  j sd S|  j } n  |  j d k	 rY| |  j j k rY|  j sJd S|  j j } n  |  j d k	 r–| |  j j k r–|  j s‡d S|  j j } n  |  j | ƒ d S(   s   update the slider positionNi   R.   R/   (   R(   t   buttont   nameRC   R   R   Rb   R   RE   R;   RF   t   xdataRR   R^   RS   R_   R`   R   RT   Ra   t   set_val(   R	   R!   RT   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR\   H  sB    !						!	!	c         C  s²   |  j  j } | d f | d <| d f | d <| |  j  _ |  j j |  j | ƒ |  j rn |  j j j j	 ƒ  n  | |  _
 |  j s„ d  Sx' |  j j ƒ  D] \ } } | | ƒ q” Wd  S(   Ni   i   i    i   (   RW   t   xyR]   t   set_textRZ   R   R   R   R   RI   RT   R   R6   RG   (   R	   RT   Ri   R#   RH   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRh   t  s    			c         C  s)   |  j  } | |  j | <|  j  d 7_  | S(   s©   
        When the slider value is changed, call *func* with the new
        slider position

        A connection id is returned which can be used to disconnect
        i   (   R5   R6   (   R	   RH   R#   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt
   on_changed‚  s    	c         C  s&   y |  j  | =Wn t k
 r! n Xd S(   s,   remove the observer with connection id *cid*N(   R6   RK   (   R	   R#   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRL   Ž  s    c         C  s)   |  j  |  j k r% |  j |  j ƒ n  d S(   s/   reset the slider to the initial value if neededN(   RT   RU   Rh   (   R	   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt   reset•  s    N(   R   R   R   R   R   R
   R\   Rh   Rk   RL   Rl   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRM   å   s   !	?	,			t   CheckButtonsc           B  s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   sN  
    A GUI neutral radio button

    The following attributes are exposed

     *ax*
        The :class:`matplotlib.axes.Axes` instance the buttons are
        located in

     *labels*
        List of :class:`matplotlib.text.Text` instances

     *lines*
        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 its box is not checked.

     *rectangles*
        List of :class:`matplotlib.patches.Rectangle` instances

    Connect to the CheckButtons with the :meth:`on_clicked` method
    c         C  s‚  t  j |  | ƒ | j g  ƒ | j g  ƒ | j t ƒ t | ƒ d k r d t | ƒ d } t j d | | t | ƒ ƒ } n d } d g } d } | j	 ƒ  } g  |  _
 g  |  _ g  |  _ i d d 6d d	 6| j d
 6d d 6} xvt | | ƒ D]e\ }	 }
 | j d |	 |
 d
 | j d d d d ƒ} | d | d } } d |	 | d } }	 t d | |	 f d | d | d | d
 | j ƒ } t | | | g |	 | |	 g | � } t | | | g |	 |	 | g | � } | j | | ƒ | j | | ƒ |  j
 j | ƒ |  j j | ƒ |  j j | | f ƒ | j | ƒ | j | ƒ | j | ƒ | d 7} qð W|  j d |  j ƒ d |  _ i  |  _ d S(   s  
        Add check buttons to :class:`matplotlib.axes.Axes` instance *ax*

        *labels*
            A len(buttons) list of labels as strings

        *actives*
            A len(buttons) list of booleans indicating whether
             the button is active
        i   g      ð?g      Ð?g      à?i    t   kR?   g      ô?t	   linewidthR-   t   buttt   solid_capstyleR,   RQ   R*   R+   g       @gš™™™™™©?Ri   t   widtht   heightt	   facecolorR.   N(   R   R
   R=   R>   R:   R;   t   lent   npt   linspacet   get_axis_bgcolort   labelst   linest
   rectanglesR3   t   zipR2   R   R   t   set_visibleR    t	   add_patcht   add_lineR$   t   _clickedR5   R6   (   R	   R   Ry   t   activest   dyt   ysR5   t   axcolort
   lineparamst   yR4   t   tt   wt   ht   xt   pt   l1t   l2(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   ²  sN    "					&&	c   
      C  sI  |  j  | ƒ r d  S| j d k r& d  S| j |  j k r< d  Sxª t |  j |  j |  j ƒ D]‰ \ } } } | j ƒ  j	 | j
 | j ƒ s£ | j ƒ  j	 | j
 | j ƒ rX | \ } } | j | j ƒ  ƒ | j | j ƒ  ƒ | } PqX qX Wd  S|  j r|  j j j j ƒ  n  |  j sd  Sx- |  j j ƒ  D] \ } }	 |	 | j ƒ  ƒ q%Wd  S(   Ni   (   R(   Re   RC   R   R|   R{   Ry   Rz   t   get_window_extentt   containsRŠ   R†   R}   t   get_visibleR   R   R   RI   R   R6   RG   t   get_text(
   R	   R!   R‹   R‡   Rz   RŒ   R�   t   thistR#   RH   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR€   ñ  s*    +		c         C  s)   |  j  } | |  j | <|  j  d 7_  | S(   s�   
        When the button is clicked, call *func* with button label

        A connection id is returned which can be used to disconnect
        i   (   R5   R6   (   R	   RH   R#   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRJ     s    	c         C  s&   y |  j  | =Wn t k
 r! n Xd S(   s,   remove the observer with connection id *cid*N(   R6   RK   (   R	   R#   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRL     s    (   R   R   R   R
   R€   RJ   RL   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRm   ›  s
   	?		t   RadioButtonsc           B  s8   e  Z d  Z d d d „ Z d „  Z d „  Z d „  Z RS(   s¼  
    A GUI neutral radio button

    The following attributes are exposed

     *ax*
        The :class:`matplotlib.axes.Axes` instance the buttons are in

     *activecolor*
        The color of the button when clicked

     *labels*
        A list of :class:`matplotlib.text.Text` instances

     *circles*
        A list of :class:`matplotlib.patches.Circle` instances

    Connect to the RadioButtons with the :meth:`on_clicked` method
    i    t   bluec         C  s†  t  j |  | ƒ | |  _ | j g  ƒ | j g  ƒ | j t ƒ d t | ƒ d } t j	 d | | t | ƒ ƒ } d } | j
 ƒ  } g  |  _ g  |  _ xÃ t | | ƒ D]² \ }	 }
 | j d |	 |
 d | j d d d d	 ƒ} | | k rò | } n | } t d
 d |	 f d d d | d | j ƒ } |  j j | ƒ |  j j | ƒ | j | ƒ | d 7} q§ W|  j d |  j ƒ d |  _ i  |  _ d S(   s3  
        Add radio buttons to :class:`matplotlib.axes.Axes` instance *ax*

        *labels*
            A len(buttons) list of labels as strings

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

        *activecolor*
            The color of the button when clicked
        g      ð?i   i    g      Ð?R-   R,   RQ   R*   R+   Ri   g333333Ã?t   radiusgš™™™™™©?Rt   R.   N(   R   R
   t   activecolorR=   R>   R:   R;   Ru   Rv   Rw   Rx   Ry   t   circlesR|   R2   R3   R   R    R~   R$   R€   R5   R6   (   R	   R   Ry   R   R–   R‚   Rƒ   R5   R„   R†   R4   R‡   Rt   R‹   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   3  s6    						c           s›  |  j  | ƒ r d  S| j d k r& d  S| j |  j k r< d  S|  j j j ƒ  j | j | j f ƒ } t	 j
 | d | d g ƒ ‰  ‡  f d †  } xa t |  j |  j ƒ D]F \ } } | j ƒ  j | j | j ƒ sÛ | | ƒ r¥ | } | } Pq¥ q¥ Wd  SxE |  j D]: } | | k r|  j } n |  j j ƒ  } | j | ƒ qý W|  j rZ|  j j j j ƒ  n  |  j sgd  Sx- |  j j ƒ  D] \ }	 }
 |
 | j ƒ  ƒ qwWd  S(   Ni   i    c           s9   t  j |  j d |  j d g ƒ } t ˆ  | ƒ |  j k  S(   Ni    i   (   Rv   t   arrayR+   R   R•   (   R‹   t   pcirc(   t   pclicked(    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt   insideo  s    #(   R(   Re   RC   R   R3   t   invertedt   transform_pointRŠ   R†   Rv   R˜   R|   R—   Ry   RŽ   R�   R–   Rx   t   set_facecolorR   R   R   RI   R   R6   RG   R‘   (   R	   R!   Ri   R›   R‹   R‡   t   inpR’   R?   R#   RH   (    (   Rš   sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR€   e  s4    '"*		c         C  s)   |  j  } | |  j | <|  j  d 7_  | S(   s�   
        When the button is clicked, call *func* with button label

        A connection id is returned which can be used to disconnect
        i   (   R5   R6   (   R	   RH   R#   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRJ   Š  s    	c         C  s&   y |  j  | =Wn t k
 r! n Xd S(   s,   remove the observer with connection id *cid*N(   R6   RK   (   R	   R#   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRL   •  s    (   R   R   R   R
   R€   RJ   RL   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR“     s
   2	%	t   SubplotToolc           B  sM   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   sS   
    A tool to adjust to subplot params of a :class:`matplotlib.figure.Figure`
    c           s\  | ˆ  _  ˆ j d d d d ƒ d d d „  ƒ  Y} ˆ j d ƒ ˆ  _ ˆ  j j d ƒ ˆ  j j t ƒ t ˆ  j d d	 d
 | j j	 d t ƒˆ  _
 ˆ  j
 j ˆ  j ƒ ˆ j d ƒ ˆ  _ ˆ  j j t ƒ t ˆ  j d d	 d
 | j j d t ƒˆ  _ ˆ  j j ˆ  j ƒ ˆ j d ƒ ˆ  _ ˆ  j j t ƒ t ˆ  j d d	 d
 | j j d t ƒˆ  _ ˆ  j j ˆ  j ƒ ˆ j d ƒ ˆ  _ ˆ  j j t ƒ t ˆ  j d d	 d
 | j j d t ƒˆ  _ ˆ  j j ˆ  j ƒ ˆ j d ƒ ˆ  _ ˆ  j j t ƒ t ˆ  j d d	 d
 | j j d t ƒˆ  _ ˆ  j j ˆ  j ƒ ˆ j d ƒ ˆ  _ ˆ  j j t ƒ t ˆ  j d d	 d
 | j j d t ƒˆ  _ ˆ  j j ˆ  j  ƒ ˆ  j ˆ  j
 _! ˆ  j
 ˆ  j _" ˆ  j ˆ  j _! ˆ  j ˆ  j _" ˆ j# d d d d g ƒ } t$ | d ƒ ˆ  _% ˆ  j
 ˆ  j ˆ  j ˆ  j ˆ  j ˆ  j f ‰ ‡  ‡ ‡ f d †  } ˆ j j& } t ˆ j _& ˆ  j% j' | ƒ | ˆ j _& d S(   s   
        *targetfig*
            The figure instance to adjust

        *toolfig*
            The figure instance to embed the subplot tool into. If
            None, a default figure will be created. If you are using
            this from the GUI
        RQ   gš™™™™™É?RP   gÍÌÌÌÌÌì?t
   toolbarfmtc           B  s   e  Z d  „  Z d „  Z RS(   c         S  s   | |  _  d  S(   N(   t   slider(   R	   R¢   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   ±  s    c         S  s*   d |  j  j j ƒ  |  j  j f } | | S(   Ns   %s=%s(   R¢   R4   R‘   RZ   (   R	   RŠ   R†   t   fmt(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR   ´  s    (   R   R   R
   R   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR¡   °  s   	iÇ  s'   Click on slider to adjust subplot parami    i   R_   iÈ  t   bottomiÉ  R^   iÊ  t   topiË  t   wspaceiÌ  t   hspacegš™™™™™é?gš™™™™™©?g333333Ã?g333333³?t   Resetc           s¼   ˆ  j  } t ˆ  _  g  } x' ˆ D] } | j | j  ƒ t | _  q Wx ˆ D] } | j ƒ  qI Wx& t ˆ | ƒ D] \ } } | | _  qm W| ˆ  _  ˆ  j  r¸ ˆ j j ƒ  ˆ  j j j ƒ  n  d  S(   N(   R   R;   R    Rl   R|   R   RI   t	   targetfig(   R!   t
   thisdrawont   bsR¢   t   b(   R	   t   sliderst   toolfig(    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRH   ò  s    				N(    ((   R©   t   subplots_adjustt   add_subplott   axleftt	   set_titleR:   R;   RM   t   subplotparsRQ   t
   sliderleftRk   t   funcleftt   axbottomR¤   t   sliderbottomt
   funcbottomt   axrightRP   t   sliderrightt	   funcrightt   axtopR¥   t	   slidertopt   functopt   axwspaceR¦   t   sliderwspacet
   funcwspacet   axhspaceR§   t   sliderhspacet
   funchspaceRa   R`   t   add_axesR)   t   buttonresett   validateRJ   (   R	   R©   R®   R¡   t   baxRH   RÇ   (    (   R	   R­   R®   sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   ¡  sl    				c         C  s3   |  j  j d | ƒ |  j r/ |  j  j j ƒ  n  d  S(   NRQ   (   R©   R¯   R   R   RI   (   R	   RT   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRµ     s    	c         C  s3   |  j  j d | ƒ |  j r/ |  j  j j ƒ  n  d  S(   NRP   (   R©   R¯   R   R   RI   (   R	   RT   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR»     s    	c         C  s3   |  j  j d | ƒ |  j r/ |  j  j j ƒ  n  d  S(   NR¤   (   R©   R¯   R   R   RI   (   R	   RT   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR¸     s    	c         C  s3   |  j  j d | ƒ |  j r/ |  j  j j ƒ  n  d  S(   NR¥   (   R©   R¯   R   R   RI   (   R	   RT   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR¾   "  s    	c         C  s3   |  j  j d | ƒ |  j r/ |  j  j j ƒ  n  d  S(   NR¦   (   R©   R¯   R   R   RI   (   R	   RT   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÁ   '  s    	c         C  s3   |  j  j d | ƒ |  j r/ |  j  j j ƒ  n  d  S(   NR§   (   R©   R¯   R   R   RI   (   R	   RT   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÄ   ,  s    	(
   R   R   R   R
   Rµ   R»   R¸   R¾   RÁ   RÄ   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR    �  s   	r					t   Cursorc           B  s;   e  Z d  Z e e e d „ Z d „  Z d „  Z d „  Z RS(   s{  
    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*
        Controls the visibility of the horizontal line

      *vertOn*
        Controls the visibility of the horizontal line

    and the visibility of the cursor itself with the *visible* attribute
    c         K  sÜ   t  j |  | ƒ |  j d |  j ƒ |  j d |  j ƒ t |  _ | |  _ | |  _ | o` |  j	 j
 |  _ |  j r| t | d <n  | j | j ƒ  d d t | �|  _ | j | j ƒ  d d t | �|  _ d |  _ t |  _ d S(   s  
        Add a cursor to *ax*.  If ``useblit=True``, use the backend-
        dependent blitting features for faster updates (GTKAgg
        only for now).  *lineprops* is a dictionary of line properties.

        .. plot :: mpl_examples/widgets/cursor.py
        R0   t
   draw_eventt   animatedi    t   visibleN(   R   R
   R$   t   onmovet   clearR   RÌ   t   horizOnt   vertOnR   t   supports_blitt   useblitt   axhlinet
   get_yboundR;   t   linehRX   t
   get_xboundt   linevR   t
   backgroundt	   needclear(   R	   R   RÏ   RÐ   RÒ   t	   lineprops(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   @  s    
				%%	c         C  s^   |  j  | ƒ r d S|  j r: |  j j |  j j ƒ |  _ n  |  j j t	 ƒ |  j
 j t	 ƒ d S(   s   clear the cursorN(   R(   RÒ   R   t   copy_from_bboxR   t   bboxRØ   R×   R}   R;   RÕ   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÎ   \  s    	c         C  s  |  j  | ƒ r d S|  j j j |  ƒ s, d S| j |  j k r„ |  j j t ƒ |  j	 j t ƒ |  j
 r€ |  j j ƒ  t |  _
 n  d St |  _
 |  j sš d S|  j j | j | j f ƒ |  j	 j | j | j f ƒ |  j j |  j oê |  j ƒ |  j	 j |  j o|  j ƒ |  j ƒ  d S(   s*   on mouse motion draw the cursor if visibleN(   R(   R   t
   widgetlockR   RC   R   R×   R}   R;   RÕ   RÙ   RI   R   RÌ   t	   set_xdataRg   t	   set_ydatat   ydataRÐ   RÏ   R\   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÍ   e  s&    			c         C  s~   |  j  rm |  j d  k	 r. |  j j |  j ƒ n  |  j j |  j ƒ |  j j |  j ƒ |  j j	 |  j j
 ƒ n |  j j ƒ  t S(   N(   RÒ   RØ   R   R   t   restore_regionR   t   draw_artistR×   RÕ   t   blitRÜ   t	   draw_idleR;   (   R	   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR\   ~  s    	(	   R   R   R   R   R;   R
   RÎ   RÍ   R\   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÉ   2  s
   			t   MultiCursorc           B  s;   e  Z d  Z e e e d „ Z d „  Z d „  Z d „  Z RS(   sg  
    Provide a vertical (default) and/or horizontal line cursor shared between
    multiple axes

    Example usage::

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

        t = np.arange(0.0, 2.0, 0.01)
        s1 = np.sin(2*np.pi*t)
        s2 = np.sin(4*np.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,
                            horizOn=False, vertOn=True)
        show()

    c         K  s_  | |  _  | |  _ | |  _ | |  _ | d j ƒ  \ } } | d j ƒ  \ }	 }
 d | | } d |	 |
 } t |  _ | o„ |  j  j |  _	 d  |  _ t |  _ | r¯ t | d <n  | ræ g  | D] } | j | d t | �^ q¼ |  _ n	 g  |  _ | r&g  | D] } | j | d t | �^ qü |  _ n	 g  |  _ |  j  j d |  j ƒ |  j  j d |  j ƒ d  S(   Niÿÿÿÿg      à?RË   RÌ   R0   RÊ   (   R   t   axesRÏ   RÐ   t   get_xlimt   get_ylimR   RÌ   RÑ   RÒ   R   RØ   R;   RÙ   RX   t   vlinesRÓ   t   hlinesR   RÍ   RÎ   (   R	   R   Ræ   RÒ   RÏ   RÐ   RÚ   t   xmint   xmaxt   ymint   ymaxt   xmidt   ymidR   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   §  s0    							.	.	c         C  sV   |  j  r* |  j j |  j j j ƒ |  _ n  x% |  j |  j D] } | j t	 ƒ q; Wd S(   s   clear the cursorN(
   RÒ   R   RÛ   R   RÜ   RØ   Ré   Rê   R}   R;   (   R	   R!   t   line(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÎ   Ë  s    	!c         C  sâ   | j  d  k r d  S|  j j j |  ƒ s, d  St |  _ |  j sB d  S|  j r‹ x= |  j	 D]/ } | j
 | j | j f ƒ | j |  j ƒ qU Wn  |  j rÔ x= |  j D]/ } | j | j | j f ƒ | j |  j ƒ qž Wn  |  j ƒ  d  S(   N(   RC   R   R   RÝ   R   R   RÙ   RÌ   RÐ   Ré   RÞ   Rg   R}   RÏ   Rê   Rß   Rà   R\   (   R	   R!   Rñ   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÍ   Ó  s     				c         C  sÙ   |  j  rÈ |  j d  k	 r. |  j j |  j ƒ n  |  j rm x3 t |  j |  j ƒ D] \ } } | j	 | ƒ qM Wn  |  j
 r¬ x3 t |  j |  j ƒ D] \ } } | j	 | ƒ qŒ Wn  |  j j |  j j j ƒ n |  j j ƒ  d  S(   N(   RÒ   RØ   R   R   Rá   RÐ   R|   Ræ   Ré   Râ   RÏ   Rê   Rã   R   RÜ   Rä   (   R	   R   Rñ   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR\   å  s    		"	"(	   R   R   R   R   R;   R
   RÎ   RÍ   R\   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRå   �  s
   $		t   SpanSelectorc           B  sb   e  Z d  Z d	 e d	 d	 d „ Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z RS(
   so  
    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 is called on mouse
      move within the span range

    c         C  sÞ   t  j |  | ƒ | d	 k r4 t d d d d ƒ } n  | d
 k sL t d ƒ ‚ | |  _ t |  _ d	 |  _ d	 |  _	 d	 |  _
 | |  _ | |  _ | |  _ | |  _ t |  _ d |  _ | o¾ |  j j |  _ 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 rectangle 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
        Rt   t   redt   alphag      à?t
   horizontalt   verticals0   Must choose horizontal or vertical for directioni    N(   Rõ   Rö   (   i    i    (   R   R
   R   t   dictt   AssertionErrort	   directionR   RÌ   t   rectRØ   t   pressvt	   rectpropst   onselectt   onmove_callbackt   minspanR;   t
   buttonDownt   prevR   RÑ   RÒ   t   new_axes(   R	   R   Rý   Rù   Rÿ   RÒ   Rü   Rþ   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
     s$    												c      	   C  s0  | |  _  |  j | j j k	 r† |  j ƒ  | j j |  _ |  j d |  j ƒ |  j d |  j ƒ |  j d |  j ƒ |  j d |  j ƒ n  |  j	 d k r¿ t
 |  j  j |  j  j ƒ } d
 \ } } n' t
 |  j  j |  j  j ƒ } d \ } } t d | | d | d	 t |  j �|  _ |  j s,|  j  j |  j ƒ n  d  S(   NR0   R.   R/   RÊ   Rõ   i    i   R-   RÌ   (   i    i   (   i   i    (   i    i    (   R   R   R   R'   R$   RÍ   t   pressR   t   update_backgroundRù   R   t	   transDataR3   R   R;   Rü   Rú   RÒ   R~   (   R	   R   t   transRˆ   R‰   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR  9  s*    	
	c         C  s+   |  j  r' |  j j |  j j ƒ |  _ n  d S(   s!   force an update of the backgroundN(   RÒ   R   RÛ   R   RÜ   RØ   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR  T  s    	c         C  s?   |  j  p |  j } | j |  j k p2 | j d k } | p> | S(   s*   return *True* if *event* should be ignoredi   (   RÌ   R   RC   R   Re   (   R	   R!   t
   widget_offt	   non_event(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR(   [  s    !c         C  s]   |  j  | ƒ r d St |  _ |  j j |  j ƒ |  j d k rM | j |  _ n | j	 |  _ t
 S(   s   on button press eventNRõ   (   R(   R   R   Rú   R}   RÌ   Rù   Rg   Rû   Rà   R;   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR  a  s    	c         C  s  |  j  | ƒ r |  j r d S|  j d k r0 d St |  _ |  j j t ƒ |  j j ƒ  |  j } |  j	 d k r‡ | j
 p� |  j d } n | j pš |  j d } | | k r¹ | | } } n  | | } |  j d k	 rå | |  j k  rå d S|  j | | ƒ d |  _ t S(   s   on button release eventNRõ   i    i   (   R(   R   Rû   R   R;   Rú   R}   R   RI   Rù   Rg   R  Rà   Rÿ   Rý   (   R	   R!   t   vmint   vmaxt   span(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR   n  s&    		
	c         C  sk   |  j  rZ |  j d k	 r. |  j j |  j ƒ n  |  j j |  j ƒ |  j j |  j j	 ƒ n |  j j
 ƒ  t S(   s^   
        Draw using newfangled blit or oldfangled draw depending
        on *useblit*
        N(   RÒ   RØ   R   R   Rá   R   Râ   Rú   Rã   RÜ   Rä   R;   (   R	   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt   update‡  s    	c   	      C  s{  |  j  d k s |  j | ƒ r" d S| j | j } } | | f |  _ |  j d k r\ | } n | } | |  j  } } | | k rŽ | | } } n  |  j d k rÄ |  j j | ƒ |  j j	 | | ƒ n$ |  j j
 | ƒ |  j j | | ƒ |  j d k	 rm|  j  } |  j d k r(| j p"|  j d } n | j p;|  j d } | | k rZ| | } } n  |  j | | ƒ n  |  j ƒ  t S(   s   on motion notify eventNRõ   i    i   (   Rû   R   R(   Rg   Rà   R  Rù   Rú   t   set_xt	   set_widtht   set_yt
   set_heightRþ   R  R;   (	   R	   R!   RŠ   R†   t   vt   minvt   maxvR	  R
  (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÍ   –  s2    		
N(   R   R   R   R   R;   R
   R  R  R(   R  R   R  RÍ   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRò   õ  s   1						t   RectangleSelectorc        	   B  sw   e  Z d  Z d d d e d d d d d „ Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  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()
    t   boxt   datac      	   C  sN  t  j |  | ƒ t |  _ |  j d |  j ƒ |  j d |  j ƒ |  j d |  j ƒ |  j d |  j ƒ t |  _	 d |  _ d |  _ | d k rž d } t |  _ n  | d k r| d k rÚ t d d	 d
 d d d d t ƒ } n  | |  _ t d d d d t |  j �|  _ |  j j |  j ƒ n  | d k rŸ| d k rVt d d d d d d d d ƒ } n  | |  _ t d d g d d g d t |  j �|  _ |  j j |  j ƒ n  | |  _ | o·|  j j |  _ | |  _ | |  _ |
 d k sêt |
 t ƒ rö|
 |  _ n t |
 t ƒ r|
 g |  _ n  |	 d k s&t  ‚ |	 |  _! | |  _" d |  _# d |  _$ d S(   s3  
        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. The ``pos_1`` and ``pos_2`` 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 rectangle 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 *drawtype* if you want the mouse to draw a line,
        a box or nothing between click and actual position by 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 y 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
        R0   R.   R/   RÊ   t   noneRñ   R  Rt   t   whitet	   edgecolort   blackRô   g      à?t   filli    i   RÌ   R?   t	   linestylet   -Ro   i   R  t   pixelsN(   i    i    (   s   dataR  (%   R   R
   R   RÌ   R$   RÍ   R  R   R  R   R   t   to_drawRØ   R;   R÷   Rü   R   R   R~   RÚ   R   R   Rý   R   RÑ   RÒ   t   minspanxt   minspanyt
   isinstancet   listt   validButtonst   intRø   t
   spancoordst   drawtypet
   eventpresst   eventrelease(   R	   R   Rý   R'  R   R!  RÒ   RÚ   Rü   R&  Re   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   Ü  sR    .												c         C  s+   |  j  r' |  j j |  j j ƒ |  _ n  d S(   s!   force an update of the backgroundN(   RÒ   R   RÛ   R   RÜ   RØ   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR  >  s    	c         C  sb  |  j  s t S|  j j j |  ƒ s& t S|  j d k	 rN | j |  j k rN t Sn  |  j d k rm | j	 |  j
 k S| j |  j j k r=| j	 |  j
 k r=|  j
 j j ƒ  j | j | j f ƒ \ } } |  j
 j ƒ  \ } } |  j
 j ƒ  \ } } t | | ƒ } t | | ƒ } t | | ƒ } t | | ƒ } | | _ | | _ t S| j	 |  j
 k pa| j |  j j k S(   s*   return *True* if *event* should be ignoredN(   R   R   R   RÝ   R   R$  R   Re   R(  RC   R   R  Rœ   R�   RŠ   R†   RÖ   RÔ   t   maxt   minRg   Rà   R;   (   R	   R!   Rg   Rà   t   x0t   x1t   y0t   y1(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR(   C  s.    	'		c         C  s3   |  j  | ƒ r d S|  j j |  j ƒ | |  _ t S(   s   on button press eventN(   R(   R  R}   RÌ   R(  R;   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR  l  s
    	c   
      C  s¾  |  j  d k s |  j | ƒ r" d S|  j j t ƒ |  j j ƒ  | |  _ |  j	 d k rŒ |  j  j
 |  j  j } } |  j j
 |  j j } } nP |  j	 d k rÐ |  j  j |  j  j } } |  j j |  j j } } n t d ƒ ‚ | | k rø | | } } n  | | k r| | } } n  | | } | | } |  j d k	 oC| |  j k  } |  j d k	 oa| |  j k  }	 |  j d k s‚|  j d k r’| sŽ|	 r’d S|  j |  j  |  j ƒ d |  _  d |  _ t S(   s   on button release eventNR  R  s%   spancoords must be "data" or "pixels"R  Rñ   (   R(  R   R(   R  R}   R;   R   RI   R)  R&  Rg   Rà   RŠ   R†   R   R   R!  R'  Rý   (
   R	   R!   Rë   Rí   Rì   Rî   t   spanxt   spanyt	   xproblemst	   yproblems(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR   v  s6    	

		c         C  sk   |  j  rZ |  j d k	 r. |  j j |  j ƒ n  |  j j |  j ƒ |  j j |  j j	 ƒ n |  j j
 ƒ  t S(   sT   draw using newfangled blit or oldfangled draw depending on
        useblit

        N(   RÒ   RØ   R   R   Rá   R   Râ   R  Rã   RÜ   Rä   R;   (   R	   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR  ¡  s    	c         C  sD  |  j  d k s |  j | ƒ r" d S| j | j } } |  j d k rø |  j  j | } } |  j  j | } } | | k r† | | } } n  | | k r¢ | | } } n  |  j j | ƒ |  j j | ƒ |  j j	 | | ƒ |  j j
 | | ƒ |  j ƒ  t S|  j d k r@|  j j |  j  j | g |  j  j | g ƒ |  j ƒ  t Sd S(   s,   on motion notify event if box/line is wantedNR  Rñ   (   R(  R   R(   Rg   Rà   R'  R  R  R  R  R  R  R;   t   set_data(   R	   R!   RŠ   R†   t   minxt   maxxt   minyt   maxy(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÍ   ¯  s*    

c         C  s   | |  _  d S(   s‡   
        Use this to activate / deactivate the RectangleSelector
        from your program with an boolean parameter *active*.
        N(   R   (   R	   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt
   set_activeÈ  s    c         C  s   |  j  S(   s-    Get status of active mode (boolean variable)(   R   (   R	   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt
   get_activeÏ  s    N(   R   R   R   R   R;   R
   R  R(   R  R   R  RÍ   R9  R:  (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR  º  s   !		_		)	
	+			t   LassoSelectorc           B  sM   e  Z d  Z d e d d „ Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(   s;  Selection curve of an arbitrary shape.

    The selected path can be used in conjunction with
    :func:`~matplotlib.path.Path.contains_point` to select
    data points from an image.

    In contrast to :class:`Lasso`, `LassoSelector` is written with an interface
    similar to :class:`RectangleSelector` and :class:`SpanSelector` and will
    continue to interact with the axes until disconnected.

    Parameters:

    *ax* : :class:`~matplotlib.axes.Axes`
        The parent axes for the widget.
    *onselect* : function
        Whenever the lasso is released, the `onselect` function is called and
        passed the vertices of the selected path.

    Example usage::

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

        def onselect(verts):
            print verts
        lasso = LassoSelector(ax, onselect)

    c         C  s×   t  j |  | ƒ | o |  j j |  _ | |  _ d  |  _ | d  k rO t ƒ  } n  t	 g  g  | � |  _
 |  j
 j t ƒ |  j j |  j
 ƒ |  j d |  j ƒ |  j d |  j ƒ |  j d |  j ƒ |  j d |  j ƒ d  S(   NR.   R/   R0   RÊ   (   R   R
   R   RÑ   RÒ   Rý   R   t   vertsR÷   R   Rñ   R}   R;   R   R   R$   t   onpresst	   onreleaseRÍ   R  (   R	   R   Rý   RÒ   RÚ   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   ò  s    		c         C  s,   t  | d ƒ o | j d k } |  j p+ | S(   NRe   i   (   t   hasattrRe   R   (   R	   R!   t   wrong_button(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR(     s    c         C  sQ   |  j  | ƒ s! | j |  j k r% d  S| j | j f g |  _ |  j j t ƒ d  S(   N(	   R(   RC   R   Rg   Rà   R<  Rñ   R}   R   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR=    s    !c         C  s™   |  j  | ƒ r d  S|  j d  k	 rf | j |  j k rS |  j j | j | j f ƒ n  |  j |  j ƒ n  |  j	 j
 g  g  g ƒ |  j	 j t ƒ d  |  _ d  S(   N(   R(   R<  R   RC   R   R    Rg   Rà   Rý   Rñ   R4  R}   R;   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR>    s    c         C  sï   |  j  | ƒ s! | j |  j k r% d  S|  j d  k r8 d  S| j |  j k rN d  S| j d k ra d  S|  j j | j | j f ƒ |  j	 j
 t |  j Œ  ƒ |  j rÞ |  j j |  j ƒ |  j j |  j	 ƒ |  j j |  j j ƒ n |  j j ƒ  d  S(   Ni   (   R(   RC   R   R<  R   Re   R    Rg   Rà   Rñ   R4  R|   RÒ   R   Rá   RØ   Râ   Rã   RÜ   Rä   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÍ     s    !	c         C  s>   |  j  | ƒ r d  S|  j r: |  j j |  j j ƒ |  _ n  d  S(   N(   R(   RÒ   R   RÛ   R   RÜ   RØ   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR  -  s    	N(   R   R   R   R   R   R
   R(   R=  R>  RÍ   R  (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR;  Ô  s   				t   Lassoc           B  s/   e  Z d  Z d e d „ Z d „  Z d „  Z RS(   s‹  Selection curve of an arbitrary shape.

    The selected path can be used in conjunction with
    :func:`~matplotlib.path.Path.contains_point` to select data points
    from an image.

    Unlike :class:`LassoSelector`, this must be initialized with a starting
    point `xy`, and the `Lasso` events are destroyed upon release.

    Parameters:

    *ax* : :class:`~matplotlib.axes.Axes`
        The parent axes for the widget.
    *xy* : array
        Coordinates of the start of the lasso.
    *callback* : function
        Whenever the lasso is released, the `callback` function is called and
        passed the vertices of the selected path.

    c      	   C  sÚ   t  j |  | ƒ | o |  j j |  _ |  j rL |  j j |  j j ƒ |  _ n  | \ } } | | f g |  _	 t
 | g | g d d d d d d ƒ|  _ |  j j |  j ƒ | |  _ |  j d |  j ƒ |  j d |  j ƒ d  S(	   NR  R  R?   R  RO   i   R/   R0   (   R   R
   R   RÑ   RÒ   RÛ   R   RÜ   RØ   R<  R   Rñ   R   R"   R$   R>  RÍ   (   R	   R   Ri   R"   RÒ   RŠ   R†   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR
   J  s    	*	c         C  s–   |  j  | ƒ r d  S|  j d  k	 r |  j j | j | j f ƒ t |  j ƒ d k rf |  j |  j ƒ n  |  j j	 j
 |  j ƒ n  d  |  _ |  j ƒ  d  S(   Ni   (   R(   R<  R   R    Rg   Rà   Ru   R"   R   Rz   t   removeRñ   R'   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyR>  Y  s    	c         C  sÝ   |  j  | ƒ r d  S|  j d  k r& d  S| j |  j k r< d  S| j d k rO d  S|  j j | j | j f ƒ |  j	 j
 t |  j Œ  ƒ |  j rÌ |  j j |  j ƒ |  j j |  j	 ƒ |  j j |  j j ƒ n |  j j ƒ  d  S(   Ni   (   R(   R<  R   RC   R   Re   R    Rg   Rà   Rñ   R4  R|   RÒ   R   Rá   RØ   Râ   Rã   RÜ   Rä   (   R	   R!   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRÍ   d  s    	N(   R   R   R   R   R   R
   R>  RÍ   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyRA  4  s   	(   R   t
   __future__R    t   numpyRv   t   mlabR   t   patchesR   R   Rz   R   t
   transformsR   R   t   objectR   R   R)   RM   Rm   R“   R    RÉ   Rå   Rò   R  R;  RA  (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/widgets.pyt   <module>
   s*   &)y¶„~•[hÅÿ `