
    3\hb                    L   	 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           dS dS )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 )ConfigDialog F)_htest_utestc                   	 t          j        | |           || _        |ri |_        |s|                                  |                     |pd           |                                dz   }|                                |sdndz   }|                     d| d|            | 	                                 | 
                    t          t                     |                     |           |                     d| j                   | j        j                                         t$                                           |s>|                                  |                                  |                                  d S d S )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)selfrM   rP   rA   rB   xys          >/opt/python-3.11.14/usr/lib/python3.11/idlelib/configdialog.pyrL   zConfigDialog.__init__1   sx   	 	$''' 	&#%F  	MMOOO

5..///  2%  f$=BB#>k!kkakk""" 	e5111v($+666((*** 	 	MMOOO	 	    c                    	 t          | d          x| _        }| j                            d           t          |          x| _        }t          |          | _        t          || j                  | _        t          || j                  | _
        t          || j                  | _        t          |          | _        t          |          | _        |                    | j
        d           |                    | j        d           |                    | j        d           |                    | j        d	           |                    | j        d
           |                    | j        d           |                                 |                    t(          t*          t,                     |                                                     t0                     d S )N5pxpaddingnwes)stickyz Fonts text
Highlightsz Keys z	 Windows z
 Shell/Ed 
Extensionssideexpandfillrq   )r!   framegridr(   noteExtPageextpageHighPagehighpageFontPagerY   KeysPagekeyspageWinPagewinpageShedPageshedpageaddenable_traversalpackr   r	   r   create_action_buttonsr   )ra   ru   rw   s      rd   rT   zConfigDialog.create_widgets`   s   	" #47777
U
v&&&#E??*	Dt}} t|44 t}55 t|44t}} Y///\222X...K000\222L111		s4d	333""$$))v)66666re   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        |                             t          d
           Kt          |dd                              t                     |                    t                     |S )Nri   )         rh   OkApplyCancelHelp)rm   command	takefocus   )rq   padxr   )rI   borderwidthrt   )r4   isAquaTkr!   ru   buttonsokapplyrX   helpr#   r
   r   r   r   r   )ra   padding_argsouterbuttons_frametxtcmds         rd   r   z"ConfigDialog.create_action_buttons   s-   	" ? 	/ LL%v.Ldj!,,,eQ///47Odj!t{#TY	! 	6 	6HC
 !'} !83!&!8 !8*6!8 !8DLL""1"5555eA1---222<<<'''re   c                 X    	 |                                   |                                  d S N)r   destroyra   s    rd   r   zConfigDialog.ok   s#    8

re   c                     	 |                                   t                                           | j                                         |                                  d S r   )deactivate_current_configchangessave_allry   save_all_changed_extensionsactivate_config_changesr   s    rd   r   zConfigDialog.apply   sU    9&&(((00222$$&&&&&re   c                 b    	 t                                            |                                  d S r   )r   clearr   r   s    rd   rX   zConfigDialog.cancel   s'    	
 	re   c                     | j         j                            dd          a|                                  t                                                       d S )N1.0end)rY   font_samplegetfont_sample_textgrab_releasesuperr   )ra   	__class__s    rd   r   zConfigDialog.destroy   sJ    =488FFre   c           	          	 | j                             | j                                         d                                          }t	          | dt
          t                              |d          z              d S )Nrm   )optionzHelp for IDLE preferencesr@   )rP   contents)rw   tabselectstripr7   help_common
help_pagesr   )ra   pages     rd   r   zConfigDialog.help   s|    	 y}}TY--//}??EEGG$9&z~~dB'?'??	A 	A 	A 	A 	A 	Are   c                 N    	 | j         j        D ]}|                                 d S r   )rM   rN   RemoveKeybindings)ra   instances     rd   r   z&ConfigDialog.deactivate_current_config   s8    =1 	) 	)H&&((((	) 	)re   c                 R   	 | j         j        D ]z}|                                 |                                 |                                 |                                 |                                 |                                 {t          D ]}|	                                 d S r   )
rM   rN   ResetColorizer	ResetFontset_notabs_indentwidthApplyKeybindingsreset_help_menu_entriesupdate_cursor_blinkreloadablesreload)ra   r   klasss      rd   r   z$ConfigDialog.activate_config_changes   s    	
 1 	+ 	+H##%%%   ++---%%''',,...((****  	 	ELLNNNN	 	re   )r@   )__name__
__module____qualname__rL   rT   r   r   r   rX   r   r   r   r   __classcell__r   s   @rd   r?   r?   -   s        -5 - - - - -^$7 $7 $7L& & &P  
' ' '      
A 
A 
A) ) )
      re   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        | _        |                                  |                                  d S r   )r   rL   highlight_samplecreate_page_fontload_font_cfg)ra   masterr{   r   s      rd   rL   zFontPage.__init__  sP        ( 9re   c                 8   	 t                               t          |           | j                  | _        t                               t          |           | j                  | _        t                               t          |           | j                  | _        t          | dt          d          }t          | dt          d          }t          |          }t          |          }t          |t          d          }t          |ddt          	          | _        | j                            d
| j                   | j                            d| j                   | j                            d| j                   t%          |          }|                    | j        j                   | j                            |j                   t          |d          }t-          || j        d           | _        t1          || j        ddd          | _        t5          |          }|j        | _        | j                            t:          dd           | j                            t>          t@                     | !                    dd           | "                    dd           |#                    dddd           |#                    dddddd           |$                    tJ          ddtL                     |$                    tJ          ddtL                     |$                    tJ          tN                     | j        $                    t          tP          tL                     |$                    t          tR                     |$                    t          tN                     | j        $                    t          tN                     | j        $                    t          tN          d !           |$                    tP          tT          "           d S )#Nr   z Shell/Editor Font r   reliefrm   z Font Sample (Editable) zFont Face :)justifyrm      TrI   r   exportselection<ButtonRelease-1>z<KeyRelease-Up>z<KeyRelease-Down>r   )yscrollcommandzSize :rl      r   Bold)variableonvalueoffvaluerm   )wraprJ   rI   weightr   )rowcolumnr   padyr   nsew)r   r   rowspanr   r   rk   rq   r   r   rs   rq   anchorrp   )rq   rs   rD   rq   r   r   )rr   rs   )+r\   r   r   var_changed_font	font_name	font_sizer   	font_boldr"   r   r!   r&   r   r   r
   rZ   bindon_fontlist_selectr*   configyviewsetr3   sizelistr$   bold_toggler=   rm   r   r   insertr   r   columnconfigurerowconfigurerv   r   r   r   r   r	   r   r   )	ra   
frame_fontframe_sampleframe_font_nameframe_font_paramfont_name_titlescroll_fontfont_size_titlefont_sample_frames	            rd   r   zFontPage.create_page_font!  s   $	J !Yt__d6KLL Yt__d6KLL Z%5%5t7LMM  !F%:< < <
!$Af'AC C C  
++ ,,MC C C*.G G G.0GHHH,d.EFFF.0GHHH004=#6777KO<<< 0x@@@%&6MM& 4>AF4 4 4 0==,1T1===%5666 	Qq)))!A&&&Aaaa888a111!' 	 	) 	) 	) 	#AAA>>>3QQQ???#a000T:::d+++$q111Q///4;;;d66666re   c                 2   	 t          j        | dd          }|d                                         }|d         }|d         dk    }t          t	          t          j        |                               }|D ]"}| j                            t          |           #| j
                            |           d |D             }	 |                    |          }| j                            |           | j                            |           | j                            |           | j                            |           n# t           $ r Y nw xY w| j                            d|           | j                            |           |                                  d S )	NmainEditorWindowr   r   r   boldc                 6    g | ]}|                                 S  )lower).0ss     rd   
