Your IP : 3.145.83.96


Current Path : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/configdialog.cpython-36.opt-2.pyc

3

��2a���@sFddlmZmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ddl,j-Z.ddl/j0Z1ddlm2Z2ddl3m4Z4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;dd	l<m=Z=m>Z>dd
l?m@Z@ddlAmBZBddlCmDZDdd
lEmFZFddlGmHZHddlImJZJe5�ZKeBeDeFeHeJfZLGdd�de�ZMdaNGdd�de$�ZOGdd�de$�ZPGdd�de$�ZQGdd�de$�ZRGdd�d�ZSeS�ZTdZUddd d!d"�ZVd#d$�ZWGd%d&�d&e$�ZXeYd'k�rBdd(lZm[Z[e[d)d*d+d,�dd-l\m]Z]e]eM�dS).�)�Toplevel�Listbox�Text�Scale�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)�Button�Checkbutton�Entry�Frame�Label�
LabelFrame�
OptionMenu�Notebook�Radiobutton�	Scrollbar�StyleN)�
messagebox)�idleConf�
ConfigChanges)�
GetKeysDialog)�
DynOptionMenu)�macosx)�SectionName�
HelpSource)�	view_text)�AutoComplete)�CodeContext)�
ParenMatch)�FormatParagraph)�Squeezercs�eZdZd$ddd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z�fdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Z�ZS)%�ConfigDialog�F)�_htest�_utestcCs�tj||�||_|ri|_|s(|j�|jdd�|j|p>d�|j�d}|j�|s\dnd}|j	d|�d|���|j
�|jttd�|j
|�|jd	|j�|jjj�tj�|s�|j�|j�|j�dS)
N�)�borderwidthzIDLE Preferences����+)�height�widthZWM_DELETE_WINDOW)r�__init__�parent�
instance_dictZwithdraw�	configure�titleZwinfo_rootxZwinfo_rootyZgeometry�create_widgetsZ	resizablerZ	transientZprotocol�cancel�fontpage�fontlistZ	focus_set�tracers�attachZgrab_setZwm_deiconifyZwait_window)�selfrGrJr<r=�x�y�rT�1/opt/alt/python36/lib64/python3.6/configdialog.pyrF-s*
zConfigDialog.__init__cCs�t|�|_}t|�|_t||j�|_t|�|_t|�|_	|j
�|_|j|jdd�|j|jdd�|j|jdd�|j|j	dd�|j|jdd�|j
�|jtttd�|j�jtd�dS)	Nz
Fonts/Tabs)�text�
Highlightsz Keys z	 General Z
Extensions)�side�expand�fill)rX)r(�note�HighPage�highpage�FontPagerM�KeysPageZkeyspage�GenPageZgenpage�create_page_extensionsZextpage�addZenable_traversal�packrr
r�create_action_buttonsr
)rQr[rTrTrUrK]s



zConfigDialog.create_widgetscCs�tj�ri}nddi}t|dd�}t|dd�}xRd|jfd|jfd|jfd	|jffD]*\}}t|f||td
�|��j	t
dd�qTWt|dd
d�j	td�|j	td�|S)N�padding���)reZOkZApplyZCancelZHelp)rV�command�	takefocusr>)rX�padxr)rDr?)rX)rfrg)
r1ZisAquaTkr$�ok�applyrL�helpr!rrcrrr
)rQZpadding_argsZouterZbuttonsZtxt�cmdrTrTrUrd|sz"ConfigDialog.create_action_buttonscCs|j�|j�dS)N)rm�destroy)rQrTrTrUrl�szConfigDialog.okcCs$|j�tj�|j�|j�dS)N)�deactivate_current_config�changes�save_all�save_all_changed_extensions�activate_config_changes)rQrTrTrUrm�szConfigDialog.applycCs|j�dS)N)rp)rQrTrTrUrL�szConfigDialog.cancelcs&|jjjdd�a|j�t�j�dS)Nz1.0�end)rM�font_sample�get�font_sample_textZgrab_release�superrp)rQ)�	__class__rTrUrp�szConfigDialog.destroycCs8|jj|jj�dd�j�}t|dttj|d�d�dS)NrV)�optionzHelp for IDLE preferencesr;)rJrV)r[ZtabZselect�stripr4�help_common�
help_pagesrx)rQZpagerTrTrUrn�s	zConfigDialog.helpcCs&|jjj�}x|D]}|j�qWdS)N)rGrH�keysZRemoveKeybindings)rQ�
win_instances�instancerTrTrUrq�s
z&ConfigDialog.deactivate_current_configcCs\|jjj�}x4|D],}|j�|j�|j�|j�|j�qWxtD]}|j	�qHWdS)N)
rGrHr�ZResetColorizerZ	ResetFontZset_notabs_indentwidthZApplyKeybindingsZreset_help_menu_entries�reloadables�reload)rQr�r��klassrTrTrUru�s

z$ConfigDialog.activate_config_changescCsh|j}t|j�}tjd|_tjd|_|jt	�|_	|j
�t|�|_|j
ddd�|jddd�t||jdd�|_|jjd|j�t||jjd	�}|j|j_t|d
d
d�|_|jjdddd
�|jdddd
�|jjdddddgd�|jdd�i|_d|_||_|j|_d}x.t|j �D] }|j!|�|d|d}�qW|jj|�|jj"d�|jd�|S)N�
extensionsr�)�weightrhZbrowse)ZlistvariableZ
selectmodez<<ListboxSelect>>)ri�)rErDZnws)�column�row�sticky�ns�nsew�
)r�r�r�rk)rer;�{z} )#rGr$r[r-�
defaultCfg�ext_defaultCfg�userCfg�ext_userCfg�register�is_int�load_extensionsrZextension_names�rowconfigure�columnconfigurer�extension_list�bind�extension_selectedr*�yview�set�yscrollcommandr&�
details_frame�gridrI�config_frame�current_extensionZ
outerframeZtabbed_page_set�sortedr��create_extension_frameZ
selection_set)rQrG�frameZscrollZ	ext_names�ext_namerTrTrUra�s>





