
    z%i                       	 d dl Z d dlmZmZmZmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- d dlm.Z. d dl/m0Z1 d dlm2Z2 d dl3m4Z4m5Z5 d dl6m7Z7 d dl8m9Z9 d d	l:m;Z; d d
l<m=Z=m>Z> d dl?m@Z@ d dlAmBZB d dlCmDZD d dlEmFZF d dlGmHZH d dlImJZJ d dl?mKZK  e5       ZLeBeDeFeHeJfZM G d de      ZNdaO G d de!      ZP G d de!      ZQ G d de!      ZR G d de!      ZS G d de!      ZT G d d e!      ZU G d! d"e"      ZV G d# d$      ZW eW       ZXd%ZYd&d'd(d)d*d+ZZd, Z[ G d- d.e!      Z\e]d/k(  r d d0l^m_Z_  e_d1d2d34       d d5l`maZa  eaeN       yy)6    N)ToplevelListboxCanvas	StringVar
BooleanVarIntVarTRUEFALSETOPBOTTOMRIGHTLEFTSOLIDGROOVENONEBOTHXYWEEWNSNSEWNW
HORIZONTALVERTICALANCHORACTIVEENDTclError)Frame
LabelFrameButtonCheckbuttonEntryLabel
OptionMenuNotebookRadiobutton	ScrollbarStyleSpinboxCombobox)colorchooser)
messagebox)idleConfConfigChanges)GetKeysWindow)DynOptionMenu)macosx)SectionName
HelpSource)	view_text)AutoComplete)CodeContext)
ParenMatch)FormatParagraph)Squeezer)ScrollableTextFramec                   `     e Zd Z	 dddddZd Zd Zd Zd Zd Z fd	Z	d
 Z
d Zd Z xZS )ConfigDialogF)_htest_utestc                   	 t        j                  | |       || _        |ri |_        |s| j	                          | j                  |xs d       |j                         dz   }|j                         |sdndz   }| j                  d| d|        | j                          | j                  t        t               | j                  |       | j                  d| j                         | j                  j                   j#                          t$        j'                          |s1| j)                          | j+                          | j-                          y y )NzIDLE Preferences         +heightwidthWM_DELETE_WINDOW)r   __init__parentinstance_dictwithdrawtitlewinfo_rootxwinfo_rootygeometrycreate_widgets	resizabler
   	transientprotocolcancelfontpagefontlist	focus_settracersattachgrab_setwm_deiconifywait_window)selfrL   rO   r@   rA   xys          H/home/uftp/.pyenv/versions/3.12.0/lib/python3.12/idlelib/configdialog.pyrK   zConfigDialog.__init__1   s   	 	$'#%F MMO

5../ 2% fB#>!AaSk" 	e51v($++6((* 	MMO     c                    	 t        | d      x| _        }| j                  j                  d       t        |      x| _        }t        |      | _        t        || j                        | _        t        || j                        | _
        t        || j                        | _        t        |      | _        t        |      | _        |j#                  | j                  d       |j#                  | j                  d       |j#                  | j                  d       |j#                  | j                  d	       |j#                  | j                   d
       |j#                  | j                  d       |j%                          |j'                  t(        t*        t,               | j/                         j'                  t0               y )N5pxpaddingnwes)stickyz Fonts text
Highlightsz Keys z	 Windows z
 Shell/Ed 
Extensionssideexpandfillrp   )r!   framegridr(   noteExtPageextpageHighPagehighpageFontPagerX   KeysPagekeyspageWinPagewinpageShedPageshedpageaddenable_traversalpackr   r	   r   create_action_buttonsr   )r`   rt   rv   s      rc   rS   zConfigDialog.create_widgets`   sE   	" #477
U

v&#E?*	Dt} t||4 t}}5 t||4t} Y/\2X.K0\2L1		s4d	3""$))v)6rd   c                 
   	 t        j                         ri }nddi}t        | j                  d      }t        |d      }i | _        d| j
                  fd| j                  fd| j                  fd| j                  ffD ]J  \  }}t        |f||t        d	|| j                  |<   | j                  |   j                  t        d
       L t        |dd      j                  t               |j                  t               |S )Nrh   )         rg   OkApplyCancelHelp)rl   command	takefocus   )rp   padxr   )rH   borderwidthrs   )r4   isAquaTkr!   rt   buttonsokapplyrW   helpr#   r
   r   r   r   r   )r`   padding_argsouterbuttons_frametxtcmds         rc   r   z"ConfigDialog.create_action_buttons   s   	" ?? L%v.Ldjj!,eQ/477Odjj!t{{#TYY	! 	6HC
 !'} !83!&!8*6!8DLLLL""1"5	6 	eA1-222<'rd   c                 F    	 | j                          | j                          y N)r   destroyr`   s    rc   r   zConfigDialog.ok   s    8

rd   c                     	 | j                          t        j                          | j                  j	                          | j                          y r   )deactivate_current_configchangessave_allrx   save_all_changed_extensionsactivate_config_changesr   s    rc   r   zConfigDialog.apply   s9    9&&(002$$&rd   c                 N    	 t         j                          | j                          y r   )r   clearr   r   s    rc   rW   zConfigDialog.cancel   s    	
 	rd   c                     | j                   j                  j                  dd      a| j	                          t
        |           y )N1.0end)rX   font_samplegetfont_sample_textgrab_releasesuperr   )r`   	__class__s    rc   r   zConfigDialog.destroy   s6    ==4488Frd   c           	          	 | j                   j                  | j                   j                         d      j                         }t	        | dt
        t        j                  |d      z          y )Nrl   )optionzHelp for IDLE preferences )rO   contents)rv   tabselectstripr7   help_common
help_pagesr   )r`   pages     rc   r   zConfigDialog.help   sV    	 yy}}TYY--/}?EEG$9&z~~dB'??	Ard   c                 |    	 | j                   j                  j                         }|D ]  }|j                           y r   )rL   rM   keysRemoveKeybindings)r`   win_instancesinstances      rc   r   z&ConfigDialog.deactivate_current_config   s<    	 11668% 	)H&&(	)rd   c                 R   	 | j                   j                  j                         }|D ]b  }|j                          |j	                          |j                          |j                          |j                          |j                          d t        D ]  }|j                           y r   )rL   rM   r   ResetColorizer	ResetFontset_notabs_indentwidthApplyKeybindingsreset_help_menu_entriesupdate_cursor_blinkreloadablesreload)r`   r   r   klasss       rc   r   z$ConfigDialog.activate_config_changes   s    	
 11668% 	+H##% ++-%%',,.((*	+ ! 	ELLN	rd   )r   )__name__
__module____qualname__rK   rS   r   r   r   rW   r   r   r   r   __classcell__r   s   @rc   r?   r?   -   sG    -5 -^$7L&P
'
A	)rd   r?   u^  <ASCII/Latin1>
AaBbCcDdEeFfGgHhIiJj
1234567890#:+=(){}[]
¢£¥§©«®¶½ĞÀÁÂÃÄÅÇÐØß

<IPA,Greek,Cyrillic>
ɐɕɘɞɟɤɫɮɰɷɻʁʃʆʎʞʢʫʭʯ
ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκ
БбДдЖжПпФфЧчЪъЭэѠѤѬӜ

<Hebrew, Arabic>
אבגדהוזחטיךכלםמןנסעף
ابجدهوزحطي٠١٢٣٤٥٦٧٨٩

<Devanagari, Tamil>
०१२३४५६७८९अआइईउऊएऐओऔ
௦௧௨௩௪௫௬௭௮௯அஇஉஎ

<East Asian>
〇一二三四五六七八九
汉字漢字人木火土金水
가냐더려모뵤수유즈치
あいうえおアイウエオ
c                   >     e Zd Z fdZd Zd Zd Zd ZddZ xZ	S )r{   c                     t         |   |       |j                  | _        | j                          | j	                          y r   )r   rK   highlight_samplecreate_page_fontload_font_cfg)r`   masterrz   r   s      rc   rK   zFontPage.__init__"  s6      ( 9 9rd   c                    	 t         j                  t        |       | j                        | _        t         j                  t        |       | j                        | _        t         j                  t        |       | j                        | _        t        | dt        d      }t        | dt        d      }t        |      }t        |      }t        |t        d      }t        |ddt        	      | _        | j                  j!                  d
| j"                         | j                  j!                  d| j"                         | j                  j!                  d| j"                         t%        |      }|j'                  | j                  j(                         | j                  j'                  |j*                         t        |d      }t-        || j
                  d       | _        t1        || j                  ddd      | _        t5        |      }|j6                  | _        | j8                  j'                  t:        dd       | j8                  j=                  t>        t@               | jC                  dd       | jE                  dd       |jG                  dddd       |jG                  dddddd       |jI                  tJ        ddtL               |jI                  tJ        ddtL               |jI                  tJ        tN               | j                  jI                  t        tP        tL               |jI                  t        tR               |jI                  t        tN               | j.                  jI                  t        tN               | j2                  jI                  t        tN        d !       |jI                  tP        tT        "       y )#Nr   z Shell/Editor Font r   reliefrl   z Font Sample (Editable) zFont Face :)justifyrl      TrH   r   exportselection<ButtonRelease-1>z<KeyRelease-Up>z<KeyRelease-Down>r   )yscrollcommandzSize :rk      r   Bold)variableonvalueoffvaluerl   )wraprI   rH   weightr   )rowcolumnr   padyr   nsew)r   r   rowspanr   r   rj   rp   r   r   rr   rp   anchorro   )rp   rr   rC   rp   r   r   )rq   rr   )+r[   r   r   var_changed_font	font_name	font_sizer   	font_boldr"   r   r!   r&   r   r   r
   rY   bindon_fontlist_selectr*   configyviewsetr3   sizelistr$   bold_toggler=   rl   r   r   insertr   r   columnconfigurerowconfigureru   r   r   r   r   r	   r   r   )	r`   
frame_fontframe_sampleframe_font_nameframe_font_paramfont_name_titlescroll_fontfont_size_titlefont_sample_frames	            rc   r   zFontPage.create_page_font(  s   $	J !Yt_d6K6KL Yt_d6K6KL Z%5t7L7LM  !F%:<
!$Af'AC  
+ ,MC*.G.0G0GH,d.E.EF.0G0GH04==#6#67KOO< 0x@%&6M& 4>>AF4 0=,11T1=%56 	Qq)!A&Aaaa8a111!' 	 	) 	#AAA>3QQQ?#a0T:d+$q1Q/4;d6rd   c                 2   	 t        j                  | dd      }|d   j                         }|d   }|d   dk(  }t        t	        t        j                  |                   }|D ]"  }| j                  j                  t        |       $ | j                  j	                  |       |D cg c]  }|j                          }}	 |j                  |      }	| j                  j                  |	       | j                  j                  |	       | j                  j                  |	       | j                  j                  |	       | j"                  j%                  d|       | j&                  j	                  |       | j)                          y c c}w # t         $ r Y Xw xY w)NmainEditorWindowr   r   r   bold)78910111213141618202225293440)r0   GetFontlowersortedr   tkfontfamiliesrY   r   r   r   indexsee
select_setselect_anchoractivate
ValueErrorr   SetMenur   set_samples)
r`   configured_fontr   r   r   fontsfontslc_fontscurrent_font_indexs
             rc   r   zFontPage.load_font_cfg  sg   	 #**4H#A&,,.	#A&	$Q'/	 s6??4012 	,DMM  d+	,9%',-!AGGI--	!)	!:MM01MM$$%78MM''(:;MM""#56 	 O'	) 	9% .  		s   &F A=F
 
	FFc                 R   	 | j                   j                         }t        j                  ddd|       | j                  j                         }t        j                  ddd|       | j
                  j                         }t        j                  ddd|       | j                          y )Nr  r	  r*  z	font-sizez	font-bold)r   r   r   