<listcomp>z*FontPage.load_font_cfg.<locals>.<listcomp>  s     ---!AGGII---re   )78910111213141618202225293440)r0   GetFontr  sortedr   tkfontfamiliesrZ   r   r   r   indexsee
select_setselect_anchoractivate
ValueErrorr   SetMenur   set_samples)	ra   configured_fontr   r   r   fontsfontlc_fontscurrent_font_indexs	            rd   r   zFontPage.load_font_cfgz  s   	 #*4HH#A&,,..	#A&	$Q'/	 s6?4001122 	, 	,DM  d++++9%%%--u---	!)	!:!:M0111M$$%7888M''(:;;;M""#56666 	 	 	D	 	 O'	) 	) 	) 	9%%%s    A=D> >
E
Ec                 t   	 | j                                         }t                              ddd|           | j                                        }t                              ddd|           | j                                        }t                              ddd|           |                                  d S )Nr  r  r-  z	font-sizez	font-bold)r   r   r   
add_optionr   r   r*  ra   paramsvalues      rd   r   zFontPage.var_changed_font  s    	 ""$$6>65AAA""$$6>;FFF""$$6>;FFFre   c                     	 | j                             |j        j        dk    rt          nt
                    }| j                            |                                           d S )N
KeyRelease)	rZ   r   typenamer   r   r   r   r  )ra   eventr-  s      rd   r   zFontPage.on_fontlist_select  s[    	
 }  */\99vG G4::<<(((((re   Nc                     	 | j                                         }| j                                        rt          j        nt          j        }|| j                                        |f}|| j        d<   || j        d<   d S )Nr-  )	r   r   r   r!  BOLDNORMALr   r   r   )ra   r9  r   font_weightnew_fonts        rd   r*  zFontPage.set_samples  sv    	 N&&((	%)^%7%7%9%9Lfkkv}t~1133[A#+ (0f%%%re   r   )
r   r   r   rL   r   r   r   r   r*  r   r   s   @rd   r|   r|     s            W7 W7 W7r     D  ) ) )1 1 1 1 1 1 1 1re   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 )rz   c                    t                                          |           || _        |                                | _        t          |          | _        |                                  |                                  d S r   )	r   rL   ry   winfo_toplevelcdr+   stylecreate_page_highlightload_theme_cfgra   r   ry   r   s      rd   rL   zHighPage.__init__  sl       ''))6]]
""$$$re   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                              t                      j                   _        t                              t                      j                   _        t                      _	        t                              t                      j
                   _        t                              t                      j                   _        t                              t                      j                   _        t!           d!t"          d"#          }t!           d!t"          d$#          }t%          |t&          d%&          }|j        x} _        |                    d'd(d%d%t.          d)t0          *           |                    d+d,            |                    d-d.            d/}|D ]!\  }}|                    t6          ||           "t9          |                    d0t6                                                              }t?          d%|          D ]=}	|                    |	 d1|	t9          tA          |                     d2d3d            > j         D ]+}
|
f fd4	}|!                     j         |
         d5|           ,d6|d7<    j"                            d8d%d9:           tG          |d8;           _$        tG          |          }tK           j$        d< j&        =           _'        tQ           j$         j        d d)>           _)        tU          | j	        d%d? j+        @           _,        tU          | j	        d)dA j+        @           _-         j	        .                    d%           tK          |dB j/        =           _0        tc          |dCD          }tU          | j        d% j2        dEF           _3        tU          | j        d) j2        dGF           _4        tQ          | j        d d H           _5        tQ          | j        d d H           _6        tK          |dI j7        =           _8        tc          |d!J           _9        |:                    tv          dKdKtx          tz          L           |:                    t|          dKdKt~          M            j$        :                    t|          dKdKt~          M           |:                    t|          dKd)N           |:                    t|          dKdKtx          tz          L            j'        :                    t|          tx          t~          dOdPQ            j)        :                    t|          tx          t~          dOdRQ            j,        :                    tv          t          S            j-        :                    t          t          S            j0        :                    t          t~          dKdKT           |:                    t|          t          dKdKU            j3        :                    t|          t          dKV            j4        :                    t|          t          dKd!U            j5        :                    t|          t~          dKdKT            j6        :                    t|          t~          t          dKdKW            j8        :                    t|          t~          dKdKT            j9        :                    t|          t~          dKX           d S )YNzNormal Code or TextnormalzCode ContextcontextzPython KeywordskeywordzPython Definitions
definitionzPython BuiltinsbuiltinzPython CommentscommentzPython StringsstringzSelected Texthilitez
Found TexthitCursorcursorzEditor BreakpointbreakzShell Promptconsolez
Error TexterrorzShell User OutputstdoutzShell User ExceptionstderrzLine Number
linenumberr   z Custom Highlighting r   z Highlighting Theme r   )r   r   )courier   r@   hand2r   )r-  rR  rJ   rI   r   highlightthicknessr   z<Double-Button-1>c                     dS NrS  r
  es    rd   <lambda>z0HighPage.create_page_highlight.<locals>.<lambda>o  s     re   z<B1-Motion>c                     dS r^  r
  r_  s    rd   ra  z0HighPage.create_page_highlight.<locals>.<lambda>p  s    7 re   )")z# Click selects item.rM  
rH  )zcode context sectionrI  rc  )z| cursorrR  rc  )defrJ  ) rH  )funcrK  )z(param):
  rH  )z"Return None."rN  )z

  var0 = rH  )z'string'rN  )z

  var1 = rH  )z
'selected'rO  )z

  var2 = rH  )z'found'rP  )z

  var3 = rH  )listrL  )(rH  )NonerJ  )z)
rH  )z  breakpoint("line")rS  )z

rH  z>>>rT  )z	 3.14**2
rH  )z9.8596rV  rc  rk  )z pri rH  )nrU  )zt(
rH  )SyntaxErrorrW  rc  r   z.0drf  c                 <    j                             |           d S r   )highlight_targetr   )r9  elemra   s     rd   temz+HighPage.create_page_highlight.<locals>.tem  s     %))$/////re   z<ButtonPress-1>disabledstateframe_color_set.TFramesolid)r   r   )rC  zChoose Color for :rm   r   )r\  
Foreground)r   r4  rm   r   
BackgroundzSave as New Custom Themez	Select : rl   za Built-in Themer   r4  r   rm   za Custom Themer   zDelete Custom Themer   r   rq   r   r   rr   rs   r   rq   r   r         )rq   rr   rs   r   r   r   r   rq   rs   r   r   rq   r   r   r   r   )rq   rs   r   r   r   )rq   rs   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_targetrp  r"   r   r=   r   rm   r   	configurer
   r   r   r   r   lenr   
