ó
 m[c           @` s  d  Z  d d l m Z m Z m Z m Z d d l Z d d l 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 m Z m Z m Z m Z m Z d d	 l m Z d
 e e f d     YZ e	 j d  d e f d     Y Z e j d e f d     Y Z d S(   u   
Render to qt from agg
i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   cbook(   t   Bboxi   (   t   FigureCanvasAgg(   t   QtCoret   QtGuit	   QtWidgetst   _BackendQT5t   FigureCanvasQTt   FigureManagerQTt   NavigationToolbar2QTt   backend_version(   t   QT_APIt   FigureCanvasQTAggc           B` sM   e  Z d    Z e e j d  d     Z d   Z d d  Z	 d   Z
 RS(   c         C` s&   t  t |   j d |  g  |  _ d  S(   Nt   figure(   t   superR   t   __init__t   _bbox_queue(   t   selfR   (    (    sA   lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.pyR      s    u   2.1c         C` s   |  j  S(   N(   R   (   R   (    (    sA   lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.pyt   blitbox   s    c         C` sı  |  j    r d S|  j   t |  d  s- d St j |   } |  j rQ |  j } n@ | j |  j    t d d g |  j	 j
 |  j	 j g g  g } g  |  _ x| D]ù } t t | j  \ } } } } | | }	 | | }
 |  j |  } | j   } t j | |	 |
 t j j  } t d k rEt j rEd t j j t |   _ n  t | d  rg| j |  j  n  t j | |  j	 j |  } | j | |  j |  qĦ W|  j  |  | j!   d S(   u˘   Copy the image from the Agg canvas to the qt.drawable.

        In Qt, all drawing should be done inside of here when a widget is
        shown onscreen.
        Nu   rendereri    u   PySidei   u   setDevicePixelRatio("   t   _update_dpit
   _draw_idlet   hasattrR   t   QPainterR   t	   eraseRectt   rectR   t   renderert   widtht   heightt   mapt   intt   extentst   copy_from_bboxt   to_string_argbt   QImaget   Format_ARGB32R   t   sixt   PY3t   ctypest   c_longt   from_addresst   idt   valuet   setDevicePixelRatiot
   _dpi_ratioR   t   QPointt	   drawImaget   _draw_rect_callbackt   end(   R   t   et   paintert
   bbox_queuet   bboxt   lt   bt   rt   tt   wt   ht   regt   buft   qimaget   origin(    (    sA   lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.pyt
   paintEvent    s4    
	-	

c         C` s   | d k r$ |  j r$ |  j j } n  |  j j |  g  | j D] } | |  j ^ q> \ } } } } | | } |  j | |  j j	 |  j | | |  d S(   u!   Blit the region in bbox.
        N(
   t   NoneR   R7   R   t   appendt   boundsR/   t   repaintR   R   (   R   R7   t   ptR8   R9   R<   R=   R;   (    (    sA   lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.pyt   blitN   s    /
c         O` s'   t  t |   j | |   |  j   d  S(   N(   R   R   t   print_figuret   draw(   R   t   argst   kwargs(    (    sA   lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.pyRI   ]   s    N(   t   __name__t
   __module__R   t   propertyR   t
   deprecatedR   RB   RC   RH   RI   (    (    (    sA   lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.pyR      s   		.u   2.2t   FigureCanvasQTAggBasec           B` s   e  Z RS(    (   RM   RN   (    (    (    sA   lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.pyRQ   b   s   t   _BackendQT5Aggc           B` s   e  Z e Z RS(    (   RM   RN   R   t   FigureCanvas(    (    (    sA   lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.pyRR   g   s   (   t   __doc__t
   __future__R    R   R   R   R'   R)   t
   matplotlibR   t   matplotlib.transformsR   t   backend_aggR   t   backend_qt5R   R   R	   R
   R   R   R   R   t	   qt_compatR   R   RP   RQ   t   exportRR   (    (    (    sA   lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.pyt   <module>   s   ":M	