add_optionr   r   r'  r`   paramsvalues      rc   r   zFontPage.var_changed_font  s    	 ""$6>65A""$6>;F""$6>;Frd   c                     	 | j                   j                  |j                  j                  dk(  rt        nt
              }| j                  j                  |j                                y )N
KeyRelease)	rY   r   typenamer   r   r   r   r  )r`   eventr*  s      rc   r   zFontPage.on_fontlist_select  sJ    	
 }}  **//\9vG4::<(rd   c                 $   	 | j                   j                         }| j                  j                         rt        j                  nt        j
                  }|| j                  j                         |f}|| j                  d<   || j                  d<   y )Nr*  )	r   r   r   r  BOLDNORMALr   r   r   )r`   r7  r   font_weightnew_fonts        rc   r'  zFontPage.set_samples  sr    	 NN&&(	%)^^%7%7%9fkkv}}t~~113[A#+ (0f%rd   r   )
r   r   r   rK   r   r   r   r   r'  r   r   s   @rc   r{   r{      s$    W7r D)1rd   r{   c                        e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z xZS )ry   c                     t         |   |       || _        |j                         | _        t        |      | _        | j                          | j                          y r   )	r   rK   rx   winfo_toplevelcdr+   stylecreate_page_highlightload_theme_cfgr`   r   rx   r   s      rc   rK   zHighPage.__init__  sJ     '')6]
""$rd   c           
          	 i ddddddddd	d
