î Óê[§ã@s‡dZddlTddljZGdd„deƒZedkrƒddlZej ddd d d ƒdd l m Z e eƒndS) a 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. é)Ú*Nc@sUeZdZddd„Zdd„Zdd„Zdd d „Zdd d „ZdS) ÚGetCfgSectionNameDialogFcCsAtj||ƒ|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) zÒ 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 Ú borderwidthéZheightÚwidthZWM_DELETE_WINDOWz+%d+%déédN)ÚToplevelÚ__init__Z configureZ resizableZFALSEÚtitleZ transientZgrab_setZprotocolÚCancelÚparentÚmessageÚ used_namesÚcreate_widgetsZwithdrawZupdate_idletasksÚ messageInfoZconfigÚ frameMainZwinfo_reqwidthZgeometryZ winfo_rootxZ winfo_widthZ winfo_rootyZ winfo_heightZwinfo_reqheightZ deiconifyZ wait_window)Úselfr r rrZ_htest©rú5/usr/lib/python3.4/idlelib/configSectionNameDialog.pyr s,           0 z GetCfgSectionNameDialog.__init__c Csˆt|jƒ|_t|jƒ|_t|dddtƒ|_|jjdtdt dt ƒt |jdt dt d d d d d |jƒ|_t|jd |jddƒ}|jƒ|jjd d d d ƒ|jd d d d ƒt|d dƒ}|jdtƒt|d dddd|jƒ|_|jjdt d d ƒt|d dddd|jƒ|_|jjdtd d ƒdS)NrrZreliefZsideÚexpandZfillZanchorZjustifyZpadxrZpadyÚtextZ textvariableréÚOkéZcommandr )Z StringVarr ÚnameZfontSizeZFrameZSUNKENrZpackZTOPZTRUEZBOTHZMessageÚWZLEFTrrZEntryZ focus_setZBOTTOMZButtonrZbuttonOkr Z buttonCancelZRIGHT)rZ entryNameZ frameButtonsrrrr+s$ z&GetCfgSectionNameDialog.create_widgetscCs­|jjƒjƒ}|s:tjddddd|ƒnot|ƒdkrutjdddddd|ƒd }n4||jkr©tjdddd d|ƒd }n|S) z‹ After stripping entered name, check that it is a sensible ConfigParser file section name. Return it if it is, '' if not. r z Name ErrorrzNo name specified.r rz)Name too long. It should be no more than z30 characters.ÚzThis name is already in use.)rÚgetÚstripÚ tkMessageBoxZ showerrorÚlenr)rrrrrÚname_ok@s   zGetCfgSectionNameDialog.name_okNcCs,|jƒ}|r(||_|jƒndS)N)r"ÚresultÚdestroy)rÚeventrrrrrSs  zGetCfgSectionNameDialog.OkcCsd|_|jƒdS)Nr)r#r$)rr%rrrr Ys zGetCfgSectionNameDialog.Cancel)Ú__name__Ú __module__Ú __qualname__r rr"rr rrrrr s   rÚ__main__z"idlelib.idle_test.test_config_nameÚ verbosityrÚexitF)Úrun) Ú__doc__ZtkinterZtkinter.messageboxZ messageboxr r rr&ZunittestÚmainZidlelib.idle_test.htestr,rrrrÚs S