eaiovnaovbqoebvqoeavibavo  V~gc@swdZddlTddlZddlZddlZdefdYZedkrsddlm Z e endS(s6 Dialog for building Tkinter accelerator key bindings i(t*Nt GetKeysDialogcBseZedZdZdZdZdZdZdZ dZ dZ d Z d d Zd d Zd ZRS(cCstj|||jdd|jdtdt|j||j||j|jd|j ||_ ||_ ||_ d|_ t||_|jjd|jg|_x:|jD]/}t|}|jd|jj|qWt|_|j|j|j|j|jd|j|jd|jd|j|s|j d|j!dnd f|j"|j#d S( s3 action - string, the name of the virtual event these keys will be mapped to currentKeys - list, a list of all key sequence lists currently mapped to virtual events, for overlap checking _htest - bool, change box location when running htest t borderwidthitheighttwidthtWM_DELETE_WINDOWts+%d+%diiN($tToplevelt__init__t configuret resizabletFALSEttitlet transienttgrab_settprotocoltCanceltparenttactiontcurrentKeySequencestresultt StringVart keyStringtsettSetModifiersForPlatformt modifier_varst modifierstappendtFalsetadvancedt CreateWidgetstLoadFinalKeyListtwithdrawtupdate_idletaskstgeometryt winfo_rootxt winfo_widthtwinfo_reqwidtht winfo_rootyt winfo_heighttwinfo_reqheightt deiconifyt wait_window(tselfRR RRt_htesttmodifiertvariable((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyR s@                  0 c CsZt|dddt}|jdtdtdtt|}|jdtdtt|ddd d d |j |_ |j j d d dd ddddt|ddd d d |j |_ |j j d d ddddddt||_t||_t||_t||_|jj d d dd dtdddd|jj d d dd dtdddd|jj|jj d ddd dtdd|jj d ddd dtdd|jjt|d |jdd|_|jj d ddd dtddddt|jdd|jd}|jdtt|jdtd|jdtdd}|jdddddti|_d }xt|j|j D]\}}|j!j"||}t#|jd |j$d|d|d|d d!} | j d d d|dddt| |j|<|d7}qWt|jdtdd"d#d$d%d&d'} | j d ddd d(d)dddtt%|jd d*d+d,d-t&|_'|j'j(d.|j)|j'j d d dd)d/d)dt*t+|jd0t,d |j'j-} |j'j.d1| j/| j d d ddd/d)dt*t|jdd2d |j0|_1|j1j d ddd d(d)t|jdtdd3|jd4d5} | jdtt2|jd|j|_3|j3jdtt|jdtdd6d7d8d9d:d;d<} | j d d dd dtdS(=NRitrelieftsidetexpandtfillttexttOKRitcommandtrowitcolumntpadxitpadyRitstickysAdvanced Key Binding Entry >>tsticksNew keys for 's' :tanchortjustifyt textvariabletipadxtipadyR.tonvaluetoffvalueRs!Select the desired modifier keys s"above, and the final key from the slist on the right. s"Use upper case Symbols when using s&the Shift modifier. (Letters will be sconverted automatically.)t columnspaniiRi t selectmodestrowspantorienttyscrollcommands Clear KeyssEnter new binding(s) for 's' : s2(These bindings will not be checked for validity!)s4Key bindings are specified using Tkinter keysyms as sin these samples: , , , , , . Upper case is used when the Shift modifier is present! s8'Emacs style' multi-keystroke bindings are specified as s5follows: , where the first key s!is the 'do-nothing' keybinding. s4Multiple separate bindings for one action should be s,separated by a space, eg., .(4tFrametSUNKENtpacktTOPtTRUEtBOTHtBOTTOMtXtButtonR4tbuttonOKtgridRt buttonCanceltframeKeySeqBasictframeKeySeqAdvancedtframeControlsBasictframeHelpAdvancedtNSEWtliftt ToggleLevelt buttonLeveltEWtLabelRtWtLEFTRtGROOVEtmodifier_checkbuttonstzipRRtmodifier_labeltgett CheckbuttontBuildKeyStringtListboxtSINGLEt listKeysFinaltbindtFinalKeySelectedtNSt ScrollbartVERTICALtyviewtconfigRt ClearKeySeqt buttonCleartEntrytentryKeysAdvanced(R+t frameMaint frameButtonstlabelTitleBasictlabelKeysBasicR7R-R.tlabeltcheckt labelFnAdvicetscrollKeysFinaltlabelTitleAdvancedtlabelHelpAdvanced((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyR5s %%++ %%  +  "  "  ( %"    cCsMtjdkr'ddddg|_ndddg|_idd6|_dS( sUDetermine list of names of key modifiers for this platform. The names are used to build Tk bindings -- it doesn't matter if the keyboard has these keys, it matters if Tk understands them. The order is also important: key binding equality depends on it, so config-keys.def must use the same ordering. tdarwintShifttControltOptiontCommandtAlttCtrlN(tsystplatformRRc(R+((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyRscCs|jjdd dkrl|j|jjdd|jj|jj|jjt |_ n@|j|jjdd|j j|j jt |_ dS(NR3itAdvanceds<< Basic Key Binding EntrysAdvanced Key Binding Entry >>(R[tcgetRqRpRURYRWRtt focus_settTrueRRTRVR(R+((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyRZs        cCs|jdS(N(Rf(R+tevent((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyRkscCsr|j}}|jjt}|rJ|j||}|j|n|jjdtj |dddS(Nt( t GetModifiersRiRdtANCHORt TranslateKeyRRRtstringtjoin(R+tkeyListRtfinalKey((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyRfs cCs?g|jD]}|j^q }g|D]}|r)|^q)S(N(RRd(R+R.tmodListtmod((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyRs"cCs[|jjdt|jjtdx|jD]}|jdq0W|jjddS(Nis0.0R(Rit select_cleartENDRotMOVETORRR(R+R.((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyRqs c Csd|_ttjtj|_td |_d|_d|_d|_ |j|j|j|j|j|j }|j j t |dS( NtF1tF2tF3tF4tF5tF6tF7tF8tF9tF10tF11tF12s~!@#%^&*()_-+={}[]|;:,.<>/?tTabtSpacetReturnt BackSpacetDeletetInserttHometEndsPage Ups Page Downs Left Arrows Right ArrowsUp Arrows Down Arrow( RRRRRRRRRRRR(RRR(RRR(RRsPage Ups Page Downs Left Arrows Right ArrowsUp Arrows Down Arrow( t functionKeysttupleRtascii_lowercasetdigitst alphanumKeystpunctuationKeystwhitespaceKeysteditKeystmoveKeysRitinsertR(R+tkeys((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyRs    ,cCsRi#dd6dd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdE6}||jkr||}ndF|krD|tjkrD|j}ndG|}|S(Hs2Translate from keycap symbol to the Tkinter keysymtspaceRt asciitildet~texclamt!tatt@t numbersignt#tpercentt%t asciicircumt^t ampersandt&tasteriskRt parenleftt(t parenrightt)t underscoret_tminusRtplust+tequalt=t braceleftt{t bracerightt}t bracketleftt[t bracketrightt]tbart|t semicolont;tcolont:tcommat,tperiodt.tlessRtgreaterRtslasht/tquestiont?tPriorsPage UptNexts Page DowntLefts Left ArrowtRights Right ArrowtUpsUp ArrowtDowns Down ArrowRRsKey-(RRRtupper(R+tkeyRt translateDict((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyRs  #  cCsB|js|jr>|jj|_|j|jndS(N(RtKeysOKRRdRt grab_releasetdestroy(R+R((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyR4s cCs!d|_|j|jdS(NR(RRR(R+R((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyRs  cCsj|jj}|j|jjt}|j}|j}t}d}|sttj d|d|ddn|j dstj d|d|ddn| r||j |j krtj d|d|ddn|d gkr,||j |j dkr,d }tj d|d|d|n:||j kr`d }tj d|d|d|nt}|S(sValidity check on user's 'basic' keybinding selection. Doesn't check the string produced by the advanced dialog because 'modifiers' isn't set. sKey Sequence ErrorR RtmessagesNo keys specified.RsMissing the final KeysNo modifier key(s) specified.RRRsBThe shift modifier by itself may not be used with this key symbol.s'This key combination is already in use.(RR(RRdtstripRiRRtsplitRt tkMessageBoxt showerrortendswithRRRR(R+RRRt keySequencetkeysOKR tmsg((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyRs6      N(t__name__t __module__RRRRRZRkRfRRqRRtNoneR4RR(((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyR s + O          t__main__(trun( t__doc__tTkinterRRRRRRtidlelib.idle_test.htestR(((s=/opt/alt/python27/lib64/python2.7/idlelib/keybindingDialog.pyts