z#ConfigDialog.create_page_extensionsc
Cs^i|_xtjdd�D]}g|j|<qW�x0|jD�]$}t|jj|��}dd�|D�}x|D]}|j|�qZW||}x�|D]�}|jj||dd�}yddd�|}d}WnBtk
r�yt	|�}d	}Wnt
k
r�|}d}YnXYnXy|jj|||d|d
�}Wnt
k
�r|}YnXt|�}	|	j
t|��|j|j|||||	d��qzWq0WdS)NF)Zactive_onlycSsg|]}|jd�r|�qS)�enable)�
startswith)�.0�opt_namerTrTrU�
<listcomp>8sz0ConfigDialog.load_extensions.<locals>.<listcomp>T)�raw)�True�False�bool�int)�typer��default)�namer�r��value�var)r�r-Z
GetExtensionsr�r�Z
GetOptionList�remove�Get�KeyErrorr��
ValueErrorr�rr��str�append)
rQr�Zopt_listZenablesr�Zdef_strZdef_objZopt_typer�r�rTrTrUr�-sF


zConfigDialog.load_extensionscCs�|jj�}|r|jj|�}|dks,||jkrV|jrV|jjdd�|j|jj�d|_|r�|jj|d�|j|jdddd�||_dS)Nr;)rVrr�)r�r�r�)	r��curselectionrxr�r��configr�Zgrid_forgetr�)rQ�eventZnewselrTrTrUr�[s
zConfigDialog.extension_selectedcCs�t|jddd�}||j|<|j}x�t|j|�D]�\}}t||dd�}|j|dtd�|d}|dd	kr�t	||d
ddd
�j|dt
dd�q0|ddkr�t||d|jdfdd�j|dt
dd�q0t||dd�j|dt
dd�q0WdS)Nr�)rDrEr�)rVr)r�r�r�r�r�r�r�r��)�variable�onvalue�offvaluerEr��)r�r�r�rkr��keyz%Pr�)�textvariableZvalidateZvalidatecommandrE�)r�rE)�VerticalScrolledFramer�r��interior�	enumerater�r%r�rr"rr#r�r)rQr��fZ
entry_arear��optZlabelr�rTrTrUr�js$
z#ConfigDialog.create_extension_framecCsX|d}|d}|dj�j�p"|}|dj|�||krH|jj||�S|jj|||�S)Nr�r�r�)rxr}r�r�ZRemoveOption�	SetOption)rQ�sectionr�r�r�r�rTrTrU�set_extension_value�sz ConfigDialog.set_extension_valuecCsNd}x6|jD],}|j|}x|D]}|j||�r d}q WqW|rJ|jj�dS)NFT)r�r�r�ZSave)rQZhas_changesr��optionsr�rTrTrUrt�s	

z(ConfigDialog.save_all_changed_extensions)r;)�__name__�
__module__�__qualname__rFrKrdrlrmrLrprnrqrurar�r�r�r�rt�
__classcell__rTrT)r{rUr:)s 0&


>.r:u^<ASCII/Latin1>
AaBbCcDdEeFfGgHhIiJj
1234567890#:+=(){}[]
¢£¥§©«®¶½ĞÀÁÂÃÄÅÇÐØß

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

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

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

<East Asian>
〇一二三四五六七八九
汉字漢字人木火土金水
가냐더려모뵤수유즈치
あいうえおアイウエオ
csVeZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zddd
�Zdd�Z	dd�Z
�ZS)r^cs0t�j|�|j|_|j�|j�|j�dS)N)rzrF�highlight_sample�create_page_font_tab�
load_font_cfg�load_tab_cfg)rQ�masterr])r{rTrUrF�s
zFontPage.__init__c
Cs~tjt|�|j�|_tjt|�|j�|_tjt|�|j�|_tjt|�d-�|_	t
|dtdd�}t
|dtdd�}t
|dtdd�}t|�}t|�}t
|td	d
�}t|ddtd
�|_|jjd|j�|jjd|j�|jjd|j�t|�}|j|jjd�|jj|jd�t
|dd�}t||jd�|_t||jdddd�|_t|ddd�|_|jjtt �t
|tdd
�}	t!||j	ddddd�|_"|j#ddd�|j$ddd d d!�|j$dddd d d"d#�|j$ddd d d$d%�|j%t&d d t'd&�|j%t&d d t'd&�|j%t&t(d'�|jj%tt)t'd(�|j%tt*d)�|j%tt(d'�|jj%tt(d'�|jj%tt(dd*�|jj%t)t+d+�|	j%t&t(d d*�|j"j%t&d t'd,�dS).N�main�Indent�
num-spacesrhz Shell/Editor Font )r?�reliefrVz Font Sample (Editable) z Indentation Width zFont Face :)ZjustifyrVr�T)rDrj�exportselectionz<ButtonRelease-1>z<KeyRelease-Up>z<KeyRelease-Down>)ri)r�zSize :)rVr�rZBold)r�r�r�rVr@)rErDzPython Standard: 4 Spaces!Z
horizontal�)r��orientZtickintervalZfrom_Zto)r�r>)r�r�rk�padyr�)r�r�Zrowspanrkr�r�Zew)r�r�rkr�r�)rXrkr�rZ)rX�anchor)rXrYrZ)rXrZ)rXr�rk)rYrZ)rXrkrZ)r�r�r�),rOrbr�var_changed_font�	font_name�	font_sizer�	font_boldr	�	space_numr&rr$r%rrrrNr��on_fontlist_selectr*r�r�r�r0�sizelistr"Zbold_togglerrw�insertr ryrZindent_scaler�r�rcrrrr
rr)
rQZ
frame_fontZframe_sampleZframe_indentZframe_font_nameZframe_font_paramZfont_name_titleZscroll_fontZfont_size_titleZindent_titlerTrTrUr��sh.zFontPage.create_page_font_tabc	Cs�tj|dd�}|dj�}|d}|ddk}ttj|��}|j�x|D]}|jjt	|�qJW|j
j|�dd�|D�}y>|j|�}|jj
|�|jj|�|jj|�|jj|�Wntk
r�YnX|jjd|�|jj|�|j�dS)Nr��EditorWindowrr�rhZboldcSsg|]}|j��qSrT)�lower)r��srTrTrUr�^sz*FontPage.load_font_cfg.<locals>.<listcomp>�7�8�9�10�11�12�13�14�16�18�20�22�25�29�34�40)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)r-ZGetFontr��list�tkFontZfamilies�sortrNr�r r�r��index�see�
select_set�
select_anchorZactivater�r��SetMenur��set_samples)	rQZconfigured_fontr�r�r�Zfonts�fontZlc_fontsZcurrent_font_indexrTrTrUr�Ls.

