
    G8c$                         d Z ddl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dd	d
dZddddddZej$                  j                  ZddZy)zHModule that provides a GUI-based editor for Matplotlib's figure options.    )cbookcmcolorsmarkersimage)QtGui)_formlayout)DateConverternum2dateSolidDashedDashDotDottedNone)-z--z-.:r   DefaultzSteps (Pre)zSteps (Mid)zSteps (Post))defaultz	steps-prestepsz	steps-midz
steps-postNc                  
    !"# d}d } j                   j                    | j                                \  }} j                  j                  " | j	                         "      \  }}d j                         f|dd|fd|fd j                         fd j                         d	d
ddgf|dd|fd|fd j                         fd j                         d	d
ddgf|dg} j                   j                         ! j                  j                         #g  j                         D ]+  }	|	j                         }
|
dk(  rj                  |
|	f       - g }d }D ]w  \  }
}	t        j                  t        j                   |	j#                         |	j%                               d      }t        j                  t        j                   |	j'                         |	j%                               d      }t        j                  t        j                   |	j)                         |	j%                               d      }d|
f|dd |t*        |	j-                               fd |t.        |	j1                               fd|	j3                         fd|f|dd |t4        |	j7                               fd|	j9                         fd|fd|fg}|j                  ||
dg       z t;        |      g g  j<                   j>                  D ];  }|j                         }
|
dk(  s|jA                         )j                  |
|f       = g }tC        tD        jF                  jI                               D cg c]	  \  }}||f }}}D ]  \  }
}|jK                         }|tD        jF                  jM                         vr||jN                  fg|}|jQ                         \  }}d|
fd!|jN                  g|z   fd"|fd#|fg}tS        |d$      rLtC        tT        jV                        D cg c]  }||f }}|j                  d%|jY                         g|f       |j                  ||
dg        t;        |      |d&dfg}|r|j                  |d'df       |r|j                  |d(df         !"#f	d)}t[        j\                  |d*|t_        j`                  tc        te        jf                  d+d,                  |-       y c c}}w c c}w ).zEdit matplotlib figure options)NNc                 b    t        |t              rt        t        |       S t        t        |       S )z.Convert axis limits for correct input editors.)
isinstancer
   mapr   float)lim	converters     M/usr/lib/python3/dist-packages/matplotlib/backends/qt_editor/figureoptions.pyconvert_limitsz#figure_edit.<locals>.convert_limits"   s%    i/x%%5#    Title)Nz<b>X-Axis</b>LeftRightLabelScalelinearlogsymloglogit)Nz<b>Y-Axis</b>BottomTop)z(Re-)Generate automatic legendF
_nolegend_c                     || vri | |t        |      i} | j                         D ci c]  \  }}||
 }}}|j                         D ci c]  \  }}||
 }}}|| |      }|gt        |j                         d       z   S c c}}w c c}}w )a  
        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                     | d   S )N    )short_and_names    r   <lambda>z3figure_edit.<locals>.prepare_data.<locals>.<lambda>d   s    .2C r   )key)stritemssorted)dinitshortname