splitlinesrangestrtag_bindrC  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   )ra   frame_customframe_themesample_framerm   string_tagsrN  tagn_lineslinenoelementrr  frame_fg_bg_toggletheme_type_titles   `             rd   rD  zHighPage.create_page_highlight  s   s	h!8 I y	
 !, y y h X % h   I '    #H!" <#& $KK$!>@ @";;$!=? ?&t,,[[$!79 9
#KK4  $"?A A '$!B!D !D
 "$Af'>@ @ @ 1V&<> > > +U; ; ;'3'88t$(!AD 	 	B 	B 	B 			%'8'8999		-!2!23339$ ' 	* 	*KFCKKVS))))dhhuc**557788Aw'' 	& 	&FKK6!3s7||#4#4999999$& & & & * 	J 	JG ' 0 0 0 0 0 0 MM'02CSJ J J J"W
51$+ 	 	- 	- 	-$\9QRRR"<00 &$+?!( !( !( ($d&;T#$& & & !"T->a!4+HJ J J
 !"T->a!4+HJ J J
 	a   "(#=.#0 #0 #0 !;??? +d&7q+2D!F !F !F  +d&7q+2B D  D  D )T.dD D D'T-tTC C C$*"7*%, %, %,! #;A>>> 	t!!DtLLLc:::!!s!CCCSqq999qqD 	 	B 	B 	B""Dqqq"QQQ#dKKK
T!,,,
U1---$$&qqq$III3qqqAAA""AA">>>!!s111!EEE3QQQ???#AaaaHHH!&&Caaa&HHHSqq99999re   c           	      L   	 | j                             t          j        ddddd                     t          j                    }| j                                         rt          j        dd          }|                                 | j        	                    ||           t          j        dd          }|                                 |s5| j
                            d	           | j                            d
           n| j        	                    ||d                    nt          j        dd          }|                                 | j        	                    ||           t          j        dd          }|                                 | j        	                    ||d                    |                                  t          | j                  }| j        	                    ||d                    |                                  |                                  d S )Nr  Themedefaultboolr   r7  r  	highlightuserrs  - no custom themes -r   )r  r   r0   	GetOptionCurrentThemer   GetSectionListsortr  r)  r  rt  r  r  r  rh  r  r  paint_theme_sampleset_highlight_target)ra   current_option	item_listtheme_namess       rd   rE  zHighPage.load_theme_cfg  s   	( 	h0D D D 	E 	E 	E ".00  "" 	> /	;GGINN$$Y??? /DDINN A$**=999 $$%;<<<<''	9Q<@@@@ /DDINNO##I~>>> /	;GGINN$$Y	!===4.//[^<<<!!!!!#####re   c                    	 d}| j                                         }||vrct          j        ddd          |vr#t                              ddd|d                    t                              ddd|           d| j        d<   nDt                              ddd|           t                              dddd	           d	| j        d<   |                                  d S )
N)zIDLE ClassiczIDLE Newr  r  r8  r   name2zNew theme, see Helprm   r@   )r  r   r0   r  r   r1  r  r  )ra   r3  
old_themesr4  s       rd   r  z!HighPage.var_changed_builtin_name  s    	
 2
!%%''
""!&'6::*LL""67FJqMJJJvw???)>Dv&&vw>>>vw<<<)+Dv&!!!!!re   c                     	 | j                                         }|dk    r3t                              ddd|           |                                  d S d S )Nr  r  r  r8  )r  r   r   r1  r  r2  s      rd   r  z HighPage.var_changed_custom_name  sc    	
  $$&&***vw>>>##%%%%% +*re   c                     	 | j                                         }t                              ddd|           |r|                                  d S |                                  d S )Nr  r  r  )r  r   r   r1  r  r  r2  s      rd   r  z!HighPage.var_changed_theme_source  so    	
 !%%''67Iu=== 	+))+++++((*****re   c                 0    	 |                                   d S r   )on_new_color_setra   r3  s     rd   r  zHighPage.var_changed_color*  s    )re   c                 0    	 |                                   d S r   )r  r  s     rd   r  z%HighPage.var_changed_highlight_target.  s    ?!!#####re   c                 *   	 | j                                         r0d| j        d<   d| j        d<   | j                            d           d S d| j        d<   | j                            d           d| j        d<   | j                            d           d S NrH  rt  rs  r  z	!disabled)r  r   r  r  r  rt  r  r   s    rd   r  zHighPage.set_theme_type2  s    	"   "" 	<(0DW%'1DOG$%++M:::::(2DW% &&~666'/DOG$%++N;;;;;re   c                    	 | j                                         }| j                            | j        d         d          }t          j        | d|z   |          \  }}|r||k    r| j                                        rLd}|                     |          }|sd S | 	                    |           | j
                            |           d S | j
                            |           d S d S d S )NrC  
backgroundzPick new color for : )rM   rP   initialcolorz_Your changes will be saved as a new Custom Theme. Enter a name for your new Custom Theme below.)rp  r   rC  lookupr  r.   askcolorr  get_new_theme_name
create_newr  r   )ra   target
prev_color	rgbTupletcolor_stringmessage	new_themes          rd   r  zHighPage.get_colorN  s   	" &**,,Z&&t';G'D'35 5
"."7#:6#A'#) #) #)	<  	-\Z77 $$&& 
-K 33G<<	  1FOOI...JNN<00000
|,,,,,	- 	-77re   c                    	 | j                                         }| j                            d|           | j                                        rdnd}| j        | j                                                 } | j        j        |fi ||i | j	                                        }|dz   |z   }t                              d|||           d S )Nru  r  
foregroundr  -r  )r  r   rC  r  r  r  rp  r   
tag_configr  r   r1  )ra   	new_colorplanesample_elementthemetheme_elements         rd   r  zHighPage.on_new_color_sett  s    >JNN$$	
5)LLL $ 1 5 5 7 7I\,T-B-F-F-H-HI((NNE9;MNNN $$&&&,u4;}iHHHHHre   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)ra   r  
used_namesr  s       rd   r  zHighPage.get_new_theme_name  sR    4-fkBB'	;??@
(':? ??E 	re   c                 d    	 |                      d          }|r|                     |           d S d S )NzNew Theme Name:)r  r  )ra   new_theme_names     rd   r  zHighPage.save_as_new_theme  sG    	 001BCC 	,OON+++++	, 	,re   c                 F   	 | j                                         rd}| j                                        }nd}| j                                        }t	          j        ||          }|t          d         v r#t          d         |         }|D ]}||         ||<   |                     ||           t	          j        dd          }|	                                 | j
                            ||           | j                             d           |                                  d S )Nr  r  r  r   )r  r   r  r  r0   GetThemeDictr   save_newr  r  r  r)  r   r  )ra   r  
theme_type
theme_namer  theme_changesr  custom_theme_lists           rd   r  zHighPage.create_new  s'   	$   "" 	0"J*..00JJJ)--//J)*jAA	---#K0<M( < <%27%;	'""ni000$3FKHH    1>BBBa   re   c                    	 | j                                         dk    rO| j                            d           | j                            d           | j                            d           nN| j                            d           | j                            d           | j                            d           |                                  d S )NrQ  r  r   r  )rp  r   r  rt  r  r  r   set_color_sampler   s    rd   r  zHighPage.set_highlight_target  s    	"  $$&&(22J]+++J]+++!!!$$$$J^,,,J^,,,!!!$$$re   c                 0    	 |                                   d S r   )r  )ra   argss     rd   r  z!HighPage.set_color_sample_binding  s!    	
 	re   c                     	 | j         | j                                                 }| j                                        rdnd}| j                            ||          }| j                            d|           d S )Nr  r  ru  r  )r  rp  r   r  r   tag_cgetrC  r  )ra   r  r  r  s       rd   r  zHighPage.set_color_sample  s|    
	 !$"7";";"="=> $ 1 5 5 7 7I\%..sE::
5%HHHHHre   c                 &   	 | j                                         r| j                                        }n| j                                        }| j        D ]}| j        |         }t          j        ||          }|dk    rt          j        |d          d         |d<   |t          d         v r=t          d         |         }|dz   |v r||dz            |d<   |dz   |v r||dz            |d<    | j        j	        |fi | | 
                                 d S )NrR  rH  r  r  z-foregroundr  z-background)r  r   r  r  r  r0   GetHighlightr   r   r  r  )ra   r  element_titler  colors
theme_dicts         rd   r  zHighPage.paint_theme_sample  sN   	&   "" 	+%))++EE$((**E!0 	@ 	@M)-8G*5'::F(""'/'<x() ())5(7|$ ,,,$[1%8
]*j88+5g6M+NF<(]*j88+5g6M+NF<(,D!,W??????re   c                     	 t           j        d                             |           |D ]1}||         }t           j        d                             |||           2d S )Nr  r0   userCfg
AddSection	SetOption)ra   r  r  r  r4  s        rd   r  zHighPage.save_new  sn    	
 	%00<<< 	P 	PG'NE[)33JOOOO	P 	Pre   c                 $    t          j        |i |S r   r/   askyesnora   r  kwargss      rd   r  zHighPage.askyesno#      "D3F333re   c                    	 | j                                         }d}|                     d||z  |           sd S | j                                         t
                              d|           t          j        dd          }|	                                 |s6| j
                            d           | j                            |d           n!| j                            ||d                    | j                            t          j        d	                             d
d                     | j                            t          j        d	                             d
d                     t
                                           | j                                         | j                                         |                                  d S )Nz.Are you sure you wish to delete the theme %r ?zDelete ThemerM   r  r  r  r  r   r  r  r  r8  )r  r   r  rB  r   r   delete_sectionr0   r  r  r  rt  r  r)  r  r   
defaultCfgGetr  r   ry   r   r   r  )ra   r  delmsgr  s       rd   r  zHighPage.delete_custom'  s   	* %))++
A}}*!4T  C C 	F))+++{J777+FK@@	 	= &&}555O##I/EFFFFO##Iy|<<<h1&9==gyQQRRRh1&9==gvNNOOO00222'')))re   )r   r   r   rL   rD  rE  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   s   @rd   rz   rz     su           }: }: }:~1$ 1$ 1$f" " "&	& 	& 	&+ + +     $ $ $< < <8$- $- $-L	I 	I 	I  	, 	, 	,& & &P     8     I I I$&  &  & P	P 	P 	P4 4 4- - - - - - -re   rz   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                                          |           || _        |                                | _        |                                  |                                  d S r   )r   rL   ry   rA  rB  create_page_keysload_key_cfgrF  s      rd   rL   zKeysPage.__init__Y  s_       ''))re   c                 "   	 t                               t          |           | j                  | _        t                               t          |           | j                  | _        t                               t          |           | j                  | _	        t                               t          |           | j
                  | _        t          | dt          d          }t          | dt          d          t          |          }t          |d          }t!          |          }t!          |t"                    }t%          |t&          t&                    | _        | j                            d	| j                   | j        j        |d
<   | j        j        |d
<   |j        | j        d<   |j        | j        d<   t5          |d| j        d          | _        fd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| j%                  | _&        t5          |d         d| j'                  | _(        t          |d         d          | _)        |*                    tV          ddtX          tZ                     *                    tV          ddtZ                     | j        *                    tV          t\          dd           |*                    t^          ddtX          tZ                     |0                    dd           |1                    dd           |2                    dddtf                      | j        2                    ddth          !           |2                    ddtj          !           |2                    ddtl          !           | j         2                    ddtf          tj          z   !           | j!        2                    ddtf          tj          z   !           | j#        2                    ddth          !           | j$        2                    ddth          !           | j)        2                    ddth          dd"           | j&        *                    t^          t\          d#d$           | j(        *                    t^          t\          d#d$           |d         *                    tn          tZ          d#%           |d         *                    tn          t\          d#d&           d S )'Nr   z Custom Key Bindings r   z	 Key Set zAction - Key(s)rl   orient)r   r   r   r   r   xscrollcommandzGet New Keys for Selectionrs  )rm   r   rt  c                 4    g | ]}t          d d          S )r   r   )ri   r   )r!   )r  iframe_key_setss     rd   r  z-KeysPage.create_page_keys.<locals>.<listcomp>  s8     % % % qAAA % % %re   r   r   zUse a Built-in Key Setrz  zUse a Custom Key Setr   zDelete Custom Key Setrw  zSave as New Custom Key Setr{  r   r|  r   r  r   )r   r   
columnspanrk   r   r   rk   )r   r   rk   r   r   T)rq   rs   rr   r   rq   rs   rr   )rq   rs   rr   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   rv   r   r   r   r   r   )ra   r  frame_targettarget_titlescroll_target_yscroll_target_xframesr  s          @rd   r  zKeysPage.create_page_keys`  sd   P	b $KK$!>@ @";;$!=? ?$[[4  $"@B B!++$!<> >
 "!F,. . . $!FF F F \**\0ABBB#L11#LDDD#uF F F2#:	< 	< 	<%)%6%<	"%)%6%<	".=.A*+.=.A*+%#?) =  =  =% % % % 88% % %!,q	D$6a*1I"K "K "K !,q	D$6a*1G!I !I !I )q	4,dDB B B'q	4+T4A A A)/q	 7/*1 *1 *1& (.q	 <0(2 (2 (2$ "&);;; 	vAAdNNNaadCCC!!vAAA!FFFt!!DtLLL$$Qq$111!!!A!...aaBBB1Qt<<<1R8881R888##!AbD#AAA""q1R4"@@@!Ad;;;1T:::1Qt!!LLL&++AdQR+SSS$))t!Dq)QQQq	Cd4888q	Ca1=====re   c           	         	 | j                             t          j        ddddd                     t          j                    }| j                                         rt          j        dd          }|                                 | j        	                    ||           t          j        dd          }|                                 |s5| j
                            d	           | j                            d
           n| j        	                    ||d                    nt          j        dd          }|                                 | j        	                    ||           t          j        dd          }|                                 | j        	                    |t          j                               |                                  t          j                    }|                     |           d S )Nr  Keysr  r  r   r  keysr  r  - no custom keys -r   )r  r   r0   r  CurrentKeysr   r  r  r  r)  r%  rt  r  r  default_keysr#  load_keys_list)ra   r  r  keyset_names       rd   r  zKeysPage.load_key_cfg   s   Ix1	 C  C  C 	D 	D 	D "-//!!## 	I /	6BBINN$$Y??? /??INN A%++M::: $$%9::::''	9Q<@@@@ /??INNO##I~>>> /	6BBINN$$Y0E0G0GHHH*,,K(((((re   c                    	 d}| j                                         }||vrct          j        ddd          |vr#t                              ddd|d                    t                              ddd|           d| j        d<   nDt                              ddd|           t                              dddd	           d	| j        d<   |                     |           d S )