zFontPage.load_font_cfgcGsZ|jj�}tjddd|�|jj�}tjddd|�|jj�}tjddd|�|j�dS)Nr�r�rz	font-sizez	font-bold)r�rxrr�
add_optionr�r�r)rQ�paramsr�rTrTrUr�os


zFontPage.var_changed_fontcCs0|jj|jjdkrtnt�}|jj|j��dS)NZ
KeyRelease)	rNrxr�r�rrr�r�r�)rQr�rrTrTrUr�~szFontPage.on_fontlist_selectNcCsH|jj�}|jj�rtjntj}||jj�|f}||jd<||jd<dS)Nr)	r�rxr�r�ZBOLDZNORMALr�rwr�)rQr�r�Zfont_weightZnew_fontrTrTrUr�s


zFontPage.set_samplescCs$tjdddddd�}|jj|�dS)Nr�r�z
num-spaces�r�)r�r�)r-�	GetOptionr�r�)rQr�rTrTrUr��szFontPage.load_tab_cfgcGs|jj�}tjddd|�dS)Nr�r�z
num-spaces)r�rxrrr)rQr	r�rTrTrU�var_changed_space_num�s
zFontPage.var_changed_space_num)N)r�r�r�rFr�r�r�r�rr�rr�rTrT)r{rUr^�sm#


r^cs�eZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Z�ZS)+r\cs2t�j|�|j|_t|�|_|j�|j�dS)N)rzrFr��cdr+�style�create_page_highlight�load_theme_cfg)rQr�)r{rTrUrF�s

zHighPage.__init__c
$s�drdsdtdudvdwdxdydzd{d|d}d~dd�d��_tjt���j��_tjt���j��_t���_	tjt���j
��_tjt���j��_
tjt���j��_t�d td!d"�}t�d td#d"�}t|td$d�d(d)d*td+td,�
}�_|jd-d.d/��|jd0d1d/��d�}x$|D]}|jt|d+|d$��qWx8�jD].}|f�fdLdM�	}|j�j|d+dN|��q(WdO|dP<�jjdQd$dRdS�t|dQdT��_t|�}t�jdU�j dV��_!t"�j�jdd+dW��_#t$|�j	d$dX�j%dY��_&t$|�j	d+dZ�j%dY��_'�j	j(d$�t|d[�j)dV��_*t+|d\d]�}	t$|�j
d$�j,d^d_��_-t$|�j
d+�j,d`d_��_.t"|�jddda��_/t"|�jddda��_0t|db�j1dV��_2t+|d dc��_3|j4t5ddddt6t7de�|j4t8ddddt9df��jj4t8ddddt6t9de�|j4t8ddd+dg��jj4t8ddddt6t7de��j!j4t8t6t9dhdidj��j#j4t8t6t9dhdkdj��j&j4t5t:dl��j'j4t;t<dl��j*j4t=t9dddddm�|	j4t8t<dddddn��j-j4t8t<dddo��j.j4t8t<ddd dn��j/j4t8t9dddddm��j0j4t8t9t<dddddp��j2j4t8t9dddddm��j3j4t8t9dddq�dS)�N�normal�00�context�01�keyword�02�
definition�03�builtin�04�comment�05�string�06�hilite�07�hit�08�cursor�09�breakr��consoler��errorr��stdoutr��stderrr�)zNormal TextzCode ContextzPython KeywordszPython DefinitionszPython BuiltinszPython CommentszPython Stringsz
Selected Textz
Found Text�CursorzEditor BreakpointzShell Normal TextzShell Error TextzShell Stdout TextzShell Stderr Textrhz Custom Highlighting )r?r�rVz Highlighting Theme r��courier�r;Zhand2��
r)	r�r?rr#rErDrj�highlightthickness�wrapz<Double-Button-1>cSsdS)Nr%rT)�erTrTrU�<lambda>Lsz0HighPage.create_page_highlight.<locals>.<lambda>z<B1-Motion>cSsdS)Nr%rT)r1rTrTrUr2Ms�
�#you can click here�#to choose items�code context section�

�def� �func�(param):
  �"""string"""�

  var0 = �'string'�

  var1 = �
'selected'�

  var2 = �'found'�

  var3 = r��(�None�)
�  breakpoint("line")� error �cursor |�
 �shellcs�jj|�dS)N)�highlight_targetr�)r��elem)rQrTrU�temdsz+HighPage.create_page_highlight.<locals>.temz<ButtonPress-1>�disabled�statezframe_color_set.TFrameZsolid)r?r�)rzChoose Color for :)rVri)r/Z
Foreground)r�r�rVriZ
BackgroundzSave as New Custom Themez	Select : )rVza Built-in Theme)r�r�rirVza Custom Theme)rizDelete Custom Theme)r?r>)rXrkr�rYrZ)rXrkr�rZ)rXrkr�r�r
)rXrYrZrkr�rg)rXr�)rXrZrkr�)rXr�rkr�)rXr�rk)rXrZr�rkr�)rXrZr�)rr)rr)rr)rr)rr)rr)rr)rr )r!r")r#r$)r%r�)r&r�)r'r�)r(r�)r)r�)r+r,r;�r3r�r4r�r3r�r5r�r3r�r6r�r7r�r8r�r9r�r:r�r;r�r<r�r=r�r>r�r?r�r@r�rAr�rBr!�rCr�r�r�rDr�rEr�rFr�rGr%�r7r�rHr'�r9r�rIr#�rJr�rKr&�r9r�r(r(�r9r�r)r)�r7r)#rQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrs)>�theme_elementsrOrbr�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_targetrLr&rrrrrr�r�r�r Ztag_bindrrIr$�frame_color_setr!�	get_colorZbutton_set_colorr0�
targetlistr)�set_color_sample_binding�fg_on�bg_onr��save_as_new_themeZbutton_save_customr%�set_theme_typeZbuiltin_theme_on�custom_theme_on�builtinlist�
customlist�
delete_custom�button_delete_custom�
theme_messagercrr
rrrrrrr
)
rQ�frame_customZframe_themerVZ
text_and_tagsZtexttag�elementrNZframe_fg_bg_toggleZtheme_type_titlerT)rQrUr�s�v





zHighPage.create_page_highlightcs.�jjtjdddddd��tj�}�jj�r�tjdd�}|j��jj	||�tjdd�}|j�|s��j
jd��jjd
�qވj
j	||d�nHtjdd�}|j��j
j	||�tjdd�}|j��jj	||d��j�t�jj��}|j�fdd
�d��jj	||d��j��j�dS)Nr��Themer�r�r�)r�r��	highlight�userrOz- no custom themes -rcs�j|dS)Nr�)rt)rR)rQrTrUr2�sz)HighPage.load_theme_cfg.<locals>.<lambda>)r�)rO)r}r�r-rZCurrentThemerx�GetSectionListrr�rr�rPrxr�r�r�rtr�r��paint_theme_sample�set_highlight_target)rQ�current_option�	item_listZtheme_namesrT)rQrUr�s2

zHighPage.load_theme_cfgcGs�d}|jj�}||krXtjddd�|kr<tjddd|d�tjddd|�d|jd	<n*tjddd|�tjdddd
�d
|jd	<|j�dS)N�IDLE Classic�IDLE Newr�r�r�r�name2zNew theme, see HelprVr;)r�r�)rvrxr-rrrrr�r�)rQr	Z
old_themesr�rTrTrUru�s

z!HighPage.var_changed_builtin_namecGs.|jj�}|dkr*tjddd|�|j�dS)Nz- no custom themes -r�r�r�)rxrxrrrr�)rQr	r�rTrTrUrw�s
z HighPage.var_changed_custom_namecGs4|jj�}tjddd|�|r(|j�n|j�dS)Nr�r�r�)r}rxrrrrurw)rQr	r�rTrTrUr|�s


z!HighPage.var_changed_theme_sourcecGs|j�dS)N)�on_new_color_set)rQr	rTrTrUrzszHighPage.var_changed_colorcGs|j�dS)N)r�)rQr	rTrTrUr~sz%HighPage.var_changed_highlight_targetcCs\|jj�r,d|jd<d|jd<|jjd�n,d|jd<|jjd�d|jd<|jjd�dS)NrrPrO�	!disabled)rO)r�)r�)r}rxr�r�r�rPr�)rQrTrTrUr�s




zHighPage.set_theme_typecCs�|jj�}|jj|jdd�}tj|d||d�\}}|r�||kr�|jj�rzd}|j|�}|sbdS|j	|�|j
j|�n|j
j|�dS)Nr�
backgroundzPick new color for : )rGrJZinitialcolorz_Your changes will be saved as a new Custom Theme. Enter a name for your new Custom Theme below.)rLrxr�lookupr�tkColorChooserZaskcolorr}�get_new_theme_name�
create_newr{r�)rQ�targetZ
prev_colorZ	rgbTupletZcolor_string�message�	new_themerTrTrUr�(s



zHighPage.get_colorcCs~|jj�}|jjd|d�|jj�r(dnd}|j|jj�d}|jj|f||i�|j	j�}|d|}t
jd|||�dS)Nzframe_color_set.TFrame)r��
foregroundr�r�-r�)r{rxrrIryrtrLr��
tag_configrxrrr)rQZ	new_color�planeZsample_element�themeZ
theme_elementrTrTrUr�Ns

zHighPage.on_new_color_setcCs,tjdd�tjdd�}t|d||�j}|S)Nr�r�r�zNew Custom Theme)r-r�r2�result)rQr��
used_namesr�rTrTrUr�Ys

zHighPage.get_new_theme_namecCs|jd�}|r|j|�dS)NzNew Theme Name:)r�r�)rQ�new_theme_namerTrTrUr�as
zHighPage.save_as_new_themecCs�|jj�rd}|jj�}nd}|jj�}tj||�}|tdkrftd|}x|D]}||||<qRW|j||�tjdd�}|j	�|j
j||�|jjd�|j
�dS)Nr�r�r�r)r}rxrvrxr-ZGetThemeDictrr�save_newr�rr�rr�r�)rQr�Z
theme_type�
theme_namer�Z
theme_changesr�Zcustom_theme_listrTrTrUr�ls 


zHighPage.create_newcCsd|jj�dkr4|jjd�|jjd�|jjd�n$|jjd�|jjd�|jjd�|j�dS)	Nr*rOr��	!disabled)rO)rO)r�)r�)rLrxr�rPr�ryr��set_color_sample)rQrTrTrUr��szHighPage.set_highlight_targetcGs|j�dS)N)r�)rQ�argsrTrTrUr��sz!HighPage.set_color_sample_bindingcCsH|j|jj�d}|jj�r"dnd}|jj||�}|jjd|d�dS)Nrr�r�zframe_color_set.TFrame)r�)rtrLrxryr�Ztag_cgetrrI)rQ�tagr�r{rTrTrUr��s
zHighPage.set_color_samplecCs�|jj�r|jj�}n
|jj�}x�|jD]�}|j|d}tj||�}|dkrbtj|ddd�|d<|tdkr�td|}|d|kr�||d|d	<|d
|kr�||d
|d<|jj	|f|�q(W|j
�dS)Nrr#r�bg)ZfgBgr�r�z-foregroundr�z-background)r}rxrvrxrtr-ZGetHighlightrrr�r�r�)rQr�Z
element_titler�ZcolorsZ
theme_dictrTrTrUr��s"

zHighPage.paint_theme_samplecCsNtjdj|�s tjdj|�x(|D] }||}tjdj|||�q&WdS)Nr�)r-r��has_section�add_sectionr�)rQr�r�r�r�rTrTrUr��s

zHighPage.save_newcOstj||�S)N)r,�askyesno)rQr��kwargsrTrTrUr��szHighPage.askyesnocCs�|jj�}d}|jd|||d�s&dS|jj�tjd|�tjdd�}|j	�|sp|j
jd
�|jj
|d�n|jj
||d�|jjtjd	jd
d��|jjtjd	jd
d��tj�|jj�|jj�|j�dS)Nz.Are you sure you wish to delete the theme %r ?zDelete Theme)rGr�r�rOz- no custom themes -rr�r�r�r�)rO)rxrxr�r
rqrr�delete_sectionr-r�rr�rPr�rr}r�r�r�rvrsrtrur�)rQr��delmsgr�rTrTrUr�s&



zHighPage.delete_custom)r�r�r�rFrrrurwr|rzr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�rTrT)r{rUr\�s,w4
&((r\cs�eZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��Zdd �Zd!d"�Z�ZS)#r_cs(t�j|�|j|_|j�|j�dS)N)rzrFr�r
�create_page_keys�load_key_cfg)rQr�)r{rTrUrF4szKeysPage.__init__cs"tjt|�|j�|_tjt|�|j�|_tjt|�|j�|_	tjt|�|j
�|_t|dt
dd�}t|dt
dd��t|�}t|dd�}t|�}t|td�}t|ttd�|_|jjd	|j�|jj|d
<|jj|d
<|j|jd<|j|jd<t|d
|jdd�|_�fdd�td�D�}t|d|j	d|jdd�|_ t|d|j	d|jdd�|_!t"|d|jddd�|_#t"|d|jddd�|_$t|dd|j%d�|_&t|dd|j'd�|_(t|ddd�|_)|j*t+ddt,t-d��j*t+ddt-d�|jj*t+t.ddd�|j*t/ddt,t-d�|j0ddd �|j1ddd �|j2dddt3d!�|jj2ddt4d"�|j2ddt5d"�|j2ddt6d"�|j j2ddt3t5d"�|j!j2ddt3t5d"�|j#j2ddt4d"�|j$j2ddt4d"�|j)j2ddt4ddd#�|j&j*t/t.d$dd%�|j(j*t/t.d$dd%�|dj*t7t-d$d&�|dj*t7t.d$dd'�dS)(Nrhz Custom Key Bindings )r?r�rVz	 Key Set zAction - Key(s))rV)r�)rjr�z<ButtonRelease-1>rir�ZxscrollcommandzGet New Keys for SelectionrO)rVrirPcsg|]}t�ddd��qS)rhr)rer?)r$)r��i)�frame_key_setsrTrUr��sz-KeysPage.create_page_keys.<locals>.<listcomp>rr�zUse a Built-in Key Set)r�r�rirVzUse a Custom Key Set)rizDelete Custom Key Set)rVrizSave as New Custom Key Set)r?r>)rXrkr�rYrZ)rXrkr�rZ)rXrZrkr�)r�)r�r�Z
columnspanr�)r�r�r�)r�r�r�rkr�T)rXrZrYrk)rXrZrY)rXrZrYr�)8rOrbrrurvrwrxr�var_changed_keyset_source�
keyset_source�var_changed_keybinding�
keybindingr&rr$r%r*rrr�bindingslistr��on_bindingslist_selectr�Zxviewr�r!�get_new_keys�button_new_keys�ranger)�
set_keys_typeZbuiltin_keyset_on�custom_keyset_onr0r�r��delete_custom_keys�button_delete_custom_keys�save_as_new_key_setZbutton_save_custom_keys�keys_messagercr
r
rrrr�r�r�rrrrr)rQr�Zframe_targetZtarget_titleZscroll_target_yZscroll_target_xZframesrT)r�rUr�:s�R
zKeysPage.create_page_keyscCs�|jjtjdddddd��tj�}|jj�r�tjdd�}|j�|jj	||�tjdd�}|j�|s�|j
jd�|jjd
�q�|j
j	||d�nHtjdd�}|j�|j
j	||�tjdd�}|j�|jj	|tj��|j�tj�}|j|�dS)
Nr��Keysr�r�r�)r�r�r�r�rOz- no custom keys -r)rO)r�r�r-rZCurrentKeysrxr�rr�rr�rPrxr��default_keysr��load_keys_list)rQr�r��keyset_namerTrTrUr��s,

zKeysPage.load_key_cfgcGs�d
}|jj�}||krXtjddd�|kr<tjddd|d�tjddd	|�d
|jd<n*tjddd|�tjddd	d�d|jd<|j|�dS)N�IDLE Classic Windows�IDLE Classic Unix�IDLE Classic Mac�IDLE Classic OSXr�r�r�rr�zNew key set, see HelprVr;)r�r�r�r�)rvrxr-rrrrr�r�)rQr	Zold_keysr�rTrTrUru�s

z!KeysPage.var_changed_builtin_namecGs0|jj�}|dkr,tjddd|�|j|�dS)Nz- no custom keys -r�r�r�)rxrxrrrr�)rQr	r�rTrTrUrw
s
z KeysPage.var_changed_custom_namecGs4|jj�}tjddd|�|r(|j�n|j�dS)Nr�r�r�)r�rxrrrrurw)rQr	r�rTrTrUr�s


z"KeysPage.var_changed_keyset_sourcecGsj|jj�}|jj�}|jjt�j�d}tj|�rDtj	d|||�n"tj
|�}|d}tj	d|||�dS)Nrr�Z_cfgBindingsr�)r�rxrxr�r�splitr-Z
IsCoreBindingrrrZGetExtnNameForEvent)rQr	r�Zkey_setr�r�Zext_keybind_sectionrTrTrUr�s



zKeysPage.var_changed_keybindingcCs\|jj�r,d|jd<d|jd<|jjd�n,d|jd<|jjd�d|jd<|jjd�dS)NrrPrO�	!disabled)rO)r�)r�)r�rxr�r�r�rPr�)rQrTrTrUr�)s




zKeysPage.set_keys_typecCsJ|jjt�}|jj|�}|j�d}|jj�r:|jj�}n
|jj�}tj	�}|t
dkr�t
d|}x|D]}||j�||<qjWt|j��}t
|d||�j}	|	�r.|jj�r�d}
|j|
�}|s�|jj|�|jj|�dS|j|�|jj|�|jj||d|	�|jj|�|jj|�|jj|	�n|jj|�|jj|�dS)Nrr�zGet New KeyszcYour changes will be saved as a new Custom Key Set. Enter a name for your new Custom Key Set below.z - )r�rrrxr�r�rvrxr-ZGetCurrentKeySetrrr��valuesr/r��get_new_keys_namerr�create_new_key_set�deleter�r�r�)rQ�
list_index�binding�	bind_nameZcurrent_key_set_nameZcurrent_bindings�key_set_changesr�Zcurrent_key_sequences�new_keysr��
new_keysetrTrTrUr�5s<	





zKeysPage.get_new_keyscCs,tjdd�tjdd�}t|d||�j}|S)Nr�r�r�zNew Custom Key Set)r-r�r2r�)rQr�r�r�rTrTrUr�as

zKeysPage.get_new_keys_namecCs|jd�}|r|j|�dS)NzNew Key Set Name:)r�r�)rQZ
new_keys_namerTrTrUr�is
zKeysPage.save_as_new_key_setcCs|jjd�dS)N�	!disabled)r�)r�rP)rQr�rTrTrUr�oszKeysPage.on_bindingslist_selectc
Cs�|jj�r|jj�}n
|jj�}tj|�}i}x.|D]&}|dd�}dj||�}|||<q4W|tdkr�td|}x|D]}||||<q|W|j||�tj	dd�}	|	j
�|jj|	|�|jj
d�|j�dS)Nrhr9r�r�r���)r�rxrvrxr-ZGetCoreKeys�joinrr�save_new_key_setr�rr�rr�r�)
rQZnew_key_set_nameZprev_key_set_nameZ	prev_keysr�r�Z
event_namer�r�Zcustom_key_listrTrTrUr�ss&




zKeysPage.create_new_key_setcCs�d}|jj�rd}|jjt�}tj|�}t|j��}|j�|jj	dt
�xh|D]`}dj||�}|dd�}|tdkr�|td|kr�td||}|jj
t
|d|�qPW|r�|jj|�|jj|�|jj|�dS)	NFTrr9rhr�z - r�)r�r�rrr-Z	GetKeySetr�r�rr�r r�rrr�rrr)rQr�Zreselectr��keysetZ
bind_namesr�r�rTrTrUr��s&