name2short
short2namecanonical_inits          r   prepare_dataz!figure_edit.<locals>.prepare_dataK   s     q=&1&dCI&A 67WWY?keTdEk?
?5?5E5E5GHkdEeTkH
H#AdG, z'')CEE 	F @Hs   BB
T)
keep_alpha)Nz<b>Line</b>z
Line stylez
Draw styleWidthzColor (RGBA))Nz<b>Marker</b>StyleSizezFace color (RGBA)zEdge color (RGBA) NColormapz
Min. valuez
Max. valueget_interpolationInterpolationAxesCurveszImages, etc.c           
        	 (j                         }(j                         }| j                  d      })r| j                  d      ng }*r| j                  d      ng }| rt        d      |\
  }}}}	}
}}}}}(j	                         |
k7  r(j                  |
       (j                         |k7  r(j                  |       (j                  |       (j                  ||       (j                  |	       (j                  ||       (j                  |       -(j                  _        /(j                  _        (j                  j!                  .       (j                  j!                  0       (j                  j#                          (j                  j#                          t%        |      D ]  \  }}+|   d   }|\	  }}}}}}}}}|j'                  |       |j)                  |       |j+                  |       |j-                  |       t/        j0                  |      }|j3                  d       |j5                  |       |dk7  s|j7                  |       |j9                  |       |j;                  |       |j=                  |        t%        |      D ]  \  }},|   d   }t?        |      dk(  r|\  }}} }!}"|jA                  |"       nt?        |      dk(  r|\  }}} }!|j'                         |jC                  tE        jF                                |jH                  tK         !g         |r_d}#d}$(jL                  *(jO                         }%|%jP                  du}#|%jR                  }$(jU                  |$      }&|&r|&jW                  |#       (jY                         }'|'jZ                  j]                          (j                         |k(  r(j                         |k(  s%|'jZ                  j^                  ja                          yy)	zA callback to apply changes.r   zUnexpected fieldr.   Nnone      )ncols)1get_xlimget_ylimpop
ValueError
get_xscale
set_xscale
get_yscale
set_yscale	set_titleset_xlim
set_xlabelset_ylim
set_ylabelxaxisr   yaxis	set_units_update_axisinfo	enumerate	set_labelset_linestyleset_drawstyleset_linewidthmcolorsto_rgba	set_alpha	set_color
set_markerset_markersizeset_markerfacecolorset_markeredgecolorlenset_interpolationset_cmapr   get_cmapset_climr5   legend_
get_legend
_draggable_ncolslegendset_draggable
get_figurecanvasdrawtoolbarpush_current)1data	orig_xlim	orig_ylimgeneralcurves	mappablestitlexminxmaxxlabelxscaleyminymaxylabelyscalegenerate_legendindexcurvelinelabel	linestyle	drawstyle	linewidthcolormarker
markersizemarkerfacecolormarkeredgecolorrgbamappable_settingsmappablecmaplowhighinterpolation	draggablerL   
old_legend
new_legendfigureaxes	has_curvehas_smlabeled_lineslabeled_mappables
xconverterxunits
yconverteryunitss1                                           r   apply_callbackz#figure_edit.<locals>.apply_callback   s   MMO	MMO	((1+ )!r#)DHHQKr	/00 $	dFFD$	??&OOF#??&OOF#udD!dD!  *

)



V$

V$

##%

##% &f- 	:LE5 '*D16/UIy)UFJoNN5!y)y)y)??5)DNN4 NN4 '##J/((9((9	:$ )2)(< 		4$E$(/2H$%*8I5tS$**=9&'1,):&tS$u%bkk$/0HvsDk23		4 IE||'!__.
&11=	"))51J((3 "9,I1MMM!!..0 2Nr   zFigure optionsimageszqt4_editor_options.svg)r   parenticonapply)4rZ   r   rM   r[   rN   	get_title
get_xlabelrQ   
get_ylabelrS   	get_units	get_lines	get_labelappendrc   to_hexrd   	get_color	get_alphaget_markeredgecolorget_markerfacecolor
LINESTYLESget_linestyle
DRAWSTYLESget_drawstyleget_linewidthMARKERS
get_markerget_markersizeboolr   collections	get_arrayr5   r   
_colormapsr4   rn   valuesr9   get_climhasattrmimageinterpolations_namesrD   r	   feditr   QIconr3   r   _get_data_path)$r   r   sepr   r   r   r   r   r~   r   r   r   r=   r   ecfc	curvedatar   r   r9   r   cmapsr   r   mappabledatainterpolationsdatalistr   r   r   r   r   r   r   r   r   s$   `                           @@@@@@@@r   figure_editr      s   
C %%J<JD$%%J<JD$)*&~*+$//+"E8W> ?&$%*+$//+"E8W> ?8G$ ZZ!!#FZZ!!#F M  , L eT]+	,
 FF6 % .tOODNN,dnn.>? ^^OOD4468HI ^^OOD4468HI e!<
D4F4F4HIJ<
D4F4F4HIJd((*+U##l7DOO,=>?T((*+ "% "%'	 	y%,-1.4 VI 5dkk5D$4$45 4""$L H$6$6$8$@  %!23	4
 I,22==3F3F3H,IJjdDdD\JEJ, 4x  "r}}++--DII&//E%%'	Te$))u,-34 	
 801)/0K0K)LN!%tNN N++-??!A B 	,r23#4& )_F&"%&H2./NB78P1 P1d ([[$$X/GHIK	] KNs   )S5S;)N)__doc__
matplotlibr   r   r   rc   r   r   r   matplotlib.backends.qt_compatr   matplotlib.backends.qt_editorr	   matplotlib.datesr
   r   r   r   MarkerStyler   r   r/   r   r   <module>r      s`    O M M / 5 4	
  	"
 


%
%_r   