N)zIDLE Classic WindowszIDLE Classic UnixzIDLE Classic MaczIDLE Classic OSXr  r1  r8  r   r  zNew key set, see Helprm   r@   )r  r   r0   r  r   r1  r*  r6  )ra   r3  old_keysr4  s       rd   r  z!KeysPage.var_changed_builtin_name  s    /
 !%%''  !&&&99II""6668A;GGGvvw>>>(?Df%%vvvu===vvw;;;(*Df%E"""""re   c                     	 | j                                         }|dk    r4t                              ddd|           |                     |           d S d S )Nr3  r  r1  r8  )r  r   r   r1  r6  r2  s      rd   r  z KeysPage.var_changed_custom_name3  sa    . $$&&(((vvvu===&&&&& )(re   c                     	 | j                                         }t                              ddd|           |r|                                  d S |                                  d S )Nr  r1  r  )r  r   r   r1  r  r  r2  s      rd   r  z"KeysPage.var_changed_keyset_source:  sk    D"&&((669e<<< 	+))+++++((*****re   c                    	 | j                                         }| j                                        }| j                            t                                                    d         }t          j        |          rt          	                    d|||           d S t          j
        |          }|dz   }t          	                    d|||           d S )Nr   r2  _cfgBindings
extensions)r  r   r  r  r   splitr0   IsCoreBindingr   r1  GetExtnNameForEvent)ra   r3  r4  key_setr9  ext_nameext_keybind_sections          rd   r  zKeysPage.var_changed_keybindingC  s    '##%%"&&((!%%f--3355a8!%(( 	Pvwu=====3E::H"*^";|-@%OOOOOre   c                 *   	 | j                                         r0d| j        d<   d| j        d<   | j                            d           d S d| j        d<   | j                            d           d| j        d<   | j                            d           d S r  )r  r   r  r  r'  rt  r%  r   s    rd   r#  zKeysPage.set_keys_typeO  s    J!!## 	A(0DW%'1DOG$*00?????(2DW%!''777'/DOG$*00@@@@@re   c                    	 | j                             t                    }| j                             |          }|                                d         }| j                                        r| j                                        }n| j                                        }t          j	                    }|t          d         v r5t          d         |         }|D ]}||                                         ||<    t          |                                          }t          | d||          j        }	|	r| j                                        rdd}
|                     |
          }|s6| j                             |           | j                             |           d S |                     |           | j                             |           | j                             ||dz   |	z              | j                             |           | j                             |           | j                            |	           d S | j                             |           | j                             |           d S )Nr   r2  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   r?  r  r  r  r0   GetCurrentKeySetr   rh  valuesr2   r  get_new_keys_namer%  r&  create_new_key_setdeleter   r  r   )ra   
list_indexbinding	bind_namecurrent_key_set_namecurrent_bindingskey_set_changesr9  current_key_sequencesnew_keysr  
new_keysets               rd   r!  zKeysPage.get_new_keys[  sa   	 &,,V44
#''
33MMOOA&	!!## 	:#'#4#8#8#:#:  #'#3#7#7#9#9 #46676?22%fo.BCO( I I*9%*@*F*F*H*H '' $%5%<%<%>%> ? ? ~y%' ''- 	 	8!%%'' 	8N!33G<<
! 8%00<<<%33J???F++J777$$Z000$$Z51IJJJ((444++J777O)))))((444++J77777re   c                     	 t          j        dd          t          j        dd          z   }t          | d||          j        }|S )Nr  r2  r  zNew Custom Key Setr  )ra   r  r  rU  s       rd   rJ  zKeysPage.get_new_keys_name  sS    3-ff=='	6::;
 *GZA AAG 	re   c                 d    	 |                      d          }|r|                     |           d S d S )NzNew Key Set Name:)rJ  rK  )ra   new_keys_names     rd   r(  zKeysPage.save_as_new_key_set  sE    J../BCC 	3##M22222	3 	3re   c                 <    	 | j                             d           d S )Nr  )r"  rt  ra   r9  s     rd   r  zKeysPage.on_bindingslist_select  s"    @"">22222re   c                    	 | j                                         r| j                                        }n| j                                        }t	          j        |          }i }|D ],}|dd         }d                    ||                   }|||<   -|t          d         v r#t          d         |         }|D ]}||         ||<   |                     ||           t	          j	        dd          }	|	
                                 | j                            |	|           | j                             d           |                                  d S )Nr   rf  r2  r  r   )r  r   r  r  r0   GetCoreKeysjoinr   save_new_key_setr  r  r  r)  r   r#  )
ra   new_key_set_nameprev_key_set_name	prev_keysrT  r9  
event_namerN  rR  custom_key_lists
             rd   rK  zKeysPage.create_new_key_set  sb   	
 !!## 	7 $ 1 5 5 7 7 $ 0 4 4 6 6():;;	 	+ 	+EqtJhhy/00G#*HZ  //%fo.?@O( 9 9"1%"8.999"1&&AA1ABBBq!!!re   c                    	 d}| j                                         r!d}| j                             t                    }t	          j        |          }t          |          }|                                 | j                             dt                     |D ]}d
                    ||                   }|dd         }|t          d         v r.|t          d         |         v rt          d         |         |         }| j                             t          |dz   |z              |rP| j                             |           | j                             |           | j                             |           d S d S )	NFTr   rf  r   r\  r2  rG  )r  curselectionr#  r   r0   	GetKeySetrh  r  rL  r   r^  r   r   r$  r%  r&  )ra   r7  reselectrM  keyset
bind_namesrO  keys           rd   r6  zKeysPage.load_keys_list  sn   	 ))++ 	9H*0088J#K00&\\
  C(((# 	? 	?I((6),--C!!B$Igfo-- <<<!&/+6yAC$$S)E/#*=>>>> 	8!!*---((444++J77777	8 	8re   c                     	 t           j        d                             |            |D ]1}||         }t           j        d                             | ||           2d S )Nr2  r  )r7  ri  r9  r4  s       rd   r_  zKeysPage.save_new_key_set  sn    	 	 ++K888 	J 	JE5MEV$..{E5IIII	J 	Jre   c                 $    t          j        |i |S r   r  r  s      rd   r  zKeysPage.askyesno  r  re   c                    	 | j                                         }d}|                     d||z  |           sd S | j                                         t
                              d|           t          j        dd          }|	                                 |s6| j
                            d           | j                            |d           n!| j                            ||d                    | j                            t          j        d	                             d
d                     | j                            t          j        d	                             d
d          pt          j                               t
                                           | j                                         | j                                         |                                  d S )Nz0Are you sure you wish to delete the key set %r ?zDelete Key Setr  r2  r  r  r3  r   r  r1  r  r8  )r  r   r  rB  r   r   r  r0   r  r  r%  rt  r  r)  r  r   r	  r
  r  r5  r   ry   r   r   r#  )ra   r7  r  r  s       rd   r&  zKeysPage.delete_custom_keys  s   	 &**,,C}} 6K#7  F F 	F))+++v{333+FF;;	 	=!''666O##I/CDDDDO##Iy|<<<x26: #FI 6 6	8 	8 	8h1&9==ffMM 9!)!6!8!8	: 	: 	: 	00222'')))re   )r   r   r   rL   r  r  r  r  r  r  r#  r!  rJ  r(  r  rK  r6  staticmethodr_  r  r&  r   r   s   @rd   r}   r}   W  sB           ^> ^> ^>@) ) )># # #(' ' '+ + +
P 
P 
P
A 
A 
A*8 *8 *8X  3 3 33 3 3  <8 8 86 J J \J4 4 4             re   r}   c                   0     e Zd Z fdZd Zd Zd Z xZS )r   c                     t                                          |           |                                  |                                  |                                  d S r   )r   rL   init_validatorscreate_page_windowsload_windows_cfgra   r   r   s     rd   rL   zWinPage.__init__  sW         """re   c                 r    t          j        d          fd}|                     |          df| _        d S )N[0-9]*c                 4    	                      |           d uS r   	fullmatchr  digits_or_empty_res    rd   is_digits_or_emptyz3WinPage.init_validators.<locals>.is_digits_or_empty      9%//22$>>re   %Precompileregisterdigits_onlyra   r}  r|  s     @rd   rr  zWinPage.init_validators  N    Z	22	? 	? 	? 	? 	? !MM*<==tEre   c                 P   	 t                               t          |           d          | _        t                               t	          |           d          | _        t                               t	          |           d          | _        t                               t	          |           d          | _        t                               t          |           d          | _	        t                               t	          |           d          | _
        t                               t	          |           d          | _        t                               t	          |           d          | _        t                               t          |           d	          | _        t                               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          | _        nI# t8          $ r< t;          || j        dt=          t?          dd                     d!          | _        Y nw xY w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          | _'        |(                    tR          d/d/tT          tV          0           |(                    tR          d/dtX          1           |(                    tZ          t\          d/d/2           | j        (                    t^          t\          d/d/2           | j        (                    t^          t\          d/d/2           |(                    tR          d/dtX          1           |(                    tZ          t\          d/d/2           | j        (                    t^          t`          dd/2           |(                    t^          t`          d/3           | j        (                    t^          t`          dd/2           |(                    t^          t`          d/3           |(                    tR          d/dtX          1           |	(                    tZ          t\          d/4           | j        (                    tZ          t\          d4           | j!        (                    t^          t`          d5d/2           |(                    tR          d/dtX          1           |(                    tZ          t\          d/d/2           | j"        (                    tR          dd/6           |(                    tR          d/dtX          1           |(                    tZ          t\          d/d/2           | j$        (                    tR          dd/6           |(                    tR          d/dtX          1           |(                    tZ          t\          d/4           | j&        (                    t^          t`          d5d/2           | j%        (                    tR          t\          d5d/2           |(                    tR          d/dtX          1           |(                    tZ          t\          d/d/2           | j'        (                    tR          dd/6           d S )7N)r  Generaleditor-on-startup)r  r  rJ   )r  r  rI   )r  Indent