zKeysPage.load_keys_listcCsNtjdj|�s tjdj|�x(|D] }||}tjdj|||�q&WdS)Nr�)r-r�r�r�r�)r�r�r�r�rTrTrUr��s

zKeysPage.save_new_key_setcOstj||�S)N)r,r�)rQr�r�rTrTrUr��szKeysPage.askyesnocCs�|jj�}d}|jd|||d�s&dS|jj�tjd|�tjdd�}|j	�|sp|j
jd
�|jj
|d�n|jj
||d�|jjtjd	jd
d��|jjtjd	jd
d�p�tj��tj�|jj�|jj�|j�dS)Nz0Are you sure you wish to delete the key set %r ?zDelete Key Set)rGr�r�rOz- no custom keys -rr�r�r�r�)rO)rxrxr�r
rqrrr�r-r�rr�rPr�rr�r�r�r�rvr�rsrtrur�)rQr�r�r�rTrTrUr��s*





zKeysPage.delete_custom_keys)r�r�r�rFr�r�rurwr�r�r�r�r�r�r�r�r��staticmethodr�r�r�r�rTrT)r{rUr_2s$!	,r_cs\eZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Z�ZS)r`cs t�j|�|j�|j�dS)N)rzrF�create_page_general�load_general_cfg)rQr�)r{rTrUrF�szGenPage.__init__cCs�tjt|�dQ�|_tjt|�dR�|_tjt|�dS�|_tjt|�dT�|_tjt|�dU�|_tjt|�dV�|_	tjt
|�dW�|_tjt|�dX�|_tjt|�dY�|_
tjt|�dZ�|_tjt|�d[�|_t|dtdd�}t|dtdd�}t|dtdd�}t|dtdd�}t|dd�}t|dd�}t||jdd d!�|_t||jdd"d!�|_t|dd�}t|d#d�}t|d$d�}	t||jd%d&�|_t|d'd�}
t||jd%d&�|_t|dd�}t|d(d�}t|d)|jd*�|_t|dd�}
t|
d+d�}t|
|jd,d-d.d,�|_t|dd�}t|d/d�}t||j	d)d&�|_t|d0|jd1�|_t|dd�}t|d2d�}t||j
dd3d!�|_ t||j
dd4d!�|_!t|dd�}t|d5d�}t||jd6d&�|_"t|dd�}t|d7d�}t||jd%d&�|_#t|dd�}t|d8d�}t|d6|jd*�|_$t|�}t|�}t%|d9d:t&d;�|_'t(|�}|j'j)|d<<|j*|j'd=<|j'j+d>|j,�t-|d?d@dA|j.dB�|_/t-|dCdA|j0dD�|_1t-|dEd@dA|j2dB�|_3|j4t5d9d9t6t7dF�|j4t5d9d9t6t7dF�|j4t5d9d9t6t7dF�|j4t5d9d9t6t7dF�|j4t5d9dt8dG�|j4t9t:d9d9dH�|jj4t;t:d9d9dH�|jj4t;t:d9d9dH�|j4t5d9dt8dG�|j4t9t:d9d9dH�|jj4t;t<dId9dH�|
j4t;t<d9dJ�|jj4t;t<dId9dH�|	j4t;t<d9dJ�|j4t5d9dt8dG�|j4t9t:d9d9dH�|jj4t5dId9dK�|
j4t5d9dt8dG�|j4t9t:d9d9dH�|jj4t5dId9dK�|j4t5d9dt8dG�|j4t9t:d9dL�|jj4t;t<dMd9dH�|jj4t5t:dMd9dH�|j4t5d9dt8dG�|j4t9t:d9d9dH�|j!j4t;t:d9d9dH�|j j4t;t:d9d9dH�|j4t5d9dt8dG�|j4t9t:d9d9dH�|j"j4t5dId9dK�|j4t5d9dt8dG�|j4t9t:d9d9dH�|j#j4t5d9d9dK�|j4t5d9dt8dG�|j4t9t:d9d9dH�|j$j4t5d9d9dK�|j4t;d9d9t=dG�|j4t5d9d9t6t7dF�|j4t;t:t=dN�|j'j4t9t<t6t7dO�|j/j4t5t:d9dJ�|j1j4t5t:dP�|j3j4t5t:d9dJ�dS)\Nr��General�editor-on-startupr�rErDr�r5�	popupwaitr7r�flash-delay�bell�PyShell�auto-squeeze-min-lines�autosaver8�	max-widthr6�maxlinesrhz Window Preferences)r?r�rVz Editor Preferencesz Shell Preferencesz Additional Help Sources r)r?z
At Startup)rVr�zOpen Edit Window)r�r�rVzOpen Shell Windowz$Initial Window Size  (in characters)ZWidthrg)r�rEZHeightz%Completions Popup Wait (milliseconds)rf)rEr�zParen Match StyleZ
expression�openerZparensz;Time Match Displayed (milliseconds)
(0 is until next input)zBell on Mismatch)rVr�zAt Start of Run (F5)  zPrompt to Savez	No PromptzFormat Paragraph Max Widthr
zMax Context Lines :zAuto-Squeeze Min. Lines:r>T)rDrjr�rir�z<ButtonRelease-1>ZEditrOr�)rVrPrEriZAdd)rVrEriZRemove)rXrkr�rYrZ)rXrkr�rZ)rXr�rkr�r�)rXr�r�)rXrkr�)rXr�rkr�)rXr�rZ)rXr�rYrZ)rXr�)r�r�r�)r�r�rE)r�r�rD)r�r5r�)r�r7r)r�r7r�)r�r7r�)r�r�r�)r�r�r�)r�r8r�)r�r6r�)>rOrbr	�startup_editr�	win_width�
win_height�autocomplete_wait�paren_style�flash_delayr�
paren_bell�auto_squeeze_min_linesr��format_width�
context_linesr&rr$r%r)Zstartup_editor_onZstartup_shell_onr#Z
win_width_intZwin_height_intZ
auto_wait_intr'Zparen_style_typeZparen_flash_timer"Zbell_onZsave_ask_onZsave_auto_onZformat_width_intZcontext_intZauto_squeeze_min_lines_intrr�helplistr*r�r�r��help_source_selectedr!�helplist_item_edit�button_helplist_edit�helplist_item_addZbutton_helplist_add�helplist_item_remove�button_helplist_removercrr
rrrrrrr)rQZframe_windowZframe_editorZframe_shellZ
frame_helpZ	frame_runZ
startup_titleZframe_win_sizeZwin_size_titleZwin_width_titleZwin_height_titleZframe_autocompleteZauto_wait_titleZframe_paren1Zparen_style_titleZframe_paren2Zparen_time_titleZ
frame_saveZrun_save_titleZframe_formatZformat_width_titleZ
frame_contextZ
context_titleZframe_auto_squeeze_min_linesZauto_squeeze_min_lines_titleZframe_helplistZframe_helplist_buttonsZscroll_helplistrTrTrUr��s*B






zGenPage.create_page_generalcCs`|jjtjddddd��|jjtjddddd��|jjtjddd	dd��|jjtjd
dddd��|jjtjd
d
d��|jjtjd
d
ddd��|j	jtjd
d
d��|j
jtjdddddd��|jjtjd
dddd��|jjtjd
dddd��|j
jtjddddd��tj�|_|jjdd�x"|jD]}|jjt|d��q8W|j�dS)Nr�r�zeditor-on-startupr�)r�r�rEr�rDr�r5r�r7rzflash-delayr�r�r)r�r�r8z	max-widthr6r�r�zauto-squeeze-min-linesrv)r�r�r-rr�r�r�r�r�r�r�r�r�r�ZGetAllExtraHelpSourcesList�
user_helplistr�r�r�r �set_add_delete_state)rQZ	help_itemrTrTrUr��s6