dddddddddddddddddddddd  _         t        j                  t                j                         _        t        j                  t                j                         _        t                _	        t        j                  t                j                         _        t        j                  t                j                         _        t        j                  t                j                         _        t!         d!t"        d"#      }t!         d!t"        d$#      }t%        |t&        d%&      }|j(                  x} _        |j-                  d'd(d%d%t.        d)t0        *       |j3                  d+d,        |j3                  d-d.        d/}|D ]  \  }}|j5                  t6        ||        t9        |j;                  d0t6              j=                               }t?        d%|      D ]1  }	|j5                  |	 d1|	t9        tA        |             d2d3d4       3  j                   D ],  }
|
f fd5	}|jC                   j                   |
   d)   d6|       . d7|d8<    jD                  j-                  d9d%d:;       tG        |d9<       _$        tG        |      }tK         jH                  d= jL                  >       _'        tQ         jH                   j                  d d)?       _)        tU        | j                  d%d@ jV                  A       _,        tU        | j                  d)dB jV                  A       _-         j                  j]                  d%       tK        |dC j^                  >       _0        tc        |dDE      }tU        | j                  d% jd                  dFG       _3        tU        | j                  d) jd                  dHG       _4        tQ        | j
                  d d I       _5        tQ        | j                  d d I       _6        tK        |dJ jn                  >       _8        tc        |d!K       _9        |ju                  tv        dLdLtx        tz        M       |ju                  t|        dLdLt~        N        jH                  ju                  t|        dLdLt~        N       |ju                  t|        dLd)O       |ju                  t|        dLdLtx        tz        M        jN                  ju                  t|        tx        t~        dPdQR        jR                  ju                  t|        tx        t~        dPdSR        jX                  ju                  tv        t        T        jZ                  ju                  t        t        T        j`                  ju                  t        t~        dLdLU       |ju                  t|        t        dLdLV        jf                  ju                  t|        t        dLW        jh                  ju                  t|        t        dLd!V        jj                  ju                  t|        t~        dLdLU        jl                  ju                  t|        t~        t        dLdLX        jp                  ju                  t|        t~        dLdLU        jr                  ju                  t|        t~        dLY       y )ZNzNormal Code or Text)normal00zCode Context)context01zPython Keywords)keyword02zPython Definitions)
definition03zPython Builtins)builtin04zPython Comments)comment05zPython Strings)string06zSelected Text)hilite07z
Found Text)hit08Cursor)cursor09zEditor Breakpoint)breakr  zShell Prompt)consoler  z
Error Text)errorr  zShell User Output)stdoutr  zShell User Exception)stderrr  zLine Number)
linenumberr  r   z Custom Highlighting r   z Highlighting Theme r   )r   r   )courier   r   hand2r   )r*  rY  rI   rH   r   highlightthicknessr   z<Double-Button-1>c                      yNr[   es    rc   <lambda>z0HighPage.create_page_highlight.<locals>.<lambda>u      rd   z<B1-Motion>c                      yrf  rg  rh  s    rc   rj  z0HighPage.create_page_highlight.<locals>.<lambda>v  rk  rd   )")z# Click selects item.rP  
rF  )zcode context sectionrH  rm  )z| cursorrY  rm  )defrJ  ) rF  )funcrL  )z(param):
  rF  )z"Return None."rR  )z

  var0 = rF  )z'string'rR  )z

  var1 = rF  )z
'selected'rT  )z

  var2 = rF  )z'found'rV  )z

  var3 = rF  )listrN  )(rF  )NonerJ  )z)
rF  )z  breakpoint("line")r[  )z

rF  z>>>r\  )z	 3.14**2
rF  )z9.8596r^  rm  ru  )z pri rF  )nr]  )zt(
rF  )SyntaxErrorr_  rm  r   z.0drp  r`  c                 <    j                   j                  |       y r   )highlight_targetr   )r7  elemr`   s     rc   temz+HighPage.create_page_highlight.<locals>.tem  s    %%))$/rd   z<ButtonPress-1>disabledstateframe_color_set.TFramesolid)r   r   )rA  zChoose Color for :rl   r   )rd  
Foreground)r   r2  rl   r   
BackgroundzSave as New Custom Themez	Select : rk   za Built-in Themer   r2  r   rl   za Custom Themer   zDelete Custom Themer   r   rp   r   r   rq   rr   r   rp   r   r         )rp   rq   rr   r   r   r   r   rp   rr   r   r   rp   r   r   r   r   )rp   rr   r   r   r   )rp   rr   r   )Dtheme_elementsr[   r   r   var_changed_builtin_namebuiltin_namevar_changed_custom_namecustom_namer   fg_bg_togglevar_changed_colorcolorvar_changed_theme_sourcetheme_sourcevar_changed_highlight_targetrz  r"   r   r=   r   rl   r   	configurer
   r   r   r   r   lenr   
splitlinesrangestrtag_bindrA  r!   frame_color_setr#   	get_colorbutton_set_colorr3   
targetlistr)   set_color_sample_bindingfg_onbg_onr   save_as_new_themebutton_save_customr&   set_theme_typebuiltin_theme_oncustom_theme_onbuiltinlist
customlistdelete_custombutton_delete_customtheme_messager   r   r	   r   r   r   r   r   r   r   )r`   frame_customframe_themesample_framerl   string_tagsrR  tagn_lineslinenoelementr|  frame_fg_bg_toggletheme_type_titles   `             rc   rB  zHighPage.create_page_highlight  s   s	h!#3- 0 !"6	
 0 0 . - - &   - /  !1 #$4  /!$ $KK$!>!>@";;$!=!=?&t,[[$!7!79
#KK4 $"?"?A '$!B!B!D
 "$Af'>@ 1V&<> +U;'3'8'88t$(!AD 	 	B 			%'89		-!239$ ' 	*KFCKKVS)	*dhhuc*5578Aw' 	&FKK6("!3s7|#4"5Q!67q9$&	& ** 	MG ' 0 MM''035FM		M #W

51$+ 	 	-$\9QR"<0 &$$+?!( ($$d&;&;T#$& !"T->->a!4+H+HJ
 !"T->->a!4+H+HJ
 	a "(#=..#0 !;? +d&7&7q++2D!F  +d&7&7q++2B D )T..dD'T--tTC$*"7**%,! #;A> 	t!!DtLc:!!s!CSqq9qqD 	 	B""Dqqq"Q#dK

T!,

U1-$$&qqq$I3qqqA""AA">!!s111!E3QQQ?#AaaaH!!&&Caaa&HSqq9rd   c           	      h    	  j                   j                  t        j                  ddddd             t        j                         } j                   j                         rt        j                  dd      }|j                           j                  j                  ||       t        j                  dd      }|j                          |s7 j                  j                  d	        j                  j                  d
       n j                  j                  ||d          nt        j                  dd      }|j                           j                  j                  ||       t        j                  dd      }|j                           j                  j                  ||d           j                          t         j                   j#                               }|j                   fd        j$                  j                  ||d           j'                           j)                          y )Nr  Themedefaultboolr   r5  r  	highlightuserr}  - no custom themes -r   c                 (    j                   |    d   S )Nr   )r  )ra   r`   s    rc   rj  z)HighPage.load_theme_cfg.<locals>.<lambda>  s    t':':1'=a'@ rd   )key)r  r   r0   	GetOptionCurrentThemer   GetSectionListsortr  r&  r  r~  r  r  r  rr  r  r   r  paint_theme_sampleset_highlight_target)r`   current_option	item_listtheme_namess   `   rc   rC  zHighPage.load_theme_cfg  s   	( 	h00D 	E "..0  " //	;GINN$$Y? //DINN$$**=9  $$%;<''	9Q<@ //DINNOO##I~> //	;GINN$$Y	!=4..3356@A[^<!!!#rd   c                    	 d}| j                   j                         }||vr\t        j                  ddd      |vrt        j                  ddd|d          t        j                  ddd|       d| j                  d<   n?t        j                  ddd|       t        j                  dddd	       d	| j                  d<   | j                          y )
N)zIDLE ClassiczIDLE Newr  r  r6  r   name2zNew theme, see Helprl   r   )r  r   r0   r  r   r/  r  r  )r`   r1  
old_themesr2  s       rc   r  z!HighPage.var_changed_builtin_name  s    	
 2
!!%%'
"!!&'6:*L""67FJqMJvw?)>Dv&vw>vw<)+Dv&!rd   c                     	 | j                   j                         }|dk7  r)t        j                  ddd|       | j	                          y y )Nr  r  r  r6  )r  r   r   r/  r  r0  s      rc   r  z HighPage.var_changed_custom_name  sK    	
   $$&**vw>##% +rd   c                     	 | j                   j                         }t        j                  ddd|       |r| j	                          y | j                          y )Nr  r  r  )r  r   r   r/  r  r  r0  s      rc   r  z!HighPage.var_changed_theme_source$  sL    	
 !!%%'67Iu=))+((*rd   c                 &    	 | j                          y r   )on_new_color_setr`   r1  s     rc   r  zHighPage.var_changed_color1  s    )rd   c                 &    	 | j                          y r   )r  r  s     rc   r  z%HighPage.var_changed_highlight_target5  s    ?!!#rd   c                 V   	 | j                   j                         r:d| j                  d<   d| j                  d<   | j                  j                  d       y d| j                  d<   | j                  j                  d       d| j                  d<   | j                  j                  d       y NrF  r~  r}  r  z	!disabled)r  r   r  r  r  r~  r  r   s    rc   r  zHighPage.set_theme_type9  s    	"   "(0DW%'1DOOG$%%++M:(2DW%  &&~6'/DOOG$%%++N;rd   c                    	 | j                   j                         }| j                  j                  | j                  d   d      }t        j                  | d|z   |      \  }}|r||k7  ry| j                  j                         rCd}| j                  |      }|sy | j                  |       | j                  j                  |       y | j                  j                  |       y y y )NrA  
backgroundzPick new color for : )rL   rO   initialcolorz_Your changes will be saved as a new Custom Theme. Enter a name for your new Custom Theme below.)rz  r   rA  lookupr  r.   askcolorr  get_new_theme_name
create_newr  r   )r`   target
prev_color	rgbTupletcolor_stringmessage	new_themes          rc   r  zHighPage.get_colorU  s    	" &&**,ZZ&&t';';G'D'35
"."7"7#:6#A'#)	< \Z7  $$&K 33G<	 OOI.JJNN<0

|, 8<rd   c                    	 | j                   j                         }| j                  j                  d|       | j                  j                         rdnd}| j
                  | j                  j                            d   } | j                  j                  |fi ||i | j                  j                         }|dz   |z   }t        j                  d|||       y )Nr  r  
foregroundr  r   -r  )r  r   rA  r  r  r  rz  r   
tag_configr  r   r/  )r`   	new_colorplanesample_elementthemetheme_elements         rc   r  zHighPage.on_new_color_set{  s    >JJNN$	

5)L $ 1 1 5 5 7\,,T-B-B-F-F-HI!L(((NE9;MN  $$&&,u4;}iHrd   c                     	 t        j                  dd      t        j                  dd      z   }t        | d||      j                  }|S )Nr  r  r  zNew Custom Themer0   r  r5   result)r`   r  
used_namesr  s       rc   r  zHighPage.get_new_theme_name  sO    4--fkB''	;?@
(':??Ev 	rd   c                 P    	 | j                  d      }|r| j                  |       y y )NzNew Theme Name:)r  r  )r`   new_theme_names     rc   r  zHighPage.save_as_new_theme  s.    	 001BCOON+ rd   c                 "   	 | j                   j                         rd}| j                  j                         }nd}| j                  j                         }t	        j
                  ||      }|t        d   v rt        d   |   }|D ]
  }||   ||<    | j                  ||       t	        j                  dd      }|j                          | j                  j                  ||       | j                   j                  d       | j                          y )Nr  r  r  r   )r  r   r  r  r0   GetThemeDictr   save_newr  r  r  r&  r   r  )r`   r  
theme_type
theme_namer  theme_changesr  custom_theme_lists           rc   r  zHighPage.create_new  s    	$   ""J**..0JJ))--/J))*jA	--#K0<M( <%27%;	'"< 	ni0$33FKH  1>Ba rd   c                    	 | j                   j                         dk(  rR| j                  j                  d       | j                  j                  d       | j
                  j                  d       nQ| j                  j                  d       | j                  j                  d       | j
                  j                  d       | j                          y )NrX  r  r   r  )rz  r   r  r~  r  r  r   set_color_sampler   s    rc   r  zHighPage.set_highlight_target  s    	"   $$&(2JJ]+JJ]+!!!$JJ^,JJ^,!!!$rd   c                 &    	 | j                          y r   )r  )r`   argss     rc   r  z!HighPage.set_color_sample_binding  s    	
 	rd   c                    	 | j                   | j                  j                            d   }| j                  j                         rdnd}| j                  j                  ||      }| j                  j                  d|       y )Nr   r  r  r  r  )r  rz  r   r  r   tag_cgetrA  r  )r`   r  r  r  s       rc   r  zHighPage.set_color_sample  su    
	 !!$"7"7";";"=>qA $ 1 1 5 5 7\%%..sE:

5%Hrd   c                 (   	 | j                   j                         r| j                  j                         }n| j                  j                         }| j                  D ]  }| j                  |   d   }t        j                  ||      }|dk(  rt        j                  |d      d   |d<   |t        d   v r0t        d   |   }|dz   |v r||dz      |d<   |dz   |v r||dz      |d<    | j                  j                  |fi |  | j                          y )	Nr   rY  rF  r  r  z-foregroundr  z-background)r  r   r  r  r  r0   GetHighlightr   r   r  r  )r`   r  element_titler  colors
theme_dicts         rc   r  zHighPage.paint_theme_sample  s4   	&   "%%))+E$$((*E!00 	@M))-8;G**5':F("'/'<'<x())5(7|$ ,,$[1%8
]*j8+5g6M+NF<(]*j8+5g6M+NF<(,D!!,,W??	@ 	rd   c                     	 t         j                  d   j                  |       |D ]+  }||   }t         j                  d   j                  |||       - y )Nr  r0   userCfg
AddSection	SetOption)r`   r  r  r  r2  s        rc   r  zHighPage.save_new  sY    	
 	%00< 	PG'NE[)33JO	Prd   c                 ,    t        j                  |i |S r   r/   askyesnor`   r  kwargss      rc   r  zHighPage.askyesno*      ""D3F33rd   c                 l   	 | j                   j                         }d}| j                  d||z  |       sy | j                  j	                          t
        j                  d|       t        j                  dd      }|j                          |s8| j                  j                  d       | j                  j                  |d       n| j                  j                  ||d          | j                  j                  t        j                   d	   j#                  d