num-spaces)r  r  cursor-blink)r>  r8   	popupwait)r>  r:   rC  )r>  r:   flash-delay)r>  r:   bell)r>  r;   	max-widthr   z Window Preferencesr   r   r{  z
At Startuprl   r   zOpen Edit Windowr   r4  rm   zOpen Shell Windowz$Initial Window Size  (in characters)Widthr   rk  textvariablerJ   validatecommandvalidateHeightzIndent spaces (4 is standard)
   )r  from_torJ   r  r  readonly   )r  rt  rI  rJ   zCursor BlinkzCursor blink)rm   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  rq   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-   rh  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   )ra   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                      rd   rs  zWinPage.create_page_windows  su   &	P $KKtFH H $!BD D!++$!CE E$[[$!AC C#KK4  "JL L!($!L"N "N";;$!FH H";;$!LN N!++4  "FH H#KK$!OQ Q "$Af'<> > > ,A666	il;;;!,D$5Q'") ") ") !,D$5Q(!* !* !* |;;;%KM M MW==="T^1 $ 05
 
 
 !h???#T_A $ 05
 
 

 \q999\"AC C C	I") t/A!$($4u#F #F #FD  	I 	I 	I"* t/A$T%"++->->a#I #I #ID	I #<nEEE!,\6:6G"I "I "I #<Q@@@ 2%LN N N""1G)9EK K K \q999!,5HIII *d.,!0 !0 \q999  $<= = = !&4+;1 $ 05!B !B !B ##5Q Q Q\q999"<(DF F F %4+<A $ 05! ! ! 	s4dKKKCaaa888QQQ???""aaa"HHH##qqq#III111===aaa@@@  eABQ GGG5;;;U12AFFF%:::s;;;tAA666  d12 >>>##qr#JJJSqqqAAA$qqqAAASr:::s;;;DCCC"""1"===s;;;4:::uQRa@@@""ABQ"GGGs;;;T!!!DDD"""1"=====s   %%L AMMc                    | j                             t          j        dddd                     | j                            t          j        dddd                     | j                            t          j        ddd	d                     | j                            t          j        dd
dd                     | j                            t          j        dddd                     | j                            t          j        dddd                     | j	                            t          j        ddd                     | j
                            t          j        dddd                     | j                            t          j        ddd                     | j                            t          j        dddd                     d S )Nr  r  r  r  r7  r  rJ   intrI   r  r  r  r>  r8   r  r:   rC  r  r  r;   r  )r  r   r0   r  r  r  r  r  r  r  r  r  r  r   s    rd   rt  zWinPage.load_windows_cfg  sM   h0	#6VE E E 	F 	F 	F8-e= = = 	> 	> 	>H.u> > > 	? 	? 	?x1,U <  <  < 	= 	= 	=h0VE E E 	F 	F 	F""8#5nk$G $G $G 	H 	H 	HX/lG5 5 	6 	6 	6X/lMG G G 	H 	H 	HH.lF4 4 	5 	5 	5h0/5J J J 	K 	K 	K 	K 	Kre   )r   r   r   rL   rr  rs  rt  r   r   s   @rd   r   r   	  ss                 F F Fh> h> h>TK K K K K K Kre   r   c                   0     e Zd Z fdZd Zd Zd Z xZS )r   c                     t                                          |           |                                  |                                  |                                  d S r   )r   rL   rr  create_page_shedload_shelled_cfgru  s     rd   rL   zShedPage.__init__  sW       re   c                 r    t          j        d          fd}|                     |          df| _        d S )Nrw  c                 4    	                      |           d uS r   ry  r{  s    rd   r}  z4ShedPage.init_validators.<locals>.is_digits_or_empty  r~  re   r  r  r  s     @rd   rr  zShedPage.init_validators  r  re   c                    	 t                               t          |           d          | _        t                               t	          |           d          | _        t                               t          |           d          | _        t                               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          | _        |                    t.          ddt0                     t          |                                            |                    t.          ddt0                     |                    t.          dd	t2                     |                    t4          t6          dd           | j                            t.          dd           |                    t.          dd	t2                     |                    t4          t6          dd           | j                            t8          t6          dd           | j                            t8          t6          dd           |                    t.          dd	t2                     |                    t4          t6          dd           | j                            t4          dd           |	                    t.          dd	t2                     |
                    t4          t6          dd           | j                            t.          dd           d S )N)r  PyShellauto-squeeze-min-lines)r  r  autosave)r  r  line-numbers-default)r>  r9   maxlinesr   z Shell Preferencesr   z Editor Preferencesr   r{  zAuto-Squeeze Min. Lines:rl   r  rk  )rJ   r  r  r  zAt Start of Run (F5)  zPrompt to Saver  r   z	No Promptz Show line numbers in new windows)r   rJ   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   )ra   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              rd   r  zShedPage.create_page_shed  s#   	< '.kk$!N'P 'P#  t=? ?$+KK4  @%B %B! %[[$!JL L !1V&:< < <!$Af'<> > > (-[a'H'H'H$',-I2L(N (N (N$*/,A!8 $ 05+
 +
 +