zGenPage.load_general_cfgcCs|j�dS)N)r)rQr�rTrTrUr�szGenPage.help_source_selectedcCsh|jj�dkr(|jjd�|jjd�n<|jj�rL|jjd�|jjd�n|jjd�|jjd	�dS)
Nr�rO�	!disabled)rO)rO)r)r)rO)rO)r��sizerrPrr�)rQrTrTrUrs
zGenPage.set_add_delete_statecCs:t|d�j}|r6|jj|�|jjt|d�|j�dS)NzNew Help Sourcer)r3r�rr�r�r�r �update_help_changes)rQ�help_sourcerTrTrUrs
zGenPage.helplist_item_addcCsx|jjt�}|j|}t|d|d|dd�j}|rt||krt||j|<|jj|�|jj||d�|j�|j	�dS)NzEdit Help Sourcerr�)Zmenuitem�filepath)
r�rrrr3r�r�r�rr)rQ�
item_indexr	Znew_help_sourcerTrTrUr�%s

zGenPage.helplist_item_editcCs4|jjt�}|j|=|jj|�|j�|j�dS)N)r�rrrr�rr)rQrrTrTrUr9s
zGenPage.helplist_item_removec	CsZitdd<xHtdt|j�d�D]0}tjddt|�dj|j|ddd���q"WdS)Nr�Z	HelpFilesr��;rh)rrr��lenrrr�r�)rQZnumrTrTrUrDs