d             | j$                  j                  t        j                   d	   j#                  d
d             t
        j'                          | j(                  j+                          | j                  j-                          | j/                          y )Nz.Are you sure you wish to delete the theme %r ?zDelete ThemerL   r  r  r  r  r   r  r  r  r6  )r  r   r  r@  r   r   delete_sectionr0   r  r  r  r~  r  r&  r  r   
defaultCfgGetr  r   rx   r   r   r  )r`   r  delmsgr  s       rc   r  zHighPage.delete_custom.  sS   	* %%))+
A}}*!4T  C))+{J7++FK@	  &&}5OO##I/EFOO##Iy|<h11&9==gyQRh11&9==gvNO002'')rd   )r   r   r   rK   rB  rC  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   s   @rc   ry   ry     su    |:|2$h"&	&+ $<8$-L	I	,&P 8 I$& P	P4-rd   ry   c                        e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zed        Zd Zd Z xZS )r|   c                     t         |   |       || _        |j                         | _        | j                          | j                          y r   )r   rK   rx   r?  r@  create_page_keysload_key_cfgrD  s      rc   rK   zKeysPage.__init__`  s?     '')rd   c                 
   	 t         j                  t        |       | j                        | _        t         j                  t        |       | j
                        | _        t         j                  t        |       | j                        | _	        t         j                  t        |       | j                        | _        t        | dt        d      }t        | dt        d      }t        |      }t        |d      }t!        |      }t!        |t"              }t%        |t&        t&              | _        | j(                  j+                  d	| j,                         | j(                  j.                  |d
<   | j(                  j0                  |d
<   |j2                  | j(                  d<   |j2                  | j(                  d<   t5        |d| j6                  d      | _        t;        d      D cg c]  }t        |dd       }}t=        |d   | j                  d| j>                  d      | _         t=        |d   | j                  d| j>                  d      | _!        tE        |d   | j                  d d       | _#        tE        |d   | j                  d d       | _$        t5        |d   d| jJ                        | _&        t5        |d   d| jN                        | _(        t        |d   d      | _)        |jU                  tV        ddtX        tZ               |jU                  tV        ddtZ               | j8                  jU                  tV        t\        dd       |jU                  t^        ddtX        tZ               |ja                  dd       |jc                  dd       |je                  dddtf                | j(                  je                  ddth        !       |je                  ddtj        !       |je                  ddtl        !       | j@                  je                  ddtf        tj        z   !       | jB                  je                  ddtf        tj        z   !       | jF                  je                  ddth        !       | jH                  je                  ddth        !       | jR                  je                  ddth        dd"       | jL                  jU                  t^        t\        d#d$       | jP                  jU                  t^        t\        d#d$       |d   jU                  tn        tZ        d#%       |d   jU                  tn        t\        d#d&       y c c}w )'Nr   z Custom Key Bindings r   z	 Key Set zAction - Key(s)rk   orient)r   r   r   r   r   xscrollcommandzGet New Keys for Selectionr}  )rl   r   r~  r   )rh   r   r   zUse a Built-in Key Setr  zUse a Custom Key Setr   zDelete Custom Key Setr  zSave as New Custom Key Setr  r   r  r   r  r   )r   r   
columnspanrj   r   r   rj   )r   r   rj   r   r   T)rp   rr   rq   r   rp   rr   rq   )rp   rr   rq   r   )8r[   r   r   r  r  r  r  r   var_changed_keyset_sourcekeyset_sourcevar_changed_keybinding
keybindingr"   r   r!   r&   r*   r   r   r
   bindingslistr   on_bindingslist_selectr   xviewr   r#   get_new_keysbutton_new_keysr  r)   set_keys_typebuiltin_keyset_oncustom_keyset_onr3   r  r  delete_custom_keysbutton_delete_custom_keyssave_as_new_key_setbutton_save_custom_keyskeys_messager   r   r	   r   r   r   r   r   ru   r   r   r   r   r   )	r`   r  frame_key_setsframe_targettarget_titlescroll_target_yscroll_target_xiframess	            rc   r  zKeysPage.create_page_keysg  s   P	b $KK$!>!>@";;$!=!=?$[[4 $"@"@B!++$!<!<>
 "!F,. $!FF \*\0AB#L1#LD#uF2#::	<%)%6%6%<%<	"%)%6%6%<%<	".=.A.A*+.=.A.A*+%#?)) =
 !8% qA % %!,q	D$6$6a**1I"K !,q	D$6$6a**1G!I )q	4,,dDB'q	4++T4A)/q	 7//*1& (.q	 <00(2$ "&); 	vAAdNaadC!!vAAA!Ft!!DtL$$Qq$1!!!A!.aaB1Qt<1R81R8##!AbD#A""q1R4"@!Ad;1T:1Qt!!L&&++AdQR+S$$))t!Dq)Qq	Cd48q	Ca1=W%s   $Uc           	         	 | j                   j                  t        j                  ddddd             t        j                         }| j                   j                         rt        j                  dd      }|j                          | j                  j                  ||       t        j                  dd      }|j                          |s7| j                  j                  d	       | j                  j                  d
       n| j                  j                  ||d          nt        j                  dd      }|j                          | j                  j                  ||       t        j                  dd      }|j                          | j                  j                  |t        j                                | j                          t        j                         }| j!                  |       y )Nr  Keysr  r  r   r  r   r  r  - no custom keys -r   )r$  r   r0   r  CurrentKeysr   r  r  r  r&  r.  r~  r  r  default_keysr,  load_keys_list)r`   r  r  keyset_names       rc   r  zKeysPage.load_key_cfg  sz   Ix11	 C 	D "--/!!# //	6BINN$$Y? //?INN%%++M:  $$%9:''	9Q<@ //?INNOO##I~> //	6BINN$$Y0E0E0GH**,K(rd   c                    	 d}| j                   j                         }||vr\t        j                  ddd      |vrt        j                  ddd|d          t        j                  ddd|       d| j                  d<   n?t        j                  ddd|       t        j                  dddd	       d	| j                  d<   | j                  |       y )
N)zIDLE Classic WindowszIDLE Classic UnixzIDLE Classic MaczIDLE Classic OSXr  r<  r6  r   r  zNew key set, see Helprl   r   )r  r   r0   r  r   r/  r3  r@  )r`   r1  old_keysr2  s       rc   r  z!KeysPage.var_changed_builtin_name&  s    /
 !!%%' !!&&&9I""6668A;Gvvw>(?Df%vvvu=vvw;(*Df%E"rd   c                     	 | j                   j                         }|dk7  r*t        j                  ddd|       | j	                  |       y y )Nr=  r  r<  r6  )r  r   r   r/  r@  r0  s      rc   r  z KeysPage.var_changed_custom_name:  sI    .  $$&((vvvu=& )rd   c                     	 | j                   j                         }t        j                  ddd|       |r| j	                          y | j                          y )Nr  r<  r  )r$  r   r   r/  r  r  r0  s      rc   r#  z"KeysPage.var_changed_keyset_sourceA  sH    D""&&(669e<))+((*rd   c                    	 | j                   j                         }| j                  j                         }| j                  j                  t              j                         d   }t        j                  |      rt        j                  d|||       y t        j                  |      }|dz   }t        j                  d|||       y )Nr   r   _cfgBindings