' <Q777
z0HIII&T]!%' ' ' (T]! " " " &+<Q%G%G%G"%*&-O&Q &Q &Q")4*2* * *&
 l:::m2GHHH D,>a $ 05
 
 
 	c===ds>>>$))s)KKK$))tAAA)NNN',,#AA,FFFSqqq999aaa@@@E!!!DDD5CCC"''Sqqq'III"''T!!!'LLL&++AA+FFF!!!<<<QQQ???3QQ77777re   c           	         | j                             t          j        dddd                     | j                            t          j        ddddd	
                     | j                            t          j        dddd	                     | j                            t          j        dddd                     d S )Nr  r  r  r  r  r  r  r   r  )r  r7  r  r  r>  r9   r  )r  r   r0   r  r  r  r  r   s    rd   r  zShedPage.load_shelled_cfgS  s   #''(:	#;%)I )I )I 	J 	J 	J 	(,	:qvG G G 	H 	H 	H!%%h&8(>V'M 'M 'M 	N 	N 	Nx1mZe E  E  E 	F 	F 	F 	F 	Fre   )r   r   r   rL   rr  r  r  r   r   s   @rd   r   r     ss                 F F Ff8 f8 f8P
F 
F 
F 
F 
F 
F 
Fre   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 )rx   c                 4   t                                          |           t          j        d         | _        t          j        d         | _        |                     t                    | _        | 	                                 | 
                                 d S )Nr>  )r   rL   r0   r	  ext_defaultCfgr  ext_userCfgr  is_intload_extensionscreate_page_extensionsru  s     rd   rL   zExtPage.__init__a  sx       &1,?#+L9mmF++##%%%%%re   c                    	 t          |           | _        t          | dt          d          }t	          | dt          d          | _        |                    dd           |                    dd           t          || j        d	          | _	        | j	        
                    d
