σ
 m[c           @` s  d  Z  d d l m Z m Z m Z m Z d d l Z d d l j Z	 d d l
 Z
 d d l Z d d l m Z m Z m Z m Z d d l j j j Z d d l m Z d   Z i d d 6d	 d
 6d d 6d d 6d d 6Z i d d 6d d 6d d 6d d 6d d 6Z e j j Z d d  Z d S(   uG   Module that provides a GUI-based editor for matplotlib's figure optionsi    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   cmt   colorst   markerst   image(   t   QtGuic         C` s2   t  j t j d d  } t j t  j | |    S(   Nu   datapathu   images(   t   ospt   joint
   matplotlibt   rcParamsR   t   QIcon(   t   namet   basedir(    (    sJ   lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.pyt   get_icon   s    u   Solidu   -u   Dashedu   --u   DashDotu   -.u   Dottedu   :u   Noneu   Defaultu   defaultu   Steps (Pre)u	   steps-preu   stepsu   Steps (Mid)u	   steps-midu   Steps (Post)u
   steps-postc         ` s3  d- } t t   j    \ } } t t   j    \ } } d   j   f | d. d | f d | f d   j   f d   j   d d d	 g f | d/ d | f d | f d   j   f d   j	   d d d	 g f | d t
 f g }   j j    j j 	   j j      j j   
 d   } i   x<   j   D]. }	 |	 j   }
 |
 d k rWq3n  |	  |
 <q3Wg  } d   } t  d |  xQ D]I}
  |
 }	 t j t j |	 j   |	 j    d t } t j t j |	 j   |	 j    d t } t j t j |	 j   |	 j    d t } d |
 f | d0 d | t |	 j    f d | t |	 j    f d |	 j   f d | f | d1 d | t |	 j     f d |	 j!   f d | f d | f g } | j" | |
 d g  qWt# |   i   x<   j$   D]. } | j   }
 |
 d k rqωn  |  |
 <qωWt  d |  g  } g  t t% j& j'    D] \ } } | | f ^ qY} xζ  D]ή }
  |
 } | j(   } | t% j& j)   k rΘ| | j* f g | } n  | j+   \ } } d |
 f d | j* g | f d | f d  | f d! | j,   g g  t t- j.  D] } | | f ^ q'f g } | j" | |
 d g  q~Wt# |   | d" d f g } | r| j" | d# d f  n  | rΌ| j" | d$ d f  n            	 
 f d%   } t/ j0 | d& d' d( | d) t1 d*  d+ | } | d, k	 r/| |  n  d, S(2   u   Edit matplotlib figure optionsu   Titleu   <b>X-Axis</b>u   Leftu   Rightu   Labelu   Scaleu   linearu   logu   logitu   <b>Y-Axis</b>u   Bottomu   Topu   (Re-)Generate automatic legendc         S` sH   t  j d |   } | r: | j d  t | j d   f S|  d f Sd  S(   Nu   (_line|_image)(\d+)i   i   i    (   t   ret   matcht   groupt   int(   t   labelR   (    (    sJ   lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.pyt   cmp_keyK   s    "u
   _nolegend_c         S` sZ   d   |  j    D } d   | j    D } | |  | } | g t | j    d d   S(   uΩ  Prepare entry for FormLayout.

        `d` is a mapping of shorthands to style names (a single style may
        have multiple shorthands, in particular the shorthands `None`,
        `"None"`, `"none"` and `""` are synonyms); `init` is one shorthand
        of the initial style.

        This function returns an list suitable for initializing a
        FormLayout combobox, namely `[initial_name, (shorthand,
        style_name), (shorthand, style_name), ...]`.
        c         S` s   i  |  ] \ } } | |  q S(    (    (   t   .0t   shortR   (    (    sJ   lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.pys
   <dictcomp>i   s   	 c         S` s   i  |  ] \ } } | |  q S(    (    (   R   R   R   (    (    sJ   lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.pys
   <dictcomp>k   s   	 t   keyc         S` s   |  d S(   Ni   (    (   t   short_and_name(    (    sJ   lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.pyt   <lambda>q   s    (   t   itemst   sorted(   t   dt   initt
   name2shortt
   short2namet   canonical_init(    (    sJ   lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.pyt   prepare_data[   s    R   t
   keep_alphau   <b>Line</b>u
   Line styleu
   Draw styleu   Widthu   Color (RGBA)u   <b>Marker</b>u   Styleu   Sizeu   Face color (RGBA)u   Edge color (RGBA)u    u   Colormapu
   Min. valueu
   Max. valueu   Interpolationu   Axesu   Curvesu   Imagesc   (   
   ` s―    j    }   j   } |  j d  }  r< |  j d  n g  }  rW |  j d  n g  } |  rr t d   n  | \
 } } } }	 }
 } } } } }   j   |
 k rΈ   j |
  n    j   | k rΪ   j |  n    j |    j	 | |    j
 |	    j | |    j |     j _ 	   j _   j j     j j 
    j j     j j   xι t |  D]Ϋ \ } }   | } | \	 } } } } } } } } } | j |  | j |  | j |  | j |  t j |  } | j d  | j |  | d k	 r| j |  | j |  | j |  | j |  qqWx t |  D]x \ } }   | } | \ } } }  }! }" | j |  | j  t! j" |   | j# t$ |  |! g    | j% |"  qlW| r[d }# d }$   j& d k	 r0  j'   }% |% j( d k	 }# |% j) }$ n    j* d |$  }& |& r[|& j+ |#  q[n    j,   }' |' j- j.     j    | k o  j   | k s«|' j- j/ j0   n  d S(   u-   This function will be called to apply changesi    u   Unexpected fieldu   nonei   t   ncolN(1   t   get_xlimt   get_ylimt   popt
   ValueErrort
   get_xscalet
   set_xscalet
   get_yscalet
   set_yscalet	   set_titlet   set_xlimt
   set_xlabelt   set_ylimt
   set_ylabelt   xaxist	   convertert   yaxist	   set_unitst   _update_axisinfot	   enumeratet	   set_labelt   set_linestylet   set_drawstylet   set_linewidtht   mcolorst   to_rgbat	   set_alphat   Nonet	   set_colort
   set_markert   set_markersizet   set_markerfacecolort   set_markeredgecolort   set_cmapR   t   get_cmapt   set_climR   t   set_interpolationt   legend_t
   get_legendt
   _draggablet   _ncolt   legendt	   draggablet
   get_figuret   canvast   drawt   toolbart   push_current((   t   datat	   orig_xlimt	   orig_ylimt   generalt   curvest   imagest   titlet   xmint   xmaxt   xlabelt   xscalet   ymint   ymaxt   ylabelt   yscalet   generate_legendt   indext   curvet   lineR   t	   linestylet	   drawstylet	   linewidtht   colort   markert
   markersizet   markerfacecolort   markeredgecolort   rgbat   image_settingsR   t   cmapt   lowt   hight   interpolationRO   R%   t
   old_legendt
   new_legendt   figure(   t   axest   curvelabelst	   has_curvet	   has_imaget	   imagedictt   imagelabelst   linedictt
   xconvertert   xunitst
   yconvertert   yunits(    sJ   lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.pyt   apply_callback³   sv    $!$R[   u   Figure optionst   parentt   iconu   qt4_editor_options.svgt   applyN(   NN(   Nu   <b>X-Axis</b>(   Nu   <b>Y-Axis</b>(   Nu   <b>Line</b>(   Nu   <b>Marker</b>(2   R@   t   mapt   floatR&   R'   t	   get_titlet
   get_xlabelR*   t
   get_ylabelR,   t   FalseR3   R4   R5   t	   get_unitst	   get_linest	   get_labelR   R=   t   to_hexR>   t	   get_colort	   get_alphat   Truet   get_markeredgecolort   get_markerfacecolort
   LINESTYLESt   get_linestylet
   DRAWSTYLESt   get_drawstylet   get_linewidtht   MARKERSt
   get_markert   get_markersizet   appendt   boolt
   get_imagesR   t   cmap_dR   RG   t   valuesR   t   get_climt   get_interpolationt   mimaget   interpolations_namest
   formlayoutt   feditR   (   Ry   R   t   sepR\   R]   R`   Ra   RX   R   Rg   R   RY   R#   Rk   t   ect   fct	   curvedataR   RZ   R   Rr   t   cmapsRs   Rt   t	   imagedatat   datalistR   RU   (    (   Ry   Rz   R{   R|   R}   R~   R   R   R   R   R   sJ   lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.pyt   figure_edit-   sΆ    		
						4
			/-O	(   t   __doc__t
   __future__R    R   R   R   t   sixt   os.patht   pathR	   R   R   R   R   R=   R   R   R¦   t(   matplotlib.backends.qt_editor.formlayoutt   backendst	   qt_editorR¨   t   matplotlib.backends.qt_compatR   R   R   R   t   MarkerStyleR   R@   R±   (    (    (    sJ   lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.pyt   <module>   s*   ""	