extensions)r&  r   r  r'  r   splitr0   IsCoreBindingr   r/  GetExtnNameForEvent)r`   r1  r2  key_setr7  ext_nameext_keybind_sections          rc   r%  zKeysPage.var_changed_keybindingJ  s    '##%""&&(!!%%f-335a8!!%(vwu=33E:H"*^";|-@%Ord   c                 V   	 | j                   j                         r:d| j                  d<   d| j                  d<   | j                  j                  d       y d| j                  d<   | j                  j                  d       d| j                  d<   | j                  j                  d       y r  )r$  r   r  r  r0  r~  r.  r   s    rc   r,  zKeysPage.set_keys_typeV  s    J!!#(0DW%'1DOOG$**00?(2DW%!!''7'/DOOG$**00@rd   c                    	 | j                   j                  t              }| j                   j                  |      }|j	                         d   }| j
                  j                         r| j                  j                         }n| j                  j                         }t        j                         }|t        d   v r)t        d   |   }|D ]  }||   j	                         ||<    t        |j                               }t        | d||      j                  }	|	r| j
                  j                         r]d}
| j                  |
      }|s7| j                   j!                  |       | j                   j#                  |       y | j%                  |       | j                   j'                  |       | j                   j)                  ||dz   |	z          | j                   j!                  |       | j                   j#                  |       | j*                  j-                  |	       y | j                   j!                  |       | j                   j#                  |       y )Nr   r   zGet New KeyszcYour changes will be saved as a new Custom Key Set. Enter a name for your new Custom Key Set below. - )r'  r   r   r   rI  r$  r  r  r0   GetCurrentKeySetr   rr  valuesr2   r  get_new_keys_namer"  r#  create_new_key_setdeleter   r&  r   )r`   
list_indexbinding	bind_namecurrent_key_set_namecurrent_bindingskey_set_changesr7  current_key_sequencesnew_keysr  
new_keysets               rc   r*  zKeysPage.get_new_keysb  s   	 &&,,V4
##''
3MMOA&	!!##'#4#4#8#8#: #'#3#3#7#7#9 #44676?2%fo.BCO( I*9%*@*F*F*H 'I $%5%<%<%> ? ~y%''-v 	!!%%'N!33G<
!%%00<%%33J?++J7$$Z0$$Z51IJ((4++J7OO)((4++J7rd   c                     	 t        j                  dd      t        j                  dd      z   }t        | d||      j                  }|S )Nr  r   r  zNew Custom Key Setr  )r`   r  r  r_  s       rc   rT  zKeysPage.get_new_keys_name  sO    3--ff=''	6:;
 *GZAAG 	rd   c                 P    	 | j                  d      }|r| j                  |       y y )NzNew Key Set Name:)rT  rU  )r`   new_keys_names     rc   r1  zKeysPage.save_as_new_key_set  s,    J../BC##M2 rd   c                 <    	 | j                   j                  d       y )Nr  )r+  r~  r`   r7  s     rc   r(  zKeysPage.on_bindingslist_select  s    @"">2rd   c                 f   	 | j                   j                         r| j                  j                         }n| j                  j                         }t	        j
                  |      }i }|D ]   }|dd }dj                  ||         }|||<   " |t        d   v rt        d   |   }|D ]
  }||   ||<    | j                  ||       t	        j                  dd      }	|	j                          | j                  j                  |	|       | j                   j                  d       | j                          y )Nr   rp  r   r  r   )r$  r   r  r  r0   GetCoreKeysjoinr   save_new_key_setr  r  r  r&  r   r,  )
r`   new_key_set_nameprev_key_set_name	prev_keysr^  r7  
event_namerX  r\  custom_key_lists
             rc   rU  zKeysPage.create_new_key_set  s2   	
 !!# $ 1 1 5 5 7 $ 0 0 4 4 6(():;	 	+EqJhhy/0G#*HZ 	+
 /%fo.?@O( 9"1%"89 	.9"11&&A1ABq!rd   c                    	 d}| j                   j                         r!d}| j                   j                  t              }t	        j
                  |      }t        |j                               }|j                          | j                   j                  dt               |D ]i  }dj                  ||         }|dd }|t        d   v r|t        d   |   v rt        d   |   |   }| j                   j                  t        |dz   |z          k |rR| j                   j                         | j                   j                  |       | j                   j!                  |       y y )	NFTr   rp  r   rf  r   rQ  )r'  curselectionr   r   r0   	GetKeySetrr  r   r  rV  r   rh  r   r   r!  r"  r#  )r`   rA  reselectrW  keyset
bind_namesrY  r  s           rc   r@  zKeysPage.load_keys_list  s=   	 ))+H**008J##K0&++-(
  C(# 	?I((6),-C!!BIgfo- <<!&/+6yAC$$S)E/#*=>	? !!*-((4++J7 rd   c                     	 t         j                  d   j                  |        |D ]+  }||   }t         j                  d   j                  | ||       - y )Nr   r  )rA  rs  r7  r2  s       rc   ri  zKeysPage.save_new_key_set  sY    	 	 ++K8 	JE5MEV$..{E5I	Jrd   c                 ,    t        j                  |i |S r   r  r  s      rc   r  zKeysPage.askyesno  r  rd   c                    	 | j                   j                         }d}| j                  d||z  |       sy | j                  j	                          t
        j                  d|       t        j                  dd      }|j                          |s8| j                  j                  d       | j                  j                  |d       n| j                  j                  ||d          | j                  j                  t        j                   d	   j#                  d
d             | j$                  j                  t        j                   d	   j#                  d
d      xs t        j&                                t
        j)                          | j*                  j-                          | j                  j/                          | j1                          y )Nz0Are you sure you wish to delete the key set %r ?zDelete Key Setr  r   r  r  r=  r   r  r<  r  r6  )r  r   r  r@  r   r   r  r0   r  r  r.  r~  r  r&  r$  r   r  r  r  r?  r   rx   r   r   r,  )r`   rA  r  r  s       rc   r/  zKeysPage.delete_custom_keys  si   	 &&**,C}} 6K#7  F))+v{3++FF;	!!''6OO##I/CDOO##Iy|<x226: #FI 6	8h11&9==ffM 9!)!6!6!8	: 	002'')rd   )r   r   r   rK   r  r  r  r  r#  r%  r,  r*  rT  r1  r(  rU  r@  staticmethodri  r  r/  r   r   s   @rc   r|   r|   ^  sn    ^>@)>#('+
P
A*8X33<84 J J4 rd   r|   c                   0     e Zd Z fdZd Zd Zd Z xZS )r~   c                     t         |   |       | j                          | j                          | j	                          y r   )r   rK   init_validatorscreate_page_windowsload_windows_cfgr`   r   r   s     rc   rK   zWinPage.__init__  s4       "rd   c                 j    t        j                  d      fd}| j                  |      df| _        y )N[0-9]*c                 ,    	 j                  |       d uS r   	fullmatchr+  digits_or_empty_res    rc   is_digits_or_emptyz3WinPage.init_validators.<locals>.is_digits_or_empty      9%//2$>>rd   %Precompileregisterdigits_onlyr`   r  r  s     @rc   r{  zWinPage.init_validators  0    ZZ	2	? !MM*<=tErd   c                 l   	 t         j                  t        |       d      | _        t         j                  t	        |       d      | _        t         j                  t	        |       d      | _        t         j                  t	        |       d      | _        t         j                  t        |       d      | _	        t         j                  t	        |       d      | _
        t         j                  t	        |       d      | _        t         j                  t	        |       d      | _        t         j                  t        |       d	      | _        t         j                  t	        |       d
      | _        t        | dt         d      }t#        |d      }t%        |d      }t'        || j                  dd      | _        t'        || j                  dd      | _        t#        |d      }t%        |d      }t%        |d      }t-        || j
                  d| j.                  d      | _        t%        |d      }t-        || j                  d| j.                  d      | _        t#        |d      }t%        |d      }		 t5        || j                  ddd| j.                  d      | _        t%        |d"      }