| j                   t          || j	        j                  }|j        | j	        _        t          |dd          | _        | j	                            ddd           |                    ddd           | j                            dddddg           |                    d           i | _        d | _        | | _        | j	        | _        d}t/          | j                  D ]"}|                     |           |dz   |z   dz   }#| j                            |           | j	                            d           |                     d            |                    ddd           t7          |                               dd           | j                            ddd           d S )Nr   z Feature Extensions r   z Help Menu Extensions r   r   r   browse)listvariable
selectmodez<<ListboxSelect>>r      )rJ   rI   nwsr   r   rk   nsr   r  )r   r   rk   r   rh   r@   {z} r  )r   r   sew)r   extension_namesr"   r   	HelpFrame
frame_helpr   r   r   extension_listr   extension_selectedr*   r   r   r   details_framerv   r  config_framecurrent_extension
outerframetabbed_page_setr   r>  create_extension_frameselection_setr&   )ra   	frame_extscroll	ext_namesrC  s        rd   r  zExtPage.create_page_extensionsi  s{   	.  )t6$:< < <	#Da$<> > > 	q+++!!!A!...%id>R19; ; ;  !4d6MNNN9d.A.GHHH+1:*'	SIII  q ???1!D111qab!WMMMB'''!%#2 	t// 	: 	:H''111!C(2T9II  +++))!,,,%%% 	1Qv666dQq)))1U;;;;;re   c           
         	 i | _         t          j        d          D ]}g | j         |<   | j         D ]G}t          | j                            |                    }d |D             }|D ]}|                    |           ||z   }|D ]}| j                            ||d          }	 ddd|         }d}n7# t          $ r* 	 t          |          }d}n# t          $ r |}d }Y nw xY wY nw xY w	 | j                            |||d|	          }n# t          $ r |}Y nw xY wt          |           }	|	                    t          |                     | j         |                             |||||	d
           Id S )NF)active_onlyc                 <    g | ]}|                     d           |S )enable)
startswith)r  opt_names     rd   r  z+ExtPage.load_extensions.<locals>.<listcomp>  s:     9 9 9H"--h779x 9 9 9re   T)raw)TrueFalser  r  )r7  r  r  )r8  r7  r  r4  var)r>  r0   GetExtensionsr   r  GetOptionListremover
  KeyErrorr  r(  r  r   r   r  append)
ra   rC  opt_listenablesr  def_strdef_objopt_typer4  r  s
             rd   r  zExtPage.load_extensions  s$   K .5AAA 	+ 	+H(*DOH%% %	4 %	4Hd1??IIJJH9 9 9 9 9G# * *)))))H$ 4 4-11 ( 2 6 6	(&*E::7CG%HH ( ( (("%g,,#(% ( ( (")#'(	($ ,00$hX4$+ 1 - -EE " $ $ $#EEE$ooE

###)00(:B=D;@9<	23 23 4 4 4 4-4%	4 %	4sH   )B77
C+CC+C%	"C+$C%	%C+*C+/DDDc                    	 | j                                         }|r| j                             |          }||| j        k    rM| j        rF| j                            d           | j        | j                                                  d | _        |rG| j                            |           | j        |                             ddd           || _        d S d S )Nr@   rl   r   r   r  )	r  rf  r   r  r   r   r  grid_forgetrv   )ra   r9  newsels      rd   r  zExtPage.extension_selected  s    9$1133 	5(,,V44F>Vt'===% ."))r)222!$"89EEGGG)-& 	,%%6%222f%**!6*JJJ%+D"""	, 	,re   c                 n   	 t          | j        dd          }|| j        |<   |j        }t	          | j        |                   D ]\  }}t          ||d                   }|                    |dt                     |d         }|d         d	k    r1t          ||d
dd                              |dt          d           ~|d         dk    r8t          ||d| j        dfd                              |dt          d           t          ||d                              |dt          d           d S )Nr  rH   r8  rl   r   r  r  r7  r  r  r  r~  )r   r   r   rJ   r      )r   r   rk   r   r  rk  r  r  )r  r  r  rJ   r   )r  rJ   )VerticalScrolledFramer   r  interior	enumerater>  r&   rv   r   r$   r   r%   r  r   )ra   rC  f
entry_arear   optlabelr  s           rd   r  zExtPage.create_extension_frame  sZ   K!$"4SLLL&'(#Z
!$/(";<< 	E 	EHC*3v;777EJJ3qJ444e*C6{f$$J$*WA  "ds1QQdGGGGV%%jsU'+{D&9  Qt!DDDD js"   Qt!DDDDre   c                 0   	 |d         }|d         }|d                                                                          p|}|d                             |           ||k    r| j                            ||          S | j                            |||          S )Nr8  r  r  )r   r   r   r  RemoveOptionr  )ra   sectionr(  r8  r  r4  s         rd   set_extension_valuezExtPage.set_extension_value  s    	
 6{i.E
  &&((3GE
u W#00$???))'4???re   c                     	 d}| j         D ],}| j         |         }|D ]}|                     ||          rd}-|r| j                                         d S d S )NFT)r>  r-  r  Save)ra   has_changesrC  optionsr(  s        rd   r   z#ExtPage.save_all_changed_extensions  s    	  	' 	'Hoh/G ' '++Hc:: '"&K'  	$!!#####	$ 	$re   )r   r   r   rL   r  r  r  r  r-  r   r   r   s   @rd   rx   rx   `  s        & & & & &=< =< =<~,4 ,4 ,4\, , ,  4@ @ @"$ $ $ $ $ $ $re   rx   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                      t                      j        |fi | |                                  |                                  d S r   )r   rL   create_frame_helpload_helplist)ra   r   cfgr   s      rd   rL   zHelpFrame.__init__%  sL    ''3'''   re   c                    	 t          |           }t          |ddt                    | _        t	          |          }| j        j        |d<   |j        | j        d<   | j                            d| j                   t          |           }t          |ddd	| j
        
          | _        t          |dd	| j                  | _        t          |ddd	| j        
          | _        |                    t"          ddt$          t&                     | j                            t"          t(          t$          t&                     |                    t*          t,          t.                     |                    t*          ddt.                     | j                            t0          t,          d           | j                            t0          t,                     | j                            t0          t,          d           d S )Nr   Tr   r   r   r   Editrs  r~  )rm   rt  rJ   r   Add)rm   rJ   r   Remover|  )rq   r   rr   rs   )rq   r   rs   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   )ra   frame_helplistscroll_helplistframe_buttonss       rd   r4  zHelpFrame.create_frame_help*  s   	( tqD %' ' ' $N33%)]%8	"*9*=&'.0IJJJd$*F*!8%: %: %:! $*E!7$9 $9 $9  '-HJ!:'< '< '<#
 	AAdNNNQt$GGG%:::AAA>>>!&&C&BBB %%3q%999#((c!!(DDDDDre   c                 0    	 |                                   d S r   )set_add_delete_staterZ  s     rd   r<  zHelpFrame.help_source_selected\  s    5!!#####re   c                    	 | j                                         dk     r6| j                            d           | j                            d           d S | j                                         r6| j                            d           | j                            d           d S | j                            d           | j                            d           d S )Nr   r  r  )r;  sizer>  rt  rB  rf  r   s    rd   rG  zHelpFrame.set_add_delete_state`  s    K=!##%++M:::'--m<<<<<}))++ A)//???+11.AAAAA)//>>>+11-@@@@@re   c                     	 t          | d          j        }|rV| j                            |           | j                            t          |d                    |                                  d S d S )NzNew Help Sourcer   )r6   r  user_helplistr  r;  r   r   update_help_changes)ra   help_sources     rd   r?  zHelpFrame.helplist_item_addm  sy    	
 !'899@ 	'%%k222M  k!n555$$&&&&&	' 	're   c                    	 | j                             t                    }| j        |         }t	          | d|d         |d                   j        }|ru||k    rq|| j        |<   | j                             |           | j                             ||d                    |                                  | 	                                 d S d S d S )NzEdit Help Sourcer   r   )menuitemfilepath)
