�`^c@s�dZddlTddlZdefd��YZedkr�ddlZejddd d
e�ddl m
Z
e
e�ndS(s
Dialog that allows user to specify a new config file section name.
Used to get new highlight theme and keybinding set names.
The 'return value' for the dialog, used two placed in configDialog.py,
is the .result attribute set in the Ok and Cancel methods.
i�(t*NtGetCfgSectionNameDialogcBs>eZed�Zd�Zd�Zdd�Zdd�ZRS(cCsAtj||�|jdd�|jdtdt�|j|�|j|�|j�|jd|j �||_
||_||_|j
�|j�|j�|jjd|jj��|jd|j�|j�d|j�d|j�|s|j�d|j�dndf�|j�|j�d S(
s�
message - string, informational message to display
used_names - string collection, names already in use for validity check
_htest - bool, change box location when running htest
tborderwidthitheighttwidthtWM_DELETE_WINDOWs+%d+%diidN(tToplevelt__init__t configuret resizabletFALSEttitlet transienttgrab_settprotocoltCanceltparenttmessaget
used_namestcreate_widgetstwithdrawtupdate_idletaskstmessageInfotconfigt frameMaintwinfo_reqwidthtgeometrytwinfo_rootxtwinfo_widthtwinfo_rootytwinfo_heighttwinfo_reqheightt deiconifytwait_window(tselfRRRRt_htest((s5/sys/lib/python2.7/idlelib/configSectionNameDialog.pyR
s,
0
cCs�t|j�|_t|j�|_t|dddt�|_|jjdtdt dt
�t|jdtdt
d d
dd
d|j�|_t|jd
|jdd�}|j�|jjd d
dd
�|jd d
dd
�t|dd�}|jdt�t|ddddd|j�|_|jjdt
d d
�t|ddddd|j�|_|jjdtd d
�dS(NRitrelieftsidetexpandtfilltanchortjustifytpadxitpadyttextttextvariableRitOkitcommandR(t StringVarRtnametfontSizetFrametSUNKENRtpacktTOPtTRUEtBOTHtMessagetWtLEFTRRtEntryt focus_settBOTTOMtButtonR.tbuttonOkRtbuttonCanceltRIGHT(R"t entryNametframeButtons((s5/sys/lib/python2.7/idlelib/configSectionNameDialog.pyR)s$
cCs�|jj�j�}|s:tjddddd|�not|�dkrutjdddddd|�d }n4||jkr�tjdddd
d|�d }n|S(s� After stripping entered name, check that it is a sensible
ConfigParser file section name. Return it if it is, '' if not.
Rs
Name ErrorRsNo name specified.Ris)Name too long. It should be no more than s30 characters.tsThis name is already in use.(R1tgettstripttkMessageBoxt showerrortlenR(R"R1((s5/sys/lib/python2.7/idlelib/configSectionNameDialog.pytname_ok=s
cCs,|j�}|r(||_|j�ndS(N(RKtresulttdestroy(R"teventR1((s5/sys/lib/python2.7/idlelib/configSectionNameDialog.pyR.Os cCsd|_|j�dS(NRE(RLRM(R"RN((s5/sys/lib/python2.7/idlelib/configSectionNameDialog.pyRTs N( t__name__t
__module__tFalseRRRKtNoneR.R(((s5/sys/lib/python2.7/idlelib/configSectionNameDialog.pyR s
t__main__s"idlelib.idle_test.test_config_namet verbosityitexit(trun(t__doc__tTkinterRHRRROtunittesttmainRQtidlelib.idle_test.htestRV(((s5/sys/lib/python2.7/idlelib/configSectionNameDialog.pyt<module>s
N
|