zGenPage.update_help_changes)
r�r�r�rFr�r�r�rrr�rrr�rTrT)r{rUr`�sz%
r`c@s@eZdZdd�Zdd�Zdd�Zedd��Zd	d
�Zdd�Z	d
S)�VarTracecCsg|_g|_dS)N)�untraced�traced)rQrTrTrUrFPs	zVarTrace.__init__cCs|jj�|jj�dS)N)r�clearr)rQrTrTrUr\s
zVarTrace.clearcCs*t|t�r|j||�}|jj||f�|S)N)�
isinstance�tuple�
make_callbackrr�)rQr��callbackrTrTrUrbbs
zVarTrace.addcs��fdd�}|S)Ncstj��j�f��dS)N)rrrrx)r	)r�r�rTrU�default_callbackvsz0VarTrace.make_callback.<locals>.default_callbackrT)r�r�rrT)r�r�rUrsszVarTrace.make_callbackcCs:x4|jr4|jj�\}}|jd|�|jj||f�qWdS)N�write)r�popZ	trace_addrr�)rQr�rrTrTrUrP{szVarTrace.attachcCsFx@|jr@|jj�\}}|jd|j�dd�|jj||f�qWdS)Nrrr�)rrZtrace_removeZ
trace_inforr�)rQr�rrTrTrU�detach�szVarTrace.detachN)
r�r�r�rFrrbr�rrPrrTrTrTrUrMsra7When 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 milleseconds 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".
)z
Fonts/TabsrWr�r�cCs.|sdSyt|�dStk
r(dSXdS)NTF)r�r�)r�rTrTrUr��sr�c@seZdZdd�ZdS)r�cs�tj||f|�|�t|td�}|jtttd�t|dd|j	dd���jt
ttd�|j
�jd��jd��jd�t��|_��jdd�td����fd	d
�}�jd|����fdd
�}�jd|�dS)N)r�)rZrXrYr��)r?r/r�rE)rXrZrY)ri)Zwindowr�cs$�j��j�f}�jd|d�dS)Nz	0 0 %s %s)Zscrollregion)�winfo_reqwidthZwinfo_reqheightr�)r�r)�canvasr�rTrU�_configure_interior�sz;VerticalScrolledFrame.__init__.<locals>._configure_interiorz<Configure>cs&�j��j�kr"�j��j�d�dS)N)rE)rZwinfo_widthZ
itemconfigure)r�)rr��interior_idrTrU�_configure_canvas�sz9VerticalScrolledFrame.__init__.<locals>._configure_canvas)r$rFr*rrcrrrrr�rrr
r�r�Zxview_movetoZyview_movetor�Z
create_windowrr�)rQrGr��kwZ
vscrollbarrrrT)rr�rrUrF�s 

zVerticalScrolledFrame.__init__N)r�r�r�rFrTrTrTrUr��sr��__main__)r�z#idlelib.idle_test.test_configdialogrhF)�	verbosity�exit)�run)^Ztkinterrrrrrrrr	r
rrr
rrrrrrrrrrrrrrrrrrr Ztkinter.ttkr!r"r#r$r%r&r'r(r)r*r+Ztkinter.colorchooserZcolorchooserr�Ztkinter.fontrr�r,Zidlelib.configr-r.Zidlelib.config_keyr/Zidlelib.dynoptionr0Zidlelibr1Z
idlelib.queryr2r3Zidlelib.textviewr4Zidlelib.autocompleter5Zidlelib.codecontextr6Zidlelib.parenmatchr7Zidlelib.paragraphr8Zidlelib.squeezerr9rrr�r:ryr^r\r_r`rrOr~rr�r�r�Zunittestr�Zidlelib.idle_test.htestr$rTrTrTrU�<module>sh�4

Q4l=+


?>