tA        |d#| j                  $      | _!        t#        |d      }t%        |d%      }t-        || j                  d&| j.                  d      | _"        t#        |d      }t%        |d'      }tG        || j                  d(d)d*d(      | _$        t#        |d      }t%        |d+      }t-        || j                  d&| j.                  d      | _%        tA        |d,| j                  $      | _&        t#        |d      }t%        |d-      }t-        || j                  d.| j.                  d      | _'        |jQ                  tR        d/d/tT        tV        0       |jQ                  tR        d/dtX        1       |jQ                  tZ        t\        d/d/2       | j*                  jQ                  t^        t\        d/d/2       | j(                  jQ                  t^        t\        d/d/2       |jQ                  tR        d/dtX        1       |jQ                  tZ        t\        d/d/2       | j2                  jQ                  t^        t`        dd/2       |jQ                  t^        t`        d/3       | j0                  jQ                  t^        t`        dd/2       |jQ                  t^        t`        d/3       |jQ                  tR        d/dtX        1       |	jQ                  tZ        t\        d/4       | j6                  jQ                  tZ        t\        d4       | jB                  jQ                  t^        t`        d5d/2       |jQ                  tR        d/dtX        1       |jQ                  tZ        t\        d/d/2       | jD                  jQ                  tR        dd/6       |jQ                  tR        d/dtX        1       |jQ                  tZ        t\        d/d/2       | jH                  jQ                  tR        dd/6       |jQ                  tR        d/dtX        1       |jQ                  tZ        t\        d/4       | jL                  jQ                  t^        t`        d5d/2       | jJ                  jQ                  tR        t\        d5d/2       |jQ                  tR        d/dtX        1       |jQ                  tZ        t\        d/d/2       | jN                  jQ                  tR        dd/6       y # t8        $ r6 t;        || j                  dt=        t?        dd             d!      | _        Y w xY w)7N)r  Generaleditor-on-startup)r  r	  rI   )r  r	  rH   )r  Indent
num-spaces)r  r	  cursor-blink)rH  r8   	popupwait)rH  r:   rA  )rH  r:   flash-delay)rH  r:   bell)rH  r;   	max-widthr   z Window Preferencesr   r   r  z
At Startuprk   r   zOpen Edit Windowr   r2  rl   zOpen Shell Windowz$Initial Window Size  (in characters)Widthr   r  textvariablerI   validatecommandvalidateHeightzIndent spaces (4 is standard)
   )r  from_torI   r  r  readonly   )r  r~  rS  rI   zCursor BlinkzCursor blink)rl   r   z%Completions Popup Wait (milliseconds)r   zParen Match Style
expressionopenerparensz;Time Match Displayed (milliseconds)
(0 is until next input)zBell on MismatchzFormat Paragraph Max Widthr  r   r  r   r  rp   r   r   r   r   r  )1r[   r   r   startup_editr   	win_width
win_heightindent_spacesr   cursor_blinkautocomplete_waitparen_styleflash_delay
paren_bellformat_widthr"   r   r!   r&   r)   startup_editor_onstartup_shell_onr%   r  win_width_intwin_height_intr,   indent_chooserr    r-   rr  r  r$   cursor_blink_boolauto_wait_intr'   paren_style_typeparen_flash_timebell_onformat_width_intr   r   r	   r   r   r   r   r   r   )r`   frame_window	frame_runstartup_titleframe_win_sizewin_size_titlewin_width_titlewin_height_titleframe_cursorindent_titlecursor_blink_titleframe_autocompleteauto_wait_titleframe_paren1paren_style_titleframe_paren2paren_time_titleframe_formatformat_width_titles                      rc   r|  zWinPage.create_page_windows  s   &	P $KKtFH $!BD!++$!CE$[[$!AC#KK4 "JL!($!L"N";;$!FH";;$!LN!++4 "FH#KK$!OQ "$Af'<> ,A6	il;!,D$5$5Q'") !,D$5$5Q(!* |;%KMW="T^^1 $ 0 05
 !h?#T__A $ 0 05

 \q9\"AC	I") t/A/A!$($4$4u#FD #<nE!,\6:6G6G"I #<Q@ 2%LN""1G1G)9)9EK \q9!,5HI *d..,!0 \q9  $<= !&4+;+;1 $ 0 05!B ##5Q\q9"<(DF %4+<+<A $ 0 05! 	s4dKCaaa8QQQ?""aaa"H##qqq#I111=aaa@  eABQ G5;U12AF%:s;tAA6  d12 >##qr#JSqqqA$qqqASr:s;DC"""1"=s;4:uQRa@""ABQ"Gs;T!!!D"""1"=O  	I"* t/A/A$T%"+->a#ID	Is   4+]4 4;^32^3c                    | j                   j                  t        j                  dddd             | j                  j                  t        j                  dddd             | j
                  j                  t        j                  ddd	d             | j                  j                  t        j                  dd
dd             | j                  j                  t        j                  dddd             | j                  j                  t        j                  dddd             | j                  j                  t        j                  ddd             | j                  j                  t        j                  dddd             | j                  j                  t        j                  ddd             | j                  j                  t        j                  dddd             y )Nr  r  r  r  r5  r	  rI   intrH   r  r  r  rH  r8   r  r:   rA  r  r  r;   r  )r  r   r0   r  r  r  r  r  r  r  r  r  r  r   s    rc   r}  zWinPage.load_windows_cfg  s   h00	#6VE 	F8--e= 	>H..u> 	?x11,U < 	=h00VE 	F""8#5#5nk$G 	HX//lG5 	6X//lMG 	HH..lF4 	5h00/5J 	Krd   )r   r   r   rK   r{  r|  r}  r   r   s   @rc   r~   r~     s     Fh>TKrd   r~   c                   0     e Zd Z fdZd Zd Zd Z xZS )r   c                     t         |   |       | j                          | j                          | j	                          y r   )r   rK   r{  create_page_shedload_shelled_cfgr~  s     rc   rK   zShedPage.__init__  s4     rd   c                 j    t        j                  d      fd}| j                  |      df| _        y )Nr  c                 ,    	 j                  |       d uS r   r  r  s    rc   r  z4ShedPage.init_validators.<locals>.is_digits_or_empty  r  rd   r  r  r  s     @rc   r{  zShedPage.init_validators  r  rd   c                 v   	 t         j                  t        |       d      | _        t         j                  t	        |       d      | _        t         j                  t        |       d      | _        t         j                  t        |       d      | _        t        | dt        d      }t        | dt        d      }t        |d	
      }t        |d      }t        |d| j                  | j                  d      | _        t        |d	
      }t        |d      }t!        || j
                  d	d      | _        t!        || j
                  dd      | _        t        |d	
      }t        |d      }t'        || j                  d      | _        t        |d	
      }	t        |	d      }
t        |	| j                  d| j                  d      | _        |j-                  t.        ddt0               t        |       j-                          |j-                  t.        ddt0               |j-                  t.        dd	t2               |j-                  t4        t6        dd       | j                  j-                  t.        dd       |j-                  t.        dd	t2               |j-                  t4        t6        dd       | j$                  j-                  t8        t6        dd       | j"                  j-                  t8        t6        dd       |j-                  t.        dd	t2               |j-                  t4        t6        dd       | j(                  j-                  t4        dd       |	j-                  t.        dd	t2               |
j-                  t4        t6        dd       | j*                  j-                  t.        dd       y )N)r  PyShellauto-squeeze-min-lines)r  r  autosave)r  r	  line-numbers-default)rH  r9   maxlinesr   z Shell Preferencesr   z Editor Preferencesr   r  zAuto-Squeeze Min. Lines:rk   r  r  )rI   r  r  r  zAt Start of Run (F5)  zPrompt to Saver  r   z	No Promptz Show line numbers in new windows)r   rI   zMax Context Lines :r   r  r   r   r  r  )r[   r   r   auto_squeeze_min_linesr   r  r   line_numbers_defaultcontext_linesr"   r   r!   r&   r%   r  auto_squeeze_min_lines_intr)   save_ask_onsave_auto_onr$   line_numbers_default_boolcontext_intr   r   r   r   r   r   r   )r`   frame_shellframe_editorframe_auto_squeeze_min_linesauto_squeeze_min_lines_title
frame_saverun_save_titleframe_line_numbers_defaultline_numbers_default_titleframe_contextcontext_titles              rc   r  zShedPage.create_page_shed  s;   	< '.kk$!N'P#  t=?$+KK4 @%B! %[[$!JL !1V&:<!$Af'<> (-[a'H$',-I2L(N$*/,A!88 $ 0 05+
' <Q7
z0HI&T]]!%' (T]]! " &+<Q%G"%*&-O&Q")4*22*&
 l:m2GH D,>,>a $ 0 05
 	c=ds>$))s)K$))tAAA)N'',,#AA,FSqqq9aaa@E!!!D5C"''Sqqq'I"''T!!!'L&&++AA+F!!!<QQQ?3QQ7rd   c           	         | j                   j                  t        j                  dddd             | j                  j                  t        j                  ddddd	
             | j
                  j                  t        j                  dddd	             | j                  j                  t        j                  dddd             y )Nr  r  r  r  r  r  r  r   r  )r  r5  r	  r  rH  r9   r  )r  r   r0   r  r  r  r  r   s    rc   r  zShedPage.load_shelled_cfgY  s    ##''(:(:	#;%)I 	J 	(,,	:qvG 	H!!%%h&8&8(>V'M 	Nx11mZe E 	Frd   )r   r   r   rK   r{  r  r  r   r   s   @rc   r   r     s     Ff8P