r;  r#  r   rK  r6   r  rL  r   rL  rG  )ra   
item_indexrM  new_help_sources       rd   r=  zHelpFrame.helplist_item_edity  s    	
 ]((00
(4$($Q$Q   	 	
  	(+==-<Dz*M  ,,,M  _Q-?@@@$$&&&%%'''''	( 	(==re   c                     	 | j                             t                    }| j        |= | j                             |           |                                  |                                  d S r   )r;  r#  r   rK  rL  rL  rG  )ra   rQ  s     rd   rA  zHelpFrame.helplist_item_remove  si    	 ]((00
z*Z(((  """!!#####re   c                    	 i t           d         d<   t          dt          | j                  dz             D ]U}t                               ddt          |          d                    | j        |dz
           d d                              Vd S )Nr  	HelpFilesr   ;r   )r   r  r  rK  r1  r  r^  )ra   nums     rd   rL  zHelpFrame.update_help_changes  s    <')$C 233a788 	= 	=CKSHHT/A6rr:;;= = = =	= 	=re   c                     t          j                    | _        | j                            dd           | j        D ](}| j                            t          |d                    )|                                  d S )Nr   r   )r0   GetAllExtraHelpSourcesListrK  r;  rL  r   r   rG  )ra   	help_items     rd   r5  zHelpFrame.load_helplist  st    %@BBQ&&&+ 	4 	4IM  il3333!!#####re   )r   r   r   rL   r4  r<  rG  r?  r=  rA  rL  r5  r   r   s   @rd   r  r  #  s            
0E 0E 0Ed$ $ $A A A
' 
' 
'( ( ((	$ 	$ 	$= = =$ $ $ $ $ $ $re   r  c                   D    e Zd Z	 d Zd Zd Zed             Zd Zd Z	dS )VarTracec                 $    	 g | _         g | _        d S r   )untracedtracedr   s    rd   rL   zVarTrace.__init__  s    	 re   c                 l    	 | j                                          | j                                         d S r   )r^  r   r_  r   s    rd   r   zVarTrace.clear  s3    "re   c                     	 t          |t                    r|                     ||          }| j                            ||f           |S r   )
isinstancetuplemake_callbackr^  r  ra   r  callbacks      rd   r   zVarTrace.add  sO    
	 h&& 	9))#x88Hc8_---
re   c                      	  fd}|S )Nc                  T    	 t          j        g                                 R   d S r   )r   r1  r   )r3  r   r  s    rd   default_callbackz0VarTrace.make_callback.<locals>.default_callback  s0    422		222222re   r
  )r  r   ri  s   `` rd   rd  zVarTrace.make_callback  s-    M	3 	3 	3 	3 	3 	3  re   c                     	 | j         rW| j                                         \  }}|                    d|           | j                            ||f           | j         Ud S d S )Nwrite)r^  pop	trace_addr_  r  re  s      rd   r]   zVarTrace.attach  st    :m 	0 M--//MCMM'8,,,KX/// m 	0 	0 	0 	0 	0re   c                     	 | j         ru| j                                         \  }}|                    d|                                d         d                    | j                            ||f           | j         sd S d S )Nrk  r   r   )r_  rl  trace_remove
trace_infor^  r  re  s      rd   detachzVarTrace.detach  s    +k 	2 KOO--MCWcnn&6&6q&9!&<===M  #x111 k 	2 	2 	2 	2 	2re   N)
r   r   r   rL   r   r   ro  rd  r]   rq  r
  re   rd   r\  r\    s}        ,
 
 
    "     \ 0 0 02 2 2 2 2re   r\  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/Tabsrn   r1  r  ro   c                 R    	 | sdS 	 t          |            dS # t          $ r Y dS w xY w)NTF)r  r(  )r  s    rd   r  r  -	  sI    . tAt   uus    
&&c                       e Zd Z	 d ZdS )r#  c                   	 t          j        | |g|R i | t          | t                    }|                    t
          t          t                     t          | dd|j	        d                              t          t          t                     |                    j                                       d                               d           t                    x| _                            ddt&                    	fd	}                    d
|           	fd}                    d
|           d S )Nr  )rs   rq   rr   r      )r   r\  r   rJ   r  r   )windowr   c                                                                                      f}                    d|z             d S )Nz	0 0 %s %s)scrollregion)winfo_reqwidthwinfo_reqheightr   )r9  rI  canvasr$  s     rd   _configure_interiorz;VerticalScrolledFrame.__init__.<locals>._configure_interiorT	  sD    ++--x/G/G/I/IJDMM{T'9M:::::re   z<Configure>c                                                                                      k    r+                                                               d S d S )N)rJ   )ry  winfo_widthitemconfigure)r9  r{  r$  interior_ids    rd   _configure_canvasz9VerticalScrolledFrame.__init__.<locals>._configure_canvasZ	  sZ    &&((F,>,>,@,@@@$$[8J8J8L8L$MMMMM A@re   )r!   rL   r*   r   r   r   r   r
   r   r   r   r   r	   r   r   xview_movetoyview_movetor$  create_windowr   r   )
ra   rM   r  kw
vscrollbarr|  r  r{  r$  r  s
          @@@rd   rL   zVerticalScrolledFrame.__init__?	  s}   tV1d111b111 tH555
QU5999!'1~SB B BD666&,/// 	AA $)==0**1a*LL	; 	; 	; 	; 	; 	; 	m%8999	N 	N 	N 	N 	N 	N 	N 	M#4555re   N)r   r   r   rL   r
  re   rd   r#  r#  8	  s(        ! ! ! ! !re   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|   rz   r}   r   r   rx   r  r\  r\   r   r   r  r#  r   unittestr  idlelib.idle_test.htestr  r
  re   rd   <module>r     s  
 
			J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , !                       2 2 2 2 2 2 2 2 , , , , , , + + + + + +       1 1 1 1 1 1 1 1 & & & & & & - - - - - - + + + + + + ) ) ) ) ) ) * * * * * * % % % % % % 0 0 0 0 0 0
-//[*o{ { { { {8 { { {^E <g1 g1 g1 g1 g1u g1 g1 g1TQ
 Q
 Q
 Q
 Q
u Q
 Q
 Q
ho o o o ou o o odOK OK OK OK OKe OK OK OKdBF BF BF BF BFu BF BF BFJ@$ @$ @$ @$ @$e @$ @$ @$FC$ C$ C$ C$ C$
 C$ C$ C$L:2 :2 :2 :2 :2 :2 :2 :2z (**"*g; ;
|  ( ( ( ( (E ( ( (V zD	.!%HHHH++++++C re   