
 m[c           @` s  d  Z  d d l m Z m Z m Z m Z d d l Z d d l m Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z
 d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m Z m Z m Z m Z m Z m Z d d l m Z d d l m Z d d l m Z m Z d d	 l m  Z  d d
 l! m" Z" d d l# m$ Z$ d d l% m& Z& d d l m' Z' m( Z( m) Z) d d l* m+ Z, d d l- Z- d Z. e. d k  rd d l/ Z/ d d l0 Z0 n  i d d 6d d 6d d 6d d 6Z1 d e2 d  Z3 d   Z4 d e5 f d     YZ6 d Z7 d Z8 e2 d  Z9 d   Z: d e f d      YZ; d! e f d"     YZ< d# e f d$     YZ= d% e e- j> f d&     YZ? d' e? f d(     YZ@ d) e- jA f d*     YZB d+ e f d,     YZC e- jD   ZE e- jD   ZF e- jD   ZG e- jD   ZH e- jD   ZI e- jD   ZJ e- jD   ZK e- jD   ZL e- jD   ZM e- jD   ZN e- jD   ZO e- jD   ZP d-   ZQ d. e- jR f d/     YZS i e- jT e jU 6e- jT e jV 6e- jW e jX 6e- jY e jZ 6e- j[ e j\ 6Z] e' j^ d0  d1 e- jA f d2     Y Z_ d3 e e- j` f d4     YZa e' j^ d0 d5 d6 d7 ea f d8     Y Zb d9 e- jc f d:     YZd d; e) je f d<     YZf d= e) jg f d>     YZh d? e- ji k rd@ e) jj f dA     YZk n d@ e) jj f dB     YZk ef e) _l eh e) _m ek e) _n dC e- jo f dD     YZp e jq dE e f dF     Y Zr d S(G   u  
 A wxPython backend for matplotlib, based (very heavily) on
 backend_template.py and backend_gtk.py

 Author: Jeremy O'Donoghue (jeremy@o-donoghue.com)

 Derived from original copyright work by John Hunter
 (jdhunter@ace.bsd.uchicago.edu)

 Copyright (C) Jeremy O'Donoghue & John Hunter, 2003-4

 License: This work is licensed under a PSF compatible license. A copy
 should be included with this source code.

i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   xrange(   t   _Backendt   FigureCanvasBaset   FigureManagerBaset   GraphicsContextBaset   NavigationToolbar2t   RendererBaset	   TimerBaset   cursors(   t   _has_pil(   t   Gcf(   t   is_writable_file_liket   warn_deprecated(   t   Figure(   t   Path(   t   Affine2D(   t   SubplotTool(   t   cbookt   rcParamst   backend_toolsi   (   t	   wx_compati   u   Low u   Med i   u   Highi   u   Errori   c         C` s7   | t  k r3 | j } t d t | |  | f  n  d  S(   Nu   %s- %s in %s(   t   _DEBUGt	   __class__t   printt   _DEBUG_lvls(   t   stringt   lvlt   ot   cls(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt	   DEBUG_MSG;   s    	c         C` s(   t  j |  | |  t   t j   d S(   uD   Code due to Thomas Heller - published in Python Cookbook (O'Reilley)N(   t	   tracebackt   print_exceptionR   t   pdbt   pm(   t   typet   valuet   tb(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   debug_on_errorF   s    t   fake_stderrc           B` s   e  Z d  Z d   Z RS(   u   
    Wx does strange things with stderr, as it makes the assumption that
    there is probably no console. This redirects stderr to the console, since
    we know that there is one!
    c         C` s   t  d |  d  S(   Nu   Stderr: %s
(   R   (   t   selft   msg(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   writeT   s    (   t   __name__t
   __module__t   __doc__R-   (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR*   M   s   iK   c      
   C` sF   t  j d | d |  d d d t  j t  j B } | j   | j   d S(   uE   
    Signal an error condition -- in a GUI, popup a error dialog
    t   parentt   messaget   captionu   Matplotlib backend_wx errort   styleN(   t   wxt   MessageDialogt   OKt   CENTREt	   ShowModalt   Destroyt   None(   R,   R1   t   dialog(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   error_msg_wxb   s    

c         C` s1   t  |  t j  s- d j t t |    }  n  |  S(   u7   msg is a return arg from a raise.  Join with new lines.u   
(   t
   isinstancet   sixt   string_typest   joint   mapt   str(   R,   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   raise_msg_to_stro   s    t   TimerWxc           B` sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   uL  
    Subclass of :class:`backend_bases.TimerBase` that uses WxTimer events.

    Attributes
    ----------
    interval : int
        The time between timer events in milliseconds. Default is 1000 ms.
    single_shot : bool
        Boolean flag indicating whether this timer should operate as single
        shot (run once and then stop). Defaults to False.
    callbacks : list
        Stores list of (func, args) tuples that will be called upon timer
        events. This list can be manipulated directly, or the functions
        `add_callback` and `remove_callback` can be used.

    c         O` s]   t  j |  | |  | |  _ t j |  j t j    |  _ |  j j t j |  j	 |  j  d  S(   N(
   R   t   __init__R1   R5   t   Timert   NewIdt   _timert   Bindt	   EVT_TIMERt	   _on_timer(   R+   R1   t   argst   kwargs(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF      s    	c         C` s   |  j  j |  j |  j  d  S(   N(   RI   t   Startt	   _intervalt   _single(   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   _timer_start   s    c         C` s   |  j  j   d  S(   N(   RI   t   Stop(   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   _timer_stop   s    c         C` s   |  j    d  S(   N(   RR   (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   _timer_set_interval   s    c         C` s   |  j  j   d  S(   N(   RI   RO   (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   _timer_set_single_shot   s    c         G` s   t  j |   d  S(   N(   R   RL   (   R+   RM   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRL      s    (	   R.   R/   R0   RF   RR   RT   RU   RV   RL   (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRE   v   s   					t
   RendererWxc           B` s   e  Z d  Z e j Z e j Z e j Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z e d    Z d d  Z d	   Z e d d
  Z d   Z d   Z d   Z d   Z RS(   u   
    The renderer handles all the drawing primitives using a graphics
    context instance that controls the colors/styles. It acts as the
    'renderer' instance used by many classes in the hierarchy.
    c         C` sy   t  d d d d d t j |   t d d |   | j   |  _ | j   |  _ | |  _ i  |  _	 | |  _
 d |  _ d S(	   u;   
        Initialise a wxWindows renderer instance.
        u   2.0R2   u   The WX backend is deprecated. It's untested and will be removed in Matplotlib 3.0. Use the WXAgg backend instead. See Matplotlib usage FAQ for more info on backends.t   alternativeu   WXAggu
   __init__()i   N(   R   R
   RF   R!   t   GetWidtht   widtht	   GetHeightt   heightt   bitmapt   fontdt   dpiR;   t   gc(   R+   R]   R_   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF      s    			c         C` s   t  S(   N(   t   True(   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   flipy   s    c         C` s   t  S(   N(   Ra   (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   offset_text_height   s    c         C` s   | r |  j  |  } n  |  j d k r6 |  j   } n	 |  j } | j } |  j | |  } | j | t j  | j	 |  \ } } }	 }
 | | |	 f S(   ul   
        get the width and height in display coords of the string s
        with FontPropertry prop
        N(
   t
   strip_mathR`   R;   t   new_gct   gfx_ctxt   get_wx_fontt   SetFontR5   t   BLACKt   GetFullTextExtent(   R+   t   st   propt   ismathR`   Rf   t   fontt   wt   ht   descentt   leading(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   get_text_width_height_descent   s    		c         C` s   |  j  |  j f S(   u4   return the canvas width and height in display coords(   RZ   R\   (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   get_canvas_width_height   s    c         C` s   | j    } | d  k	 r$ | j } n  | j } | j | k r | | _ | d  k r^ | j   q | j | d |  j | d | d | d | d  n  d  S(   Ni    i   i   i   (   t   get_clip_rectangleR;   t   boundsRf   t   _lastcliprectt	   ResetClipt   ClipR\   (   R+   R`   t
   new_boundsRf   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   handle_clip_rectangle   s    		c         C` s   |  j    } x | j |  D] \ } } | t j k rG | j |   q | t j k rf | j |   q | t j k r | j |   q | t j	 k r | j
 |   q | t j k r | j   q q W| S(   N(   t
   CreatePatht   iter_segmentsR   t   MOVETOt   MoveToPointt   LINETOt   AddLineToPointt   CURVE3t   AddQuadCurveToPointt   CURVE4t   AddCurveToPointt	   CLOSEPOLYt   CloseSubpath(   Rf   t   patht	   transformt   wxpatht   pointst   code(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   convert_path   s    c         C` s   | j    |  j |  | j } | t   j d d  j d |  j  } |  j | | |  } | d  k	 r | j	 t
 j | j |    | j |  n | j |  | j   d  S(   Ng      ?g      g        (   t   selectR{   Rf   R   t   scalet	   translateR\   R   R;   t   SetBrushR5   t   Brusht   get_wxcolourt   DrawPatht
   StrokePatht   unselect(   R+   R`   R   R   t   rgbFaceRf   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt	   draw_path
  s    
	%c         C` s   | j    } | d  k	 r0 | j \ } } } }	 n d } d } |  j } |  j }	 | j d  \ }
 } t j | |
 | j    } |  j	   } | j
   | j j | t |  t |  j |  t |  t |	   | j   d  S(   Ni    i   (   Ru   R;   Rv   RZ   R\   t   shapet   wxct   BitmapFromBuffert   tostringt   get_gcR   Rf   t
   DrawBitmapt   intR   (   R+   R`   t   xt   yt   imt   bboxt   lt   bRo   Rp   t   rowst   colsR]   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt
   draw_image  s    		
%c	         C` s<  | r |  j  |  } n  t d d |   | j   |  j |  | j }	 |  j | |  }
 | j | j    } |	 j |
 |  |  j	 | | |  \ } } } t
 |  } t
 | |  } | d k r |	 j | | |  nS t j |  } | t j |  } | t j |  } |	 j | | | | | |  | j   d  S(   Nu   draw_text()i   g        (   Rd   R!   R   R{   Rf   Rg   R   t   get_rgbRh   Rs   R   t   DrawTextt   matht   radianst   sint   cost   DrawRotatedTextR   (   R+   R`   R   R   Rk   Rl   t   angleRm   t   mtextRf   Rn   t   colorRo   Rp   t   dt   radst   xot   yo(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt	   draw_text)  s&    
	c         C` sF   t  d d |   t |  j |   |  _ |  j j   |  j j   |  j S(   uY   
        Return an instance of a GraphicsContextWx, and sets the current gc copy
        u   new_gc()i   (   R!   t   GraphicsContextWxR]   R`   R   R   (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRe   C  s
    c         C` s"   |  j  d k	 s t d   |  j  S(   u.   
        Fetch the locally cached gc.
        u   gc must be definedN(   R`   R;   t   AssertionError(   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR   M  s    c   
      C` s   t  d d |   t |  } | } | j   } |  j j |  } | d k	 rP | S|  j j | t j  } d } |  j	 | j
    }	 t j t |	 d  | |  j | j   |  j | j   t |  } | |  j | <| S(   u`   
        Return a wx font.  Cache instances in a font dictionary for
        efficiency
        u   get_wx_font()i   u    g      ?N(   R!   t   hasht   get_nameR^   t   getR;   t	   fontnamesR5   t   ROMANt   points_to_pixelst   get_size_in_pointst   FontR   t
   fontanglest	   get_stylet   fontweightst
   get_weightt   False(
   R+   Rk   Rl   t   keyt   fontpropt   fontnameRn   t
   wxFontnamet
   wxFacenamet   size(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRg   V  s$    	c         C` s   | t  d |  j d S(   uj   
        convert point measures to pixes using dpi and the pixels per
        inch of the display
        g      R@(   t   PIXELS_PER_INCHR_   (   R+   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR   y  s    N(   R.   R/   R0   R   R   R   R   RF   Rb   Rc   Rs   Rt   R{   t   staticmethodR   R;   R   R   R   R   Re   R   Rg   R   (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRW      s$   											
			#R   c           B` s   e  Z d  Z i e j d 6e j d 6e j d 6Z i e j d 6e j	 d 6e j
 d 6Z e j   Z d   Z d   Z d   Z d d	  Z d
   Z d   Z d   Z e j d  d    Z d   Z RS(   u=  
    The graphics context provides the color, line styles, etc...

    This class stores a reference to a wxMemoryDC, and a
    wxGraphicsContext that draws to it.  Creating a wxGraphicsContext
    seems to be fairly heavy, so these objects are cached based on the
    bitmap object that is passed in.

    The base GraphicsContext stores colors as a RGB tuple on the unit
    interval, e.g., (0.5, 0.0, 1.0).  wxPython uses an int interval, but
    since wxPython colour management is rather simple, I have not chosen
    to implement a separate colour manager class.
    u   buttu
   projectingu   roundu   bevelu   miterc         C` s  t  j |   t d d |   t d | d |   |  j j | d  \ } } | d  k r t j   } | j |  t j	 j
 |  } d  | _ | | f |  j | <n  | |  _ | |  _ | |  _ t j d d t j  |  _ | j |  j  t j |  _ | |  _ d  S(   Nu
   __init__()i   u   __init__() 2: %su   BLACK(   NN(   R   RF   R!   t   _cacheR   R;   R5   t   MemoryDCt   SelectObjectt   GraphicsContextt   CreateRw   R]   t   dcRf   t   Pent   SOLIDt   _pent   SetPent   _stylet   renderer(   R+   R]   R   R   Rf   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF     s"    				c         C` s2   t  j d k r. |  j j |  j  t |  _ n  d S(   uC   
        Select the current bitmap into this wxDC instance
        u   win32N(   t   syst   platformR   R   R]   Ra   t
   IsSelected(   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR     s    c         C` s2   t  j d k r. |  j j t j  t |  _ n  d S(   u?   
        Select a Null bitmasp into this wxDC instance
        u   win32N(   R   R   R   R   R5   t
   NullBitmapR   R   (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR     s    c         C` sm   t  d d |   |  j   t j |  | |  |  j j |  j |  j     |  j j	 |  j  |  j
   d S(   u   
        Set the foreground color.  fg can be a matlab format string, a
        html hex color string, an rgb unit tuple, or a float between 0
        and 1.  In the latter case, grayscale is used.
        u   set_foreground()i   N(   R!   R   R   t   set_foregroundR   t	   SetColourR   R   Rf   R   R   (   R+   t   fgt   isRGBA(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR     s    
c         C` s   t  |  } t d d |   |  j   | d k rG | d k  rG d } n  t j |  |  t |  j j |  j   } | d k r d } n  |  j	 j
 |  |  j j |  j	  |  j   d S(   u%   
        Set the line width.
        u   set_linewidth()i   i    N(   t   floatR!   R   R   t   set_linewidthR   R   R   t
   _linewidthR   t   SetWidthRf   R   R   (   R+   Ro   t   lw(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR     s    
		c         C` se   t  d d |   |  j   t j |  |  |  j j t j |  j  |  j	 j
 |  j  |  j   d S(   uQ   
        Set the capstyle as a string in ('butt', 'round', 'projecting')
        u   set_capstyle()i   N(   R!   R   R   t   set_capstyleR   t   SetCapR   t   _capdt	   _capstyleRf   R   R   (   R+   t   cs(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR     s    
c         C` se   t  d d |   |  j   t j |  |  |  j j t j |  j  |  j	 j
 |  j  |  j   d S(   uM   
        Set the join style to be one of ('miter', 'round', 'bevel')
        u   set_joinstyle()i   N(   R!   R   R   t   set_joinstyleR   t   SetJoinR   t   _joindt
   _joinstyleRf   R   R   (   R+   t   js(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR     s    
u   2.1c         C` s   t  d d |   |  j   t j |  |  y t j | |  _ Wn t k
 r] t j	 |  _ n Xt j
 d k r} |  j d  n  |  j j |  j  |  j j |  j  |  j   d S(   u1   
        Set the line style to be one of
        u   set_linestyle()i   u	   __WXMSW__N(   R!   R   R   t   set_linestyleR   t   dashd_wxR   t   KeyErrorR5   t	   LONG_DASHt   PlatformR   R   t   SetStyleRf   R   R   (   R+   t   ls(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR     s    
c      
   C` s   t  d d |   t |  d k r} | \ } } } | d 9} | d 9} | d 9} t j d t |  d t |  d t |   S| \ } } } } | d 9} | d 9} | d 9} | d 9} t j d t |  d t |  d t |  d t |   Sd	 S(
   u"   return a wx.Colour from RGB formatu   get_wx_color()i   i   i   t   redt   greent   bluet   alphaN(   R!   t   lenR5   t   ColourR   (   R+   R   t   rt   gR   t   a(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR     s"    


.



	N(   R.   R/   R0   R5   t   CAP_BUTTt   CAP_PROJECTINGt	   CAP_ROUNDR   t
   JOIN_BEVELt
   JOIN_MITERt
   JOIN_ROUNDR   t   weakreft   WeakKeyDictionaryR   RF   R   R   R;   R   R   R   R   R   t
   deprecatedR   R   (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR     s"   

							t   _FigureCanvasWxBasec           B` s  e  Z d  Z i8 d e j 6d e j 6d e j 6d e j 6d e j 6d e j	 6d e j
 6d e j 6d	 e j 6d
 e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j 6d e j  6d e j! 6d e j" 6d  e j# 6d! e j$ 6d" e j% 6d# e j& 6d$ e j' 6d% e j( 6d& e j) 6d' e j* 6d( e j+ 6d) e j, 6d* e j- 6d+ e j. 6d, e j/ 6d- e j0 6d e j1 6d e j2 6d e j3 6d e j4 6d e j5 6d e j6 6d e j7 6d e j8 6d e j9 6d e j: 6d e j; 6Z< d.   Z= d/   Z> d] d0  Z@ d1   ZA d2   ZB d3   ZC d4 d5  ZD d] d6  ZE d7   ZF d] d8 d9  ZG eH jI jJ   ZI d: eI d; <d< eI d= <d< eI d> <d? eI d@ <dA eI dB <dC eI dD <dC eI dE <dF eI dG <dH   ZK dI   ZL dJ   ZM dK   ZN dL   ZO dM   ZP eQ dN  ZR dO   ZS dP   ZT dQ   ZU dR   ZV dS   ZW dT   ZX dU   ZY dV   ZZ dW   Z[ dX   Z\ dY   Z] dZ   Z^ d[   Z_ d\   Z` RS(^   ua  
    The FigureCanvas contains the figure and does event handling.

    In the wxPython backend, it is derived from wxPanel, and (usually) lives
    inside a frame instantiated by a FigureManagerWx. The parent window
    probably implements a wx.Sizer to control the displayed control size - but
    we give a hint as to our preferred minimum size.
    u   controlu   shiftu   altu   leftu   upu   rightu   downu   escapeu   f1u   f2u   f3u   f4u   f5u   f6u   f7u   f8u   f9u   f10u   f11u   f12u   scroll_locku   breaku	   backspaceu   enteru   insertu   deleteu   homeu   endu   pageupu   pagedownu   0u   1u   2u   3u   4u   5u   6u   7u   8u   9u   +u   -u   *u   /u   decc   	      C` s  t  j |  |  | j j \ } } } } t t j |   } t t j |   } t j j |  | | d t j	 | |  d   } y t
 |  d  Wn& t k
 r t
 |  d |  |  _ n Xt |  d  s t
 |  d d    |  _ n  t j | |  |  _ t d | | f d	 |   t |  _ |  j t j |  j  |  j t j |  j  |  j t j |  j  |  j t j |  j  |  j t j |  j  |  j t j  |  j!  |  j t j" |  j#  |  j t j$ |  j%  |  j t j& |  j'  |  j t j( |  j)  |  j t j* |  j+  |  j t j, |  j-  |  j t j. |  j/  |  j t j0 |  j1  |  j t j2 |  j3  |  j t j4 |  j5  |  j t j6 |  j7  |  j t j8 |  j9  |  j t j: |  j9  |  j; t j<  |  j= t j>  i  |  _? d
 S(   u   
        Initialise a FigureWx instance.

        - Initialise the FigureCanvasBase and wxPanel parents.
        - Set event handlers for:
          EVT_SIZE  (Resize event)
          EVT_PAINT (Paint event)
        R   c          _` s   t  j d t j  d  S(   Nu   could not find a setinitialsize function for backend_wx; please report your wxpython version=%s to the matplotlib developers list(   t   warningst   warnR   t   backend_version(   RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt
   do_nothing}  s    u   SetInitialSizeu   SetBestFittingSizeu   IsShownOnScreenu	   IsVisiblec          W` s   t  S(   N(   Ra   (   RM   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   <lambda>  s    u   __init__() - bitmap w:%d h:%di   N(@   R   RF   R   Rv   R   R   t   ceilR5   t   Panelt   Sizet   getattrt   AttributeErrort   SetInitialSizet   hasattrt   IsShownOnScreenR   t   EmptyBitmapR]   R!   R   t   _isDrawnRJ   t   EVT_SIZEt   _onSizet	   EVT_PAINTt   _onPaintt   EVT_KEY_DOWNt
   _onKeyDownt
   EVT_KEY_UPt   _onKeyUpt   EVT_RIGHT_DOWNt   _onRightButtonDownt   EVT_RIGHT_DCLICKt   _onRightButtonDClickt   EVT_RIGHT_UPt   _onRightButtonUpt   EVT_MOUSEWHEELt   _onMouseWheelt   EVT_LEFT_DOWNt   _onLeftButtonDownt   EVT_LEFT_DCLICKt   _onLeftButtonDClickt   EVT_LEFT_UPt   _onLeftButtonUpt
   EVT_MOTIONt	   _onMotiont   EVT_LEAVE_WINDOWt   _onLeavet   EVT_ENTER_WINDOWt   _onEntert   EVT_MIDDLE_DOWNt   _onMiddleButtonDownt   EVT_MIDDLE_DCLICKt   _onMiddleButtonDClickt   EVT_MIDDLE_UPt   _onMiddleButtonUpt   EVT_MOUSE_CAPTURE_CHANGEDt   _onCaptureLostt   EVT_MOUSE_CAPTURE_LOSTt   SetBackgroundStylet   BG_STYLE_PAINTt   SetBackgroundColourt   WHITEt   macros(	   R+   R1   t   idt   figureR   R   Ro   Rp   R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF   j  sN    
(					c         O` s   t  j j |  | |  d  S(   N(   R5   R  R:   (   R+   RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR:     s    c         C` st   t  j   } | j |  j  t  j j   sp t  j j   } | rp t  j j |  t  j j   t  j j	   qp n  d S(   u)   copy bitmap of canvas to system clipboardN(
   R5   t   BitmapDataObjectt	   SetBitmapR]   t   TheClipboardt   IsOpenedt   Opent   SetDatat   Closet   Flush(   R+   t   eventt   bmp_objt   open_success(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   Copy_to_Clipboard  s    c         C` s-   t  d d |   t |  _ |  j d t  d S(   u8   
        Delay rendering until the GUI is idle.
        u   draw_idle()i   t   eraseBackgroundN(   R!   R   R  t   Refresh(   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt	   draw_idle  s    	c         O` s   t  |  | |  S(   u
  
        Creates a new backend-specific subclass of
        :class:`backend_bases.Timer`. This is useful for getting periodic
        events through the backend's native event loop. Implemented only
        for backends with GUIs.

        Other Parameters
        ----------------
        interval : scalar
            Timer interval in milliseconds
        callbacks : list
            Sequence of (func, args, kwargs) where ``func(*args, **kwargs)``
            will be executed by the timer every *interval*.

        (   RE   (   R+   RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt	   new_timer  s    c         C` s   t  j   d  S(   N(   R5   t   Yield(   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   flush_events  s    i    c         C` s   t  |  d  r t d   n  t j   } t j |  d | } | d k r | j | d d t |  j t j |  j	 d | n  t
 j   |  _ |  j j   | j   d S(   u  
        Start an event loop.  This is used to start a blocking event
        loop so that interactive functions, such as ginput and
        waitforbuttonpress, can wait for events.  This should not be
        confused with the main GUI event loop, which is always running
        and has nothing to do with this.

        This call blocks until a callback function triggers
        stop_event_loop() or *timeout* is reached.  If *timeout* is
        <=0, never timeout.

        Raises RuntimeError if event loop is already running.
        u   _event_loopu   Event loop already runningRE  i    i  t   oneShotN(   R  t   RuntimeErrorR5   RH   RG   RO   Ra   RJ   RK   t   stop_event_loopR   t	   EventLoopt   _event_loopt   RunRS   (   R+   t   timeoutRE  t   timer(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   start_event_loop  s    c         C` s;   t  |  d  r7 |  j j   r. |  j j   n  |  ` n  d S(   u   
        Stop an event loop.  This is used to stop a blocking event
        loop so that interactive functions, such as ginput and
        waitforbuttonpress, can wait for events.

        u   _event_loopN(   R  R]  t	   IsRunningt   Exit(   R+   RO  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR[    s    c         C` s   |  j    } |  j   } t | j    } g  } g  } d } x t |  D]~ \ } \ } }	 d j g  |	 D] }
 d |
 ^ qh  } | j |	 d  d | | | f } | |	 k r | } n  | j |  qI Wd j |  } | | | f S(   u2   return the wildcard string for the filesave dialogi    u   ;u   *.%su
   %s (%s)|%su   |(   t   get_default_filetypet   get_supported_filetypes_groupedt   sortedt   itemst	   enumerateRA   t   append(   R+   t   default_filetypet	   filetypest   sorted_filetypest	   wildcardst
   extensionst   filter_indext   it   namet   extst   extt   ext_listt   wildcard(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   _get_imagesave_wildcards  s    &	u   WXc         C` s   t  d d |   |  j   r | s4 t j |   } n  t j d k r | d k r |  j j   } | j   } | j | d d  q | j |  j d d  n  d S(   u   
        Performs update of the displayed image on the GUI canvas, using the
        supplied wx.PaintDC device context.

        The 'WXAgg' backend sets origin accordingly.
        u   gui_repaint()i   u	   __WXMSW__u   WXi    N(	   R!   R  R5   t   ClientDCR   R]   t   ConvertToImaget   ConvertToBitmapR   (   R+   t   drawDCt   origint   imgt   bmp(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   gui_repaint  s    u   Windows bitmapu   bmpu   JPEGu   jpegu   jpgu   PCXu   pcxu   Portable Network Graphicsu   pngu   Tagged Image Format Fileu   tifu   tiffu   X pixmapu   xpmc         O` s6   t  t |   j | | |  |  j r2 |  j   n  d  S(   N(   t   superR  t   print_figureR  t   draw(   R+   t   filenameRM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  :  s    	c         C` sY   t  d d |   t j |   } |  j s; |  j d |  n |  j d |  | j   d S(   u5   
        Called when wxPaintEvt is generated
        u
   _onPaint()i   Rz  N(   R!   R5   t   PaintDCR  R  R~  R:   (   R+   t   evtRz  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  C  s    	c         C` se  t  d d |   |  j   j   } | r: | j |   } n  | rp | rp | j rp | j t j @rp |  j   } n |  j	   } t
 |  d d  r | |  j |  j f k r d Sn  | \ |  _ |  _ t j |  j |  j  |  _ t |  _ |  j d k s|  j d k rd S|  j j } |  j | } |  j | } |  j j | | d t |  j d t  t j |   d S(   u   
        Called when wxEventSize is generated.

        In this application we attempt to resize to fit the window, so it
        is better to take the performance hit and redraw the whole window.
        u	   _onSize()i   u   _widthNi   t   forwardRS  (   R!   t	   GetParentt   GetSizert   GetItemt
   Proportiont   FlagR5   t   EXPANDt
   GetMinSizet   GetClientSizeR  R;   t   _widtht   _heightR   R  R]   R   R  RF  R_   t   set_size_inchesRT  R   t   resize_event(   R+   R  t   szt   siR   t   dpivalt   wincht   hinch(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  P  s*    '	c         C` s   | j  } | |  j k r( |  j | } n< | d k  r^ t |  } | j   sd | j   } qd n d  } xJ | j d g | j d g f D]* \ } } |   r d j | |  } q q W| S(   Ni   u   altu   ctrlu   {0}+{1}(	   t   KeyCodet   keyvaldt   chrt	   ShiftDownt   lowerR;   t   AltDownt   ControlDownt   format(   R+   R  t   keyvalR   t   metht   prefix(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   _get_keyz  s    		c         C` s<   |  j  |  } t j |  | d | |  r8 | j   n  d S(   u   Capture key press.t   guiEventN(   R  R   t   key_press_eventt   Skip(   R+   R  R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR     s    c         C` s<   |  j  |  } t j |  | d | |  r8 | j   n  d S(   u   Release key.R  N(   R  R   t   key_release_eventR  (   R+   R  R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR"    s    c         C` s0   |  j    r |  j   n  | r, |  j   n  d S(   u   control wx mouse capture N(   t
   HasCapturet   ReleaseMouset   CaptureMouse(   R+   t   capture(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   _set_capture  s    c         C` s   |  j  t  d S(   u   Capture changed or lostN(   R  R   (   R+   R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR>    s    c         C` s\   | j    } |  j j j | j   } | j   |  j t  t j	 |  | | d d | d S(   u   Start measuring on an axis.i   R  N(
   t   GetXRF  R   R\   t   GetYR  R  Ra   R   t   button_press_event(   R+   R  R   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR$    s
    
c      	   C` sb   | j    } |  j j j | j   } | j   |  j t  t j	 |  | | d d t d | d S(   u   Start measuring on an axis.i   t   dblclickR  N(
   R  RF  R   R\   R  R  R  Ra   R   R  (   R+   R  R   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR&    s    
c         C` s\   | j    } |  j j j | j   } | j   |  j t  t j	 |  | | d d | d S(   u   End measuring on an axis.i   R  N(
   R  RF  R   R\   R  R  R  R   R   t   button_release_event(   R+   R  R   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR(    s
    
c         C` s\   | j    } |  j j j | j   } | j   |  j t  t j	 |  | | d d | d S(   u   Start measuring on an axis.i   R  N(
   R  RF  R   R\   R  R  R  Ra   R   R  (   R+   R  R   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR,    s
    
c      	   C` sb   | j    } |  j j j | j   } | j   |  j t  t j	 |  | | d d t d | d S(   u   Start measuring on an axis.i   R  R  N(
   R  RF  R   R\   R  R  R  Ra   R   R  (   R+   R  R   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR.    s    
c         C` s\   | j    } |  j j j | j   } | j   |  j t  t j	 |  | | d d | d S(   u   End measuring on an axis.i   R  N(
   R  RF  R   R\   R  R  R  R   R   R  (   R+   R  R   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR0    s
    
c         C` s\   | j    } |  j j j | j   } | j   |  j t  t j	 |  | | d d | d S(   u   Start measuring on an axis.i   R  N(
   R  RF  R   R\   R  R  R  Ra   R   R  (   R+   R  R   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR8    s
    
c      	   C` sb   | j    } |  j j j | j   } | j   |  j t  t j	 |  | | d d t d | d S(   u   Start measuring on an axis.i   R  R  N(
   R  RF  R   R\   R  R  R  Ra   R   R  (   R+   R  R   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR:    s    
c         C` s\   | j    } |  j j j | j   } | j   |  j t  t j	 |  | | d d | d S(   u   End measuring on an axis.i   R  N(
   R  RF  R   R\   R  R  R  R   R   R  (   R+   R  R   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR<    s
    
c         C` s   | j    } |  j j j | j   } | j   } | j   } | j   } | | | } | j   t	 j
 d k r t |  d  s t |  _ q |  j r t |  _ d St |  _ n  t j |  | | | d | d S(   u3   Translate mouse wheel events into matplotlib eventsu	   __WXMAC__u   _skipwheeleventNR  (   R  RF  R   R\   R  t   GetWheelDeltat   GetWheelRotationt   GetLinesPerActionR  R5   R   R  Ra   t   _skipwheeleventR   R   t   scroll_event(   R+   R  R   R   t   deltat   rotationt   ratet   step(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR*    s    
		c         C` sL   | j    } |  j j j | j   } | j   t j |  | | d | d S(   u   Start measuring on an axis.R  N(   R  RF  R   R\   R  R  R   t   motion_notify_event(   R+   R  R   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR2    s    
c         C` s!   | j    t j |  d | d S(   u   Mouse has left the window.R  N(   R  R   t   leave_notify_event(   R+   R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR4    s    
c         C` s   t  j |  d | d S(   u   Mouse has entered the window.R  N(   R   t   enter_notify_event(   R+   R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR6  !  s    N(a   R.   R/   R0   R5   t   WXK_CONTROLt	   WXK_SHIFTt   WXK_ALTt   WXK_LEFTt   WXK_UPt	   WXK_RIGHTt   WXK_DOWNt
   WXK_ESCAPEt   WXK_F1t   WXK_F2t   WXK_F3t   WXK_F4t   WXK_F5t   WXK_F6t   WXK_F7t   WXK_F8t   WXK_F9t   WXK_F10t   WXK_F11t   WXK_F12t
   WXK_SCROLLt	   WXK_PAUSEt   WXK_BACKt
   WXK_RETURNt
   WXK_INSERTt
   WXK_DELETEt   WXK_HOMEt   WXK_ENDt
   WXK_PAGEUPt   WXK_PAGEDOWNt   WXK_NUMPAD0t   WXK_NUMPAD1t   WXK_NUMPAD2t   WXK_NUMPAD3t   WXK_NUMPAD4t   WXK_NUMPAD5t   WXK_NUMPAD6t   WXK_NUMPAD7t   WXK_NUMPAD8t   WXK_NUMPAD9t   WXK_NUMPAD_ADDt   WXK_NUMPAD_SUBTRACTt   WXK_NUMPAD_MULTIPLYt   WXK_NUMPAD_DIVIDEt   WXK_NUMPAD_DECIMALt   WXK_NUMPAD_ENTERt   WXK_NUMPAD_UPt   WXK_NUMPAD_RIGHTt   WXK_NUMPAD_DOWNt   WXK_NUMPAD_LEFTt   WXK_NUMPAD_PAGEUPt   WXK_NUMPAD_PAGEDOWNt   WXK_NUMPAD_HOMEt   WXK_NUMPAD_ENDt   WXK_NUMPAD_INSERTt   WXK_NUMPAD_DELETER  RF   R:   R;   RR  RU  RV  RX  Ra  R[  Rv  R~  R   Rk  t   copyR  R  R  R  R   R"  Ra   R  R>  R$  R&  R(  R,  R.  R0  R8  R:  R<  R*  R2  R4  R6  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  %  s   






















































	G					







				*																				t   FigureCanvasWxc           B` sq   e  Z d d   Z d   Z e s3 d   Z e Z n  d   Z d   Z	 e s] d   Z
 e
 Z n  d   Z d   Z RS(	   c         C` s[   t  d d |   t |  j |  j j  |  _ |  j j |  j  t |  _ |  j	 d |  d S(   u   
        Render the figure using RendererWx instance renderer, or using a
        previously defined renderer if none is specified.
        u   draw()i   Rz  N(
   R!   RW   R]   RF  R_   R   R  Ra   R  R~  (   R+   Rz  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  )  s
    	c         O` s   |  j  | t j | |  S(   N(   t   _print_imageR5   t   BITMAP_TYPE_BMP(   R+   R  RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt	   print_bmp4  s    c         O` s   |  j  | t j | |  S(   N(   R  R5   t   BITMAP_TYPE_JPEG(   R+   R  RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt
   print_jpeg8  s    c         O` s   |  j  | t j | |  S(   N(   R  R5   t   BITMAP_TYPE_PCX(   R+   R  RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt	   print_pcx=  s    c         O` s   |  j  | t j | |  S(   N(   R  R5   t   BITMAP_TYPE_PNG(   R+   R  RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt	   print_png@  s    c         O` s   |  j  | t j | |  S(   N(   R  R5   t   BITMAP_TYPE_TIF(   R+   R  RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt
   print_tiffD  s    c         O` s   |  j  | t j | |  S(   N(   R  R5   t   BITMAP_TYPE_XPM(   R+   R  RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt	   print_xpmI  s    c         O` s  |  j  } |  j j j \ } } } }	 t t j |   } t t j |	   }	 t j | |	  |  _  t	 |  j  |  j j
  }
 |
 j   } |  j j |
  |  j  } | t j k r | j d t d  } |  j  j   } | j t j t |   n  t | t j  r:| j | |  st d d |   t d |   qne t |  rt | t j  sg| j   } n  | j | |  st d d |   t d |   qn  | |  _  |  j r|  j   n  |  j   d  S(   Nu   qualityu   savefig.jpeg_qualityu   print_figure() file save errori   u   Could not save figure to %s
(    R]   RF  R   Rv   R   R   R  R   R  RW   R_   Re   R  R5   R  R   R   Rx  t	   SetOptiont   IMAGE_OPTION_QUALITYRC   R>   R?   R@   t   SaveFileR!   RZ  R   t   Imaget
   SaveStreamR  RT  (   R+   R  t   filetypeRM   RN   t
   origBitmapR   R   RZ   R\   R   R`   t   imaget   jpeg_quality(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  L  s@    					N(   R.   R/   R;   R  R  R   R  t	   print_jpgR  R  R  t	   print_tifR  R  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  &  s   								t   FigureFrameWxc           B` sG   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C` sU  t  j d k r t  j } n t  j d d  } | j j \ } } } } t  j j |  d d  d d d | d d | t	 d	 d
 |   | |  _
 t |   } |  j |  |  j |  |  _ |  j j t  j | j j | j j   |  j j   t  j t  j  |  _ |  j j |  j d
 t  j t  j Bt  j B |  j |  |  _ |  j d  k	 r|  j j   t j r|  j j    \ }	 }
 |  j j    \ } } n* |  j j!   \ }	 }
 |  j j!   \ } } |  j j" t  j | |
   |  j j |  j d t  j t  j B n  |  j# |  j  |  j$   |  j j% d  t& |  j | |   |  _' |  j( t  j) |  j*  d  S(   Nu	   __WXMSW__i   R1   RE  it   post   titleu	   Figure %du
   __init__()i   i    i   (   i   i   (+   R5   R   t   DefaultPositiont   PointR   Rv   t   FrameRF   R;   R!   t   numt   StatusBarWxt   SetStatusBart
   get_canvast   canvasR  R  RZ   R\   t   SetFocust   BoxSizert   VERTICALt   sizert   Addt   TOPt   LEFTR  t   _get_toolbart   toolbart   RealizeR   t
   is_phoenixt   GetSizet   GetSizeTuplet   SetSizet   SetSizert   Fitt
   SetMinSizet   FigureManagerWxt   figmgrRJ   t	   EVT_CLOSEt   _onClose(   R+   R  t   figR  R   R   Ro   Rp   t   statbart   twt   tht   fwt   fh(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF     s<    !	(*	&
c         C` s9   t  d d k r/ t |  j  } | j |  n d  } | S(   Nu   toolbaru   toolbar2(   R   t   NavigationToolbar2WxR  t   set_status_barR;   (   R+   R0  R"  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR!    s
    c         C` s   t  |  d |  S(   Ni(   R  (   R+   R/  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s    c         C` s   t  d d |   |  j S(   Nu   get_figure_manager()i   (   R!   R,  (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   get_figure_manager  s    c         C` s>   t  d d |   |  j j   |  j j   t j |  j  d  S(   Nu	   onClose()i   (   R!   R  t   close_eventR[  R   t   destroyR  (   R+   R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR.    s    c         C` s   |  j  S(   u=   Override wxFrame::GetToolBar as we don't have managed toolbar(   R"  (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt
   GetToolBar  s    c         O` s   y |  j  j |  j j  Wn t k
 r- n X|  j   s t j j |  | |  |  j d  k	 ro |  j j   n  t j
   } | r | j   q n  t S(   N(   R  t   mpl_disconnectR"  t   _idDragR  t   IsBeingDeletedR5   R  R:   R;   t   GetAppRW  Ra   (   R+   RM   RN   t   wxapp(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR:     s    (	   R.   R/   RF   R!  R  R7  R.  R:  R:   (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s   	:					R+  c           B` sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   u  
    This class contains the FigureCanvas and GUI frame

    It is instantiated by GcfWx whenever a new figure is created. GcfWx is
    responsible for managing multiple instances of FigureManagerWx.

    Attributes
    ----------
    canvas : `FigureCanvas`
        a FigureCanvasWx(wx.Panel) instance
    window : wxFrame
        a wxFrame instance - wxpython.org/Phoenix/docs/html/Frame.html

    c         ` sv   t  d d    t j   | |  |   _ |   _ | j     _   j   _   f d   }   j j	 j
 |  d  S(   Nu
   __init__()i   c         ` s#     j  d k	 r   j  j   n  d S(   u8   this will be called whenever the current axes is changedN(   R(   R;   t   update(   R/  (   R+   (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   notify_axes_change  s    (   R!   R   RF   t   framet   windowR:  R(   R"  R  RF  t   add_axobserver(   R+   R  R  RB  RA  (    (   R+   s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF     s    		c         C` s   |  j  j   |  j j   d  S(   N(   RB  t   ShowR  R  (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   show  s    c         G` s@   t  d d |   |  j j   t j   } | r< | j   n  d  S(   Nu	   destroy()i   (   R!   RB  R:   R5   R>  RW  (   R+   RM   R?  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR9    s
    c         C` s   |  j  j   S(   N(   RC  t   GetTitle(   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   get_window_title  s    c         C` s   |  j  j |  d  S(   N(   RC  t   SetTitle(   R+   R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   set_window_title  s    c         C` s9   |  j  j t j | |   |  j j   j |  j  d S(   u   Set the canvas size in pixelsN(   R  R  R5   R  RC  R  R)  (   R+   RZ   R\   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   resize"  s    (	   R.   R/   R0   RF   RF  R9  RH  RJ  RK  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR+    s   					c         C` sr   t  j j t d d  } t  j j t  j j | |    } t  j j |  s_ t d |   n  t j |  } | S(   u   
    Load a bitmap file from the backends/images subdirectory in which the
    matplotlib library is installed. The filename parameter should not
    contain any path information as this is determined automatically.

    Returns a wx.Bitmap object
    u   datapathu   imagesu&   Could not find bitmap file "%s"; dying(	   t   osR   RA   R   t   normpatht   existst   IOErrorR5   t   Bitmap(   R  t   basedirt   bmpFilenameR}  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   _load_bitmap<  s    	!t   MenuButtonWxc           B` s_   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   u   
    wxPython does not permit a menu to be incorporated directly into a toolbar.
    This class simulates the effect by associating a pop-up menu with a button
    in the toolbar, and managing this as though it were a menu.
    c         C` s  t  j j |  | t d d t  j | |  _ t  j   |  _ g  |  _ t  j	   |  _
 t  j	   |  _ |  j j |  j
 d d t  |  j j |  j d d t  |  j j   |  j t  j |  j d t |  j t  j |  j d |  j
 |  j t  j |  j d |  j d  S(   Nu   Axes:        R4   u   Allu   Select all axesu   Invertu   Invert axes selectedRE  (   R5   t   ButtonRF   t   _NTB_AXISMENU_BUTTONt   BU_EXACTFITt   _toolbart   Menut   _menut   _axisIdRH   t   _allIdt	   _invertIdt   AppendR   t   AppendSeparatorRJ   t
   EVT_BUTTONt   _onMenuButtont   EVT_MENUt   _handleSelectAllAxest   _handleInvertAxesSelected(   R+   R1   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF   V  s    
		c         C` s   |  j  j   |  j   d  S(   N(   RZ  R:   (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR:   j  s    c         C` s   t  j r0 |  j   \ } } |  j   \ } } n$ |  j   \ } } |  j   \ } } |  j |  j | | | d  | j   d S(   u   Handle menu button pressed.i   N(	   R   R$  t   GetPositionR%  t   GetPositionTupleR&  t   PopupMenuXYRZ  R  (   R+   R  R   R   Ro   Rp   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRa  n  s    	c         C` sw   t  |  j  d k r d Sx7 t t  |  j   D]  } |  j j |  j | t  q/ W|  j j |  j    | j	   d S(   u8   Called when the 'select all axes' menu item is selected.i    N(
   R   R[  t   rangeRZ  t   CheckRa   RX  t
   set_activet   getActiveAxesR  (   R+   R  Rp  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRc  z  s    c         C` s   t  |  j  d k r d Sxm t t  |  j   D]V } |  j j |  j |  rk |  j j |  j | t  q/ |  j j |  j | t  q/ W|  j j	 |  j
    | j   d S(   u0   Called when the invert all menu item is selectedi    N(   R   R[  Rh  RZ  t	   IsCheckedRi  R   Ra   RX  Rj  Rk  R  (   R+   R  Rp  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRd    s    c         C` sj   |  j  j | j    } | r' t } n t } |  j  j | j   |  |  j j |  j    | j	   d S(   u?   Called whenever one of the specific axis menu items is selectedN(
   RZ  Rl  t   GetIdR   Ra   Ri  RX  Rj  Rk  R  (   R+   R  t   currentt   new(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   _onMenuItemSelected  s    	c         C` s"  | t  |  j  k r x t t  |  j  d | d d  D]r } t j   } |  j j |  |  j j | d | d | t  |  j j	 | t  |  j
 t j |  j d | q9 WnP | t  |  j  k  rx% |  j | D] } |  j j |  q W|  j |  |  _ n  |  j j t t |    d S(   u[   Ensures that there are entries for max_axis axes in the menu
        (selected by default).i   u   Axis %du   Select axis %dRE  N(   R   R[  Rh  R5   RH   Ri  RZ  R^  Ra   Ri  RJ   Rb  Rp  t   DeleteRX  Rj  t   listR   (   R+   t   maxAxisRp  t   menuId(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt
   updateAxes  s    *#c         C` sS   g  } xF t  t |  j   D]/ } |  j j |  j |  r | j |  q q W| S(   u#   Return a list of the selected axes.(   Rh  R   R[  RZ  Rl  Ri  (   R+   t   activeRp  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRk    s
    c         C` s(   |  j  d d j d   | D   d S(   u4   Update the list of selected axes in the menu button.u   Axes: u   ,c         s` s   |  ] } d  | d Vq d S(   u   %di   N(    (   t   .0t   e(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pys	   <genexpr>  s    N(   t   SetLabelRA   (   R+   t   lst(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   updateButtonText  s    (   R.   R/   R0   RF   R:   Ra  Rc  Rd  Rp  Ru  Rk  R{  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRT  O  s   									u   2.2t   SubplotToolWXc           B` s   e  Z d    Z RS(   c         C` s   t  j j |  d  d d  t d  } t |  d |  } t | d |   } t  j t  j  } | j	 | d t  j
 t  j Bt  j B |  j |  |  j   t | |  } d  S(   Niu   Configure subplotsi   i   i   (   i   i   (   R5   R  RF   R;   R   R  t   FigureManagerR  R  R  R   R  t   GROWR(  R)  R   (   R+   t	   targetfigt   toolfigR  R,  R  t   tool(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF     s    $
(   R.   R/   RF   (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR|    s   R5  c           B` s   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 e
 j d d	 d
 d    Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C` sf   t  j j |  | j   d  t j |  |  | |  _ t |  _ d  |  _	 d  |  _
 d t  j k |  _ d  S(   Niu   wxMac(   R5   t   ToolBarRF   R  R	   R  Ra   t   _idleR;   R0  t   prevZoomRectt   PlatformInfot	   retinaFix(   R+   R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF     s    				c         C` s   t  |  j  | d |  S(   Ni(   R&   R  (   R+   RB  R/  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s    c         C` s   t  d d |   |  j j   |  _ i  |  _ x |  j D] \ } } } } | d  k rc |  j   q5 n  t j	   |  j | <t
 j |  |  j | t | d  |  |  j t j t |  |  d |  j | q5 W|  j   d  S(   Nu   _init_toolbari   u   .pngRE  (   R!   R  R  t   _parentt   wx_idst	   toolitemsR;   t   AddSeparatorR5   RH   R   t   _AddToolRS  RJ   t   EVT_TOOLR  R#  (   R+   t   textt   tooltip_textt
   image_filet   callback(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   _init_toolbar  s    	
c         G` s+   |  j  |  j d t  t j |  |  d  S(   Nu   Pan(   t
   ToggleToolR  R   R	   t   zoom(   R+   RM   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s    c         G` s+   |  j  |  j d t  t j |  |  d  S(   Nu   Zoom(   R  R  R   R	   t   pan(   R+   RM   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s    c         C` s   t  j d  d d  } t d  } |  j | |  } t | d |  } t  j t  j  } | j | d t  j	 t  j
 Bt  j B | j |  | j   t |  j j |  } | j   d  S(   Niu   Configure subplotsi   i   i   (   i   i   (   R5   R  R;   R   R  R}  R  R  R  R   R  R~  R(  R)  R   R  RF  RE  (   R+   R  RB  R  R  R,  R  R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   configure_subplots  s    $
c         G` s  |  j  j   \ } } } |  j  j   } t j |  j d d | | t j t j B } | j |  | j	   t j
 k r| j   } | j   } t d | | f d |   | | j   }	 t j j |  \ }
 } | j d  r | d } n  | d k r+|	 | k r+t j d | |	 | f d d | }	 n  y, |  j  j j t j j | |  d |	 Wqt k
 r|} t t |   qXn  d  S(   Nu   Save to fileu    u   Save file dir:%s name:%si   u   .i   u   svgu   pdfu   psu   epsu   pnguD   extension %s did not match the selected image type %s; going with %st
   stackleveli    R  (   u   svgu   pdfu   psu   epsu   png(   R  Rv  t   get_default_filenameR5   t
   FileDialogR  t   FD_SAVEt   FD_OVERWRITE_PROMPTt   SetFilterIndexR9   t   ID_OKt   GetDirectoryt   GetFilenameR!   t   GetFilterIndexRL  R   t   splitextt
   startswithR  R  RF  t   savefigRA   t	   ExceptionR=   RC   (   R+   RM   Rk  Rr  Ro  t   default_filet   dlgt   dirnameR  R  t   basenameRs  Rx  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   save_figure  s4    	 c         C` s4   t  j t |  } |  j j |  |  j j   d  S(   N(   R   t   Cursort   cursordR  t	   SetCursort   Update(   R+   t   cursor(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt
   set_cursor8  s    u   2.1RX   u   canvas.draw_idlec         C` s5   |  j  } t |  _  | r1 |  j j   t |  _  n  d  S(   N(   R  R   R  R  Ra   (   R+   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   dynamic_update=  s
    		c         C` s   |  j  d k r~ |  j s* t j   |  _ q~ | j d  k	 r~ |  j j | j j	  |  _
 | j |  _ | j |  _ | j |  _ q~ n  d  S(   Nu   ZOOM(   t   _activeR  R5   t   Overlayt	   wxoverlayt   inaxesR;   R  t   copy_from_bboxR   t   savedRetinaImaget   xdatat
   zoomStartXt   ydatat
   zoomStartYt   zoomAxes(   R+   RO  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   pressE  s    		c         C` s{   |  j  d k rw |  j s. |  j j   |  ` qw |  ` |  j r_ |  j j d  j   d  |  _ n  |  j	 rw d  |  _	 qw n  d  S(   Nu   ZOOMi    (
   R  R  R  t   ResetR  R  t   popt   removeR;   R  (   R+   RO  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   releaseQ  s    				c         C` sa  |  j  r d } |  j r1 |  j j d  j   n  |  j j |  j  |  j | j } } |  j	 | j
 }	 }
 | | | | | f } |	 |
 |
 |	 |	 f } |  j j | | d d | |  _ |  j j |  j d  |  j j |  j j  d  St j |  j  } t j |  j |  } | j   d t j k r8t j |  } n  |  j j j j } | | } | | } | | k  rz| | } } n  | | k  r| | } } n  | | } | | } t j | | | |  } d } t j |  } | j t j | d   | j t  \ } } } } | j  | | | d  | j! t j" |   t j# rP| j$ |  n | j% |  d  S(   Nu   #C0C0FFi    u   -R   u   wxMaci   i`   (&   R  R  R  R  R  t   restore_regionR  R  R  R  R  R  t   plott   draw_artistt   blitR   R5   Rw  t	   DCOverlayR  t   ClearR  t   GCDCRF  R\   t   RectR   t   NamedColourR   R   t   GetRa   t   SetR   R   R$  t   DrawRectanglet   DrawRectangleRect(   R+   RO  t   x0t   y0t   x1t   y1t   rubberBandColort   X0t   X1t   Y0t   Y1t   lineXt   lineYR   t   odcR\   Ro   Rp   t   rectR   R   R   R   R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   draw_rubberband`  sL    			




	c         C` s   | |  _  d  S(   N(   R0  (   R+   R0  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR6    s    c         C` s&   |  j  d  k	 r" |  j  j |  n  d  S(   N(   R0  R;   t   set_function(   R+   Rk   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   set_message  s    c         C` sf   |  j  j d k } |  j  j t |  j  j  d k  } |  j |  j d |  |  j |  j d |  d  S(   Ni    i   u   Backu   Forward(   t
   _nav_stackt   _posR   t	   _elementst
   EnableToolR  (   R+   t   can_backwardt   can_forward(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   set_history_buttons  s    "(   R.   R/   RF   R  R  R  R  R  R  R  R   R
  R  R  R  R  R6  R  R  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR5    s   							 				9		RX   u   NavigationToolbar2Wxt   Toolbarc           B` s   e  Z RS(    (   R.   R/   (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s   R  c           B` s    e  Z d  Z d   Z d   Z RS(   u   
    A status bar is added to _FigureFrame to allow measurements and the
    previously selected scroll function to be displayed as a user
    convenience.
    c         C` s7   t  j j |  | d  |  j d  |  j d d  d  S(   Nii   u   Nonei   (   R5   t	   StatusBarRF   t   SetFieldsCountt   SetStatusText(   R+   R1   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF     s    c         C` s   |  j  d | d  d  S(   Nu   %si   (   R  (   R+   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s    (   R.   R/   R0   RF   R  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s   	t   SaveFigureWxc           B` s   e  Z d    Z RS(   c         G` s  |  j  j   \ } } } t j j t j d  } |  j  j   } t j	 |  j  j
   d | | | t j t j B } | j |  | j   t j k r d  S| j   } | j   }	 t d | |	 f d |   | | j   }
 t j j |	  \ } } | j d  r| d } n  | d k rN|
 | k rNt j d | |
 | f d d | }
 n  | d k rj| t j d <n  y, |  j  j j t j j | |	  d |
 Wn# t k
 r} t t |   n Xd  S(   Nu   savefig.directoryu   Save to fileu   Save file dir:%s name:%si   u   .i   u   svgu   pdfu   psu   epsu   pnguD   extension %s did not match the selected image type %s; going with %sR  i    u    R  (   u   svgu   pdfu   psu   epsu   png(   R  Rv  RL  R   t
   expandusert
   matplotlibR   R  R5   R  t   GetTopLevelParentR  R  R  R9   R  R  R  R!   R  R  R  R  R  RF  R  RA   R  R=   RC   (   R+   RM   Rk  Rr  Ro  t   default_dirR  R  R  R  R  R  Rs  Rx  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   trigger  s:    			 (   R.   R/   R  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s   t   SetCursorWxc           B` s   e  Z d    Z RS(   c         C` s4   t  j t |  } |  j j |  |  j j   d  S(   N(   R   R  R  R  R  R  (   R+   R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s    (   R.   R/   R  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s   u   wxMact   RubberbandWxc           B` s#   e  Z d    Z d   Z d   Z RS(   c         O` s#   t  j j |  | |  d  |  _ d  S(   N(   R   t   RubberbandBaseRF   R;   R  (   R+   RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF     s    c         C` s  |  j  d  k r! t j   |  _  n  t j |  j  } t j |  j  |  } | j   t j |  } |  j j	 j
 j } | | } | | } | | k  r | | } } n  | | k  r | | } } n  | | } | | }	 t j | | | |	  }
 d } t j |  } | j t j | d   | j t  \ } } } } | j | | | d  | j t j |   t j ry| j |
  n | j |
  d  S(   Nu   #C0C0FFi   i`   (   R  R;   R5   R  Rw  R  R  R  R  RF  R   R\   R  R   R  R   R   R  Ra   R  R   R   R$  R  R  (   R+   R  R  R  R  R   R  R\   Ro   Rp   R  R  R   R   R   R   R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s2    




	c         C` s-   |  j  d  k r d  S|  j  j   d  |  _  d  S(   N(   R  R;   R  (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   remove_rubberband   s    (   R.   R/   RF   R  R  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s   		&c           B` s&   e  Z d    Z d   Z d d  Z RS(   c         O` s#   t  j j |  | |  d  |  _ d  S(   N(   R   R  RF   R;   t   _rect(   R+   RM   RN   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF   +  s    c         C` s   t  j |  j  } |  j r+ |  j |  n  | j t  j t  j d t  j   | j	 t  j
  | |  j j | | | | | f |  _ t j r | j |  j  n | j |  j  d  S(   Ni   (   R5   Rw  R  R  R  R   R   Ri   R   R   t   TRANSPARENT_BRUSHR  R   R$  R  R  (   R+   R  R  R  R  R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  /  s    	"(	c         C` sc   |  j  s d  S|  j j rV | d  k r: t j |  j  } n  | j |  j j d d  n  d  |  _  d  S(   Ni    (   R  R  R]   R;   R5   Rw  R   (   R+   R   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  B  s    	N(   R.   R/   RF   R  R;   R  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  *  s   		t
   PrintoutWxc           B` s;   e  Z d  Z d d d d  Z d   Z d   Z d   Z RS(   u   
    Simple wrapper around wx Printout class -- all the real work
    here is scaling the matplotlib canvas bitmap to the current
    printer's definition.
    g      @g      ?u
   matplotlibc         C` s5   t  j j |  d | | |  _ | |  _ | |  _ d  S(   NR  (   R5   t   PrintoutRF   R  RZ   t   margin(   R+   R  RZ   R  R  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyRF   ^  s    		c         C` s
   | d k S(   Ni   (    (   R+   t   page(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   HasPagee  s    c         C` s   d S(   Ni   (   i   i   i   i   (    (   R+   (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   GetPageInfoi  s    c         C` s  |  j  j   |  j   } |  j   \ } } |  j   \ } } | j   \ } } t j rp |  j  j   \ }	 }
 n |  j  j   \ }	 }
 |  j  j	 j
   } |  j  j	 j } t |  | } | |  j  j	 _ |  j  j	 j d  t |  j  j |  j  j	 j  } |  j  j	 j |  |  j  j j t |  j  j j   |   |  j  j j t |  j  j j   |   |  j  j   d } |  j   rt |  | } n  t |  j | |  } t |  j | |  } |  j | | t |	  } | j | |  | j | |  y | j |  j  j d d  Wn? t k
 rTy | j |  j  j d  WqUt k
 rPqUXn X|  j  j	 j |  | |  j  j	 _ |  j  j   t S(   Nu   #FFFFFFg      ?i    (   i    i    (   R  R  t   GetDCt   GetPPIPrintert   GetPageSizePixelsR%  R   R$  R&  RF  t   get_facecolorR_   R   t   set_facecolorRW   R]   R   R   RY   t	   SetHeightR[   t	   IsPreviewR  RZ   t   SetDeviceOrigint   SetUserScaleR   R  Ra   (   R+   R  R   t   ppwt   ppht   pgwt   pght   dcwt   dcht   grwt   grht   bgcolort   fig_dpit   vscaleR   t
   page_scalet
   top_margint   left_margint
   user_scale(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   OnPrintPagel  sN    	(   R.   R/   R0   RF   R  R  R  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR  W  s
   		t
   _BackendWxc           B` sV   e  Z e Z e Z e Z e d     Z	 e
 d    Z e
 d    Z e d    Z RS(   c         C` s   |  j  j   d  S(   N(   R  RU  (   t   manager(    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   trigger_manager_draw  s    c         O` s\   t  j   } | d  k r@ t  j t  } | j t  | t _ n  t	 t |   j
 | | |  S(   N(   R5   R>  R;   t   AppR   t   SetExitOnFrameDeleteRa   R  t	   _theWxAppR  t   new_figure_manager(   R    R  RM   RN   R?  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s    c         C` sK   |  j  | |  } | j   } t j   rG | j j   | j j   n  | S(   N(   t   _frame_classR7  R  t   is_interactiveRB  RE  R  RU  (   R    R  RF  RB  R,  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   new_figure_manager_given_figure  s    c          C` s;   t  j j   s7 t  j   }  |  d  k	 r7 |  j   q7 n  d  S(   N(   R5   R  t   IsMainLoopRunningR>  R;   t   MainLoop(   R?  (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   mainloop  s    (   R.   R/   R  t   FigureCanvasR+  R}  R  R  R   R  t   classmethodR  R  R  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyR    s   	(s   R0   t
   __future__R    R   R   R   R?   t	   six.movesR   R   RL  t   os.pathR   R  R  R  t   matplotlib.backend_basesR   R   R   R   R	   R
   R   R   R   t   matplotlib._pylab_helpersR   t   matplotlib.cbookR   R   t   matplotlib.figureR   t   matplotlib.pathR   t   matplotlib.transformsR   t   matplotlib.widgetsR   R   R   R   t    R   R   R5   R   R"   R$   R   R;   R!   R)   t   objectR*   R   t
   IDLE_DELAYR=   RD   RE   RW   R   R  R  R  R  R  R+  RH   t   _NTB_AXISMENURV  t   _NTB_X_PAN_LEFTt   _NTB_X_PAN_RIGHTt   _NTB_X_ZOOMINt   _NTB_X_ZOOMOUTt   _NTB_Y_PAN_UPt   _NTB_Y_PAN_DOWNt   _NTB_Y_ZOOMINt   _NTB_Y_ZOOMOUTt	   _NTB_SAVEt
   _NTB_CLOSERS  RU  RT  t   CURSOR_HANDt   MOVEt   HANDt   CURSOR_ARROWt   POINTERt   CURSOR_CROSSt   SELECT_REGIONt   CURSOR_WAITt   WAITR  R
  R|  R  R5  R  R  R  t   SaveFigureBaseR  t   SetCursorBaseR  R  R  R  t   ToolSaveFiguret   ToolSetCursort   ToolRubberbandR  R  t   exportR  (    (    (    s=   lib/python2.7/site-packages/matplotlib/backends/backend_wx.pyt   <module>   s   ":"		0  ge;	m&5&			W	