Frd   r   c                   B     e Zd Z fdZd Zd Zd Zd Zd Zd Z	 xZ
S )rw   c                     t         |   |       t        j                  d   | _        t        j
                  d   | _        | j                  t              | _        | j                          | j                          y )NrH  )r   rK   r0   r  ext_defaultCfgr	  ext_userCfgr  is_intload_extensionscreate_page_extensionsr~  s     rc   rK   zExtPage.__init__g  s^     &11,?#++L9mmF+##%rd   c                    	 t        |       | _        t        | dt        d      }t	        | dt        d      | _        |j                  dd       |j                  dd       t        || j                  d	      | _	        | j                  j                  d
| j                         t        || j                  j                        }|j                  | j                  _        t        |dd      | _        | j                  j#                  ddd       |j#                  ddd       | j                   j#                  dddddg       |j%                  d       i | _        d | _        | | _        | j                  | _        d}t/        | j0                        D ]  }| j3                  |       |dz   |z   dz   }  | j                  j                  |       | j                  j5                  d       | j                  d        |j#                  ddd       t7        |       j#                  dd       | j
                  j#                  ddd       y )Nr   z Feature Extensions r   z Help Menu Extensions r   r   r   browse)listvariable
selectmodez<<ListboxSelect>>r      )rI   rH   nwsr   r   rj   nsr   r  )r   r   rj   r   rg   r   {z} r!  )r   r   sew)r   extension_namesr"   r   	HelpFrame
frame_helpr   r   r   extension_listr   extension_selectedr*   r   r   r   details_frameru   r  config_framecurrent_extension
outerframetabbed_page_setr  rH  create_extension_frameselection_setr&   )r`   	frame_extscroll	ext_namesrM  s        rc   r  zExtPage.create_page_extensionso  s   	.  )t6$:<	#Da$<> 	q+!!!A!.%id>R>R19;  !4d6M6MN9d.A.A.G.GH+1::*'	SI  q ?1!D1qab!WMB'!%#22 	t/ 	:H''1!C(2T9I	: 	  +))!,% 	1Qv6dQq)1U;rd   c           
         	 i | _         t        j                  d      D ]  }g | j                   |<    | j                   D ]  }t        | j                  j                  |            }|D cg c]  }|j                  d      r| }}|D ]  }|j                  |        ||z   }|D ]  }| j                  j                  ||d      }	 ddd|   }d}	 | j                  j                  |||d|	      }t        |       }	|	j                  t        |             | j                   |   j!                  |||||	d
         y c c}w # t        $ r% 	 t        |      }d}n# t        $ r |}d }Y nw xY wY w xY w# t        $ r |}Y w xY w)NF)active_onlyenableT)raw)TrueFalser  r  )r5  r  r  )r6  r5  r  r2  var)rH  r0   GetExtensionsr  r  GetOptionList
startswithremover  KeyErrorr  r%  r  r   r   r  append)
r`   rM  opt_listopt_nameenablesdef_strdef_objopt_typer2  r  s
             rc   r  zExtPage.load_extensions  s   K ..5A 	+H(*DOOH%	+  %	4Hd11??IJH 19 9H"--h7   9G 9# *)*)H$ 4--11 ( 2 6	(&*E:7CG%H$ ,,00$hX4$+ 1 -E
  oE
#)00(:B=D;@9<	23 4-4%	49   (("%g,#(% (")#'(	( " $#E$sN   *E 
E E6	E3EE3E-	*E3,E-	-E32E36FFc                    	 | j                   j                         }|r| j                   j                  |      }||| j                  k7  rV| j                  rJ| j                  j                  d       | j                  | j                     j                          d | _        |rE| j                  j                  |       | j                  |   j                  ddd       || _        y y )Nr   rk   r   r   r   )	r  rp  r   r  r	  r   r
  grid_forgetru   )r`   r7  newsels      rc   r  zExtPage.extension_selected  s    9$$113((,,V4F>Vt'='==%%""))r)2!!$"8"89EEG)-&%%6%2f%**!6*J%+D" rd   c                 (   	 t        | j                  dd      }|| j                  |<   |j                  }t	        | j
                  |         D ]  \  }}t        ||d         }|j                  |dt               |d   }|d   d	k(  r(t        ||d
dd      j                  |dt        d       c|d   dk(  r4t        ||d| j                  dfd      j                  |dt        d       t        ||d      j                  |dt        d        y )Nr  rG   r6  rk   r   r!  r  r5  r  r  r  r  )r   r   r   rI   r      )r   r   rj   r   r  r  r  r  )r  r  r  rI   r   )r  rI   )VerticalScrolledFramer	  r
  interior	enumeraterH  r&   ru   r   r$   r   r%   r  r   )r`   rM  f
entry_arear   optlabelr  s           rc   r  zExtPage.create_extension_frame  s   K!$"4"4SL&'(#ZZ
!$//(";< 	EHC*3v;7EJJ3qJ4e*C6{f$J$*WA"ds1QQdGV%jsU'+{{D&9Qt!D js" Qt!D#	E$ 	rd   c                    	 |d   }|d   }|d   j                         j                         xs |}|d   j                  |       ||k(  r| j                  j	                  ||      S | j                  j                  |||      S )Nr6  r  r  )r   r   r   r  RemoveOptionr  )r`   sectionr0  r6  r  r2  s         rc   set_extension_valuezExtPage.set_extension_value  s    	
 6{i.E
 &&(3GE
u W##00$??))'4??rd   c                     	 d}| j                   D ]-  }| j                   |   }|D ]  }| j                  ||      sd} / |r| j                  j                          y y )NFT)rH  r5  r  Save)r`   has_changesrM  optionsr0  s        rc   r   z#ExtPage.save_all_changed_extensions  so    	  	'Hooh/G '++Hc:"&K'	'
 !!# rd   )r   r   r   rK   r  r  r  r  r5  r   r   r   s   @rc   rw   rw   f  s)    &=<~,4\,4@"$rd   rw   c                   N     e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Z xZS )
r  c                 f    t        |   |fi | | j                          | j                          y r   )r   rK   create_frame_helpload_helplist)r`   r   cfgr   s      rc   rK   zHelpFrame.__init__+  s-    '3' rd   c                    	 t        |       }t        |ddt              | _        t	        |      }| j                  j
                  |d<   |j                  | j                  d<   | j                  j                  d| j                         t        |       }t        |ddd	| j                  
      | _        t        |dd	| j                        | _        t        |ddd	| j                  
      | _        |j!                  t"        ddt$        t&               | j                  j!                  t"        t(        t$        t&               |j!                  t*        t,        t.               |j!                  t*        ddt.               | j                  j!                  t0        t,        d       | j                  j!                  t0        t,               | j                  j!                  t0        t,        d       y )Nr   Tr   r   r   r   Editr}  r  )rl   r~  rI   r   Add)rl   rI   r   Remover  )rp   r   rq   rr   )rp   r   rr   r   r  r   )r!   r   r
   helplistr*   r   r   r   help_source_selectedr#   helplist_item_editbutton_helplist_edithelplist_item_addbutton_helplist_addhelplist_item_removebutton_helplist_remover   r   r	   r   r   r   r   r   r   )r`   frame_helplistscroll_helplistframe_buttonss       rc   r<  zHelpFrame.create_frame_help0  s   	( tqD %' $N3%)]]%8%8	"*9*=*=&'.0I0IJd$*F*!8!8%:! $*E!7!7$9  '-HJ!:!:'<#
 	AAdNQt$G%:AAA>!!&&C&B  %%3q%9##((c!!(Drd   c                 &    	 | j                          y r   )set_add_delete_staterd  s     rc   rD  zHelpFrame.help_source_selectedb  s    5!!#rd   c                    	 | j                   j                         dk  r7| j                  j                  d       | j                  j                  d       y | j                   j                         r7| j                  j                  d       | j                  j                  d       y | j                  j                  d       | j                  j                  d       y )Nr   r  r  )rC  sizerF  r~  rJ  rp  r   s    rc   rO  zHelpFrame.set_add_delete_statef  s    K==!#%%++M:''--m<}}))+))//?++11.A))//>++11-@rd   c                     	 t        | d      j                  }|rO| j                  j                  |       | j                  j                  t        |d          | j                          y y )NzNew Help Sourcer   )r6   r  user_helplistr  rC  r   r   update_help_changes)r`   help_sources     rc   rG  zHelpFrame.helplist_item_adds  s\    	
 !'89@@%%k2MM  k!n5$$& rd   c                    	 | j                   j                  t              }| j                  |   }t	        | d|d   |d         j
                  }|rp||k7  rj|| j                  |<   | j                   j                  |       | j                   j                  ||d          | j                          | j                          y y y )NzEdit Help Sourcer   r   )menuitemfilepath)
rC  r   r   rS  r6   r  rV  r   rT  rO  )r`   
item_indexrU  new_help_sources       rc   rE  zHelpFrame.helplist_item_edit  s    	
 ]]((0
((4$($Q$Q &	 	
 +=-<Dz*MM  ,MM  _Q-?@$$&%%'  >?rd   c                     	 | j                   j                  t              }| j                  |= | j                   j	                  |       | j                          | j                          y r   )rC  r   r   rS  rV  rT  rO  )r`   rY  s     rc   rI  zHelpFrame.helplist_item_remove  sU    	 ]]((0
z*Z(  "!!#rd   c                     	 i t         d   d<   t        dt        | j                        dz         D ]E  }t         j	                  ddt        |      dj                  | j                  |dz
     d d              G y )Nr  	HelpFilesr   ;r   )r   r  r  rS  r/  r  rh  )r`   nums     rc   rT  zHelpFrame.update_help_changes  st    <')$C 2 23a78 	=CKSHHT//A6r:;=	=rd   c                     t        j                         | _        | j                  j	                  dd       | j                  D ]%  }| j                  j                  t        |d          ' | j                          y )Nr   r   )r0   GetAllExtraHelpSourcesListrS  rC  rV  r   r   rO  )r`   	help_items     rc   r=  zHelpFrame.load_helplist  s`    %@@BQ&++ 	4IMM  il3	4!!#rd   )r   r   r   rK   r<  rD  rO  rG  rE  rI  rT  r=  r   r   s   @rc   r  r  )  s3    
0Ed$A
'((	$=$rd   r  c                   <    e Zd Z	 d Zd Zd Zed        Zd Zd Z	y)VarTracec                 "    	 g | _         g | _        y r   )untracedtracedr   s    rc   rK   zVarTrace.__init__  s    	 rd   c                 n    	 | j                   j                          | j                  j                          y r   )rf  r   rg  r   s    rc   r   zVarTrace.clear  s%    "rd   c                     	 t        |t              r| j                  ||      }| j                  j	                  ||f       |S r   )
isinstancetuplemake_callbackrf  r  r`   r  callbacks      rc   r   zVarTrace.add  s@    
	 h&))#x8Hc8_-
rd   c                      	  fd}|S )Nc                  R    	 t        j                  g j                           y r   )r   r/  r   )r1  r   r  s    rc   default_callbackz0VarTrace.make_callback.<locals>.default_callback  s"    422	2rd   rg  )r  r   rq  s   `` rc   rl  zVarTrace.make_callback  s    M	3  rd   c                     	 | j                   rZ| j                   j                         \  }}|j                  d|       | j                  j	                  ||f       | j                   rYy y )Nwrite)rf  pop	trace_addrg  r  rm  s      rc   r\   zVarTrace.attach  sO    :mm MM--/MCMM'8,KKX/ mmrd   c                     	 | j                   rn| j                   j                         \  }}|j                  d|j                         d   d          | j                  j                  ||f       | j                   rmy y )Nrs  r   r   )rg  rt  trace_remove
trace_inforf  r  rm  s      rc   detachzVarTrace.detach  s`    +kk KKOO-MCWcnn&6q&9!&<=MM  #x1 kkrd   N)
r   r   r   rK   r   r   rx  rl  r\   ry  rg  rd   rc   rd  rd    s2    ,
"    02rd   rd  a7  When you click either the Apply or Ok buttons, settings in this
dialog that are different from IDLE's default are saved in
a .idlerc directory in your home directory. Except as noted,
these changes apply to all versions of IDLE installed on this
machine. [Cancel] only cancels changes made since the last save.
u  
Font sample: This shows what a selection of Basic Multilingual Plane
unicode characters look like for the current font selection.  If the
selected font does not define a character, Tk attempts to find another
font that does.  Substitute glyphs depend on what is available on a
particular system and will not necessarily have the same size as the
font selected.  Line contains 20 characters up to Devanagari, 14 for
Tamil, and 10 for East Asia.

Hebrew and Arabic letters should display right to left, starting with
alef, א and ا.  Arabic digits display left to right.  The
Devanagari and Tamil lines start with digits.  The East Asian lines
are Chinese digits, Chinese Hanzi, Korean Hangul, and Japanese
Hiragana and Katakana.

You can edit the font sample. Changes remain until IDLE is closed.
z
Highlighting:
The IDLE Dark color theme is new in October 2015.  It can only
be used with older IDLE releases if it is saved as a custom
theme, with a different name.
z
Keys:
The IDLE Modern Unix key set is new in June 2016.  It can only
be used with older IDLE releases if it is saved as a custom
key set, with a different name.
a_  
General:

AutoComplete: Popupwait is milliseconds to wait after key char, without
cursor movement, before popping up completion box.  Key char is '.' after
identifier or a '/' (or '\' on Windows) within a string.

FormatParagraph: Max-width is max chars in lines after re-formatting.
Use with paragraphs in both strings and comment blocks.

ParenMatch: Style indicates what is highlighted when closer is entered:
'opener' - opener '({[' corresponding to closer; 'parens' - both chars;
'expression' (default) - also everything in between.  Flash-delay is how
long to highlight if cursor is not moved (0 means forever).

CodeContext: Maxlines is the maximum number of code context lines to
display when Code Context is turned on for an editor window.

Shell Preferences: Auto-Squeeze Min. Lines is the minimum number of lines
of output to automatically "squeeze".
a  
ZzDummy: This extension is provided as an example for how to create and
use an extension.  Enable indicates whether the extension is active or
not; likewise enable_editor and enable_shell indicate which windows it
will be active on.  For this extension, z-text is the text that will be
inserted at or removed from the beginning of the lines of selected text,
or the current line if no selection.
)z
Fonts/Tabsrm   r<  r  rn   c                 B    	 | sy	 t        |        y# t        $ r Y yw xY w)NTF)r  r%  )r+  s    rc   r  r  3	  s,    .A s    	c                       e Zd Z	 d Zy)r+  c                 H  	 t        j                  | |g|i | t        | t              }|j	                  t
        t        t               t        | dd|j                  d      j	                  t        t        t               |j                  j                         j                  d       j!                  d       t              x| _        j%                  ddt&              	fd	}j)                  d
|       	fd}j)                  d
|       y )Nr  )rr   rp   rq   r      )r   rd  r   rI   r"  r   )windowr   c                 p    j                         j                         f}j                  d|z         y )Nz	0 0 %s %s)scrollregion)winfo_reqwidthwinfo_reqheightr   )r7  rQ  canvasr,  s     rc   _configure_interiorz;VerticalScrolledFrame.__init__.<locals>._configure_interiorZ	  s2    ++-x/G/G/IJDMM{T'9M:rd   z<Configure>c                     j                         j                         k7  r"j                  j                                y y )N)rI   )r  winfo_widthitemconfigure)r7  r  r,  interior_ids    rc   _configure_canvasz9VerticalScrolledFrame.__init__.<locals>._configure_canvas`	  s?    &&(F,>,>,@@$$[8J8J8L$M Ard   )r!   rK   r*   r   r   r   r   r
   r   r   r   r   r	   r   r   xview_movetoyview_movetor,  create_windowr   r   )
r`   rL   r  kw
vscrollbarr  r  r  r,  r  s
          @@@rc   rK   zVerticalScrolledFrame.__init__E	  s    tV1d1b1 tH5
QU59!'1~~SBD6&,,/ 	AA $)=0**1a*L	; 	m%89	N 	M#45rd   N)r   r   r   rK   rg  rd   rc   r+  r+  >	  s    !rd   r+  __main__)r  z#idlelib.idle_test.test_configdialogr   F)	verbosityexit)run)br  tkinterr   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    tkinter.ttkr!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   tkinter.fontr*  r  r/   idlelib.configr0   r1   idlelib.config_keyr2   idlelib.dynoptionr3   idlelibr4   idlelib.queryr5   r6   idlelib.textviewr7   idlelib.autocompleter8   idlelib.codecontextr9   idlelib.parenmatchr:   idlelib.formatr;   idlelib.squeezerr<   r=   r   r   r?   r   r{   ry   r|   r~   r   rw   r  rd  r[   r   r   r  r+  r   unittestr  idlelib.idle_test.htestr  rg  rd   rc   <module>r     s  
 
J J J J J J J J
, , , , !   2 , +  1 & - + ) * % 0
/[*oB8 BlE <g1u g1TQ
u Q
hnu nbOKe OKdBFu BFJ@$e @$FC$
 C$L:2 :2z *"*g;
|(E (V z	.!%H+ rd   