
    h{&                         S r SSKJr  SSKJrJrJrJrJ	r
  SSKJr  SSKJr  SSKJrJr  SSS	S
SS.rSSSSSS.r\R(                  R                  rSS jrg)zHModule that provides a GUI-based editor for Matplotlib's figure options.    )chain)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                   ^ ^^^^^^ ^! SnS nT R                   mTR                  5        VVs0 s H9  u  pEU[        U" [        T SU S35      " 5       UR	                  5       5      5      _M;     nnnST R                  5       4U/[        R                  " TR                  5        VVs/ s H^  u  pESSUR                  5        S34S	Xd   S
   4SXd   S   4SUR                  R                  5       4SUR                  5       SSSS/4U4PM`     snn5      QSPnTR                  5        VVs0 s H  u  pEXER	                  5       _M     snnmTR                  5        VVs0 s H  u  pEXER                  5       _M     snnm/ m T R                  5        H-  nUR                  5       n	U	S:X  a  M  T R                  X45        M/     / n
S nT  GHs  u  p[         R"                  " [         R$                  " UR'                  5       UR)                  5       5      SS9n[         R"                  " [         R$                  " UR+                  5       UR)                  5       5      SS9n[         R"                  " [         R$                  " UR-                  5       UR)                  5       5      SS9nSU	4USSU" [.        UR1                  5       5      4SU" [2        UR5                  5       5      4SUR7                  5       4SU4USSU" [8        UR;                  5       5      4SUR=                  5       4S U4S!U4/nU
R                  XS"/5        GMv     [?        U
5      m/ m!/ T R@                  QT RB                  Q H?  nUR                  5       n	U	S:X  d  URE                  5       c  M,  T!R                  U	U45        MA     / n[G        [H        RJ                  R                  5       5       VVs/ s H
  u  nnUU4PM     nnnT! GH  u  n	nURM                  5       nURN                  [H        RJ                  ;  a  UURN                  4/UQnURQ                  5       u  nnSU	4S#URN                  /U-   4S$U4S%U4/n[S        US&5      (       av  [G        [T        RV                  5       Vs/ s H  oDU4PM     nnUR                  S'URY                  5       /UQ45        / S(QnUR                  S)UR[                  5       /UQ45        UR                  UU	S"/5        GM     [?        U5      mUS*S"4/nU
(       a  UR                  U
S+S"45        U(       a  UR                  US,S"45        U UUUUUU U!4S- jn[\        R^                  " US.U[`        Rb                  " [e        [f        Rh                  " S/S05      5      5      US19  gs  snnf s  snnf s  snnf s  snnf s  snnf s  snf )2zEdit matplotlib figure options)NNc                 l    [        U[        5      (       a  [        [        U 5      $ [        [        U 5      $ )z.Convert axis limits for correct input editors.)
isinstancer   mapr   float)lim	converters     ]/var/www/html/env/lib/python3.13/site-packages/matplotlib/backends/qt_editor/figureoptions.pyconvert_limits#figure_edit.<locals>.convert_limits#   s(    i//x%%5#    get_r   TitleNz<b>z	-Axis</b>Minr   Max   LabelScalelinearlogsymloglogit)z(Re-)Generate automatic legendF
_nolegend_c                    X;  a  0 U EU[        U5      0En U R                  5        VVs0 s H  u  p#X2_M	     nnnUR                  5        VVs0 s H  u  p2X#_M	     nnnX@U      nU/[        UR                  5       S S9-   $ s  snnf s  snnf )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                     U S   $ )Nr&    )short_and_names    r   <lambda>3figure_edit.<locals>.prepare_data.<locals>.<lambda>o   s	    .2Cr!   )key)stritemssorted)dinitshortname
name2short
short2namecanonical_inits          r   prepare_data!figure_edit.<locals>.prepare_dataV   s     =&1&dCI&A 67WWY?YkedkY
?5?5E5E5GH5Gkdek5G
H#dG, 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) Colormapz
Min. valuez
Max. valueget_interpolationInterpolation)datargbaautozInterpolation stageAxesCurveszImages, etc.c           
        > T) Vs0 s H  nU[        T'SU S35      " 5       _M     nnU R                  S5      nT+(       a  U R                  S5      O/ nT,(       a  U R                  S5      O/ nU (       a  [        S5      eUR                  S5      nT'R                  U5        UR                  5       n[	        T)R                  5       5       H  u  nu  pUSU-     n
USU-  S-      nUSU-  S-      nUSU-  S-      nU	R                  5       U:w  a  [        T'S	U S
35      " U5        U	R                  XSS9  U	R                  U5        U	R                  T(U   5        U	R                  T*U   5        M     [	        U5       H  u  pT-U   S   nUu	  nnnnnnnnnUR                  U5        UR                  U5        UR                  U5        UR                  U5        [        R                   " U5      nUR#                  S5        UR%                  U5        US:w  d  M  UR'                  U5        UR)                  U5        UR+                  U5        UR-                  U5        M     [	        U5       H  u  nnT.U   S   n[/        U5      S:X  a,  Uu  nnnnn n!UR1                  U 5        UR3                  U!5        O[/        U5      S:X  a  Uu  nnnnUR                  W5        UR5                  W5        UR6                  " [9        WW/5      6   M     U(       ab  Sn"Sn#T'R:                  b*  T'R=                  5       n$U$R>                  SLn"U$R@                  n#T'RC                  U#S9n%U%(       a  U%RE                  U"5        T'RG                  5       n&U&RH                  RK                  5         T) HD  n[        T'SU S35      " 5       X!   :w  d  M   U&RH                  RL                  RO                  5           g   gs  snf )zA callback to apply changes.r"   r   r   zUnexpected field   r&         set_scaleF)rK   Nnone   )ncols)(getattrpop
ValueError	set_title	enumerater6   	get_scale_set_limset_label_text_set_converter	set_units	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_interpolation_stageset_cmapset_climr7   legend_
get_legend
_draggable_ncolslegendset_draggable
get_figurecanvasdrawtoolbarpush_current)/rI   r;   orig_limitsgeneralcurves	mappablestitlegenerate_legendiaxisaxis_minaxis_max
axis_label
axis_scaleindexcurvelinelabel	linestyle	drawstyle	linewidthcolormarker
markersizemarkerfacecolormarkeredgecolorrJ   mappable_settingsmappablecmaplowhighinterpolationinterpolation_stage	draggablerV   
old_legend
new_legendfigureaxesaxis_converteraxis_map
axis_units	has_curvehas_smlabeled_lineslabeled_mappabless/                                          r   apply_callback#figure_edit.<locals>.apply_callback   s    !
  '$$tfC 0133  	 

 ((1+ )!r#)DHHQKr	/00Au!++-()9:OA|qs|HqsQw'H 1q)J 1q)J~~:-TF%01*=MM(5M9
+ t 45NN:d+,  ;  &f-LE '*D16/UIy)UFJoNN5!y)y)y)??5)DNN4 NN4 '##J/((9((9 .$ )2)(<$E$(/2H$%*# KtS$7J**=9001DE&'1,):&tS$u%d#vsDk23 )= IE||'!__.
&11=	"))51J((3 "DttD6-.0K4EE%%224 [
s    O*zFigure optionsimageszqt4_editor_options.svg)r   parenticonapply)5	_axis_mapr6   tuplerW   get_converter	get_titler   from_iterabler   r   get_textr\   	get_units	get_lines	get_labelappendre   to_hexrf   	get_color	get_alphaget_markeredgecolorget_markerfacecolor
LINESTYLESget_linestyle
DRAWSTYLESget_drawstyleget_linewidthMARKERS
get_markerget_markersizeboolr   collections	get_arrayr7   r   
_colormapsget_cmapr;   get_climhasattrmimageinterpolations_namesrG   get_interpolation_stager
   feditr	   QIconr5   r   _get_data_path)"r   r   sepr   r;   r   axis_limitsr~   r   r   r   r?   r   ecfc	curvedatar   r   r   cmapsr   r   mappabledatainterpolationsinterpolation_stagesdatalistr   r   r   r   r   r   r   r   s"   `                          @@@@@@@r   figure_editr      s   
C ~~H
 #..*	 +JD 	eNDDc*+-t/A/A/C
  	 +	   
$.."# 
		 'nn.
 /
 TZZ\N)45)!,-)!,-$**--/04>>+#UHg? @ /
 
 	2G* #..**JD 	  ""*N #..**JD 	nn*J M  L e]+	 !
 FF6 %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""$L H$6$6$8$@  %!23	 6
 I,22==3F3F3H,IJ,IjdDdD\,IEJ,x  "99BMM)DII&//E%%'	Te$))u,-34 	
 8011)/0K0K)LN)Lt)L  N++-??!A B $< %113K6JK!M N 	,r23/ -2 )_F&"%&H2./NB78R Rh ([[$$X/GHIK	A
 Z KNs%   A V&A%V$)V*V0V6V<)N)__doc__	itertoolsr   
matplotlibr   r   r   re   r   r   r   matplotlib.backends.qt_compatr	   matplotlib.backends.qt_editorr
   matplotlib.datesr   r   r   r   MarkerStyler   r   r0   r!   r   <module>r      sc    O  M M / 5 4	
  	"
 


%
%qr!   