ó û^‚Rc@s‰dZddlTddlZddlZdefd„ƒYZedkr…eƒZd„Z e edd d e ƒj ƒej ƒndS( s6 Dialog for building Tkinter accelerator key bindings iÿÿÿÿ(t*Nt GetKeysDialogcBsƒeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d d „Z d d „Zd „ZRS(cCs¤tj||ƒ|jddƒ|jdtdtƒ|j|ƒ|j|ƒ|jƒ|jd|j ƒ||_ ||_ ||_ d|_ t|ƒ|_|jjdƒ|jƒg|_x:|jD]/}t|ƒ}|jdƒ|jj|ƒqÍWt|_|jƒ|jƒ|jƒ|jƒ|jd|jƒ|jƒd|jƒd|jƒ|j ƒd|j!ƒdfƒ|j"ƒ|j#ƒd S( sõ 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 t borderwidthitheighttwidthtWM_DELETE_WINDOWts+%d+%diN($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 RRtmodifiertvariable((s./usr/lib/python2.7/idlelib/keybindingDialog.pyR s>                  c CsZt|dddtƒ}|jdtdtdtƒt|ƒ}|jdtdtƒt|ddd d d |j ƒ|_ |j j d d dd ddddƒt|ddd d d |j ƒ|_ |j j d d ddddddƒt|ƒ|_t|ƒ|_t|ƒ|_t|ƒ|_|jj d d dd dtddddƒ|jj d d dd dtddddƒ|jjƒ|jj d ddd dtddƒ|jj d ddd dtddƒ|jjƒt|d |jddƒ|_|jj d ddd dtddddƒt|jdd|jdƒ}|jdtƒt|jdtd|jdtddƒ}|jdddddtƒi|_d }x¡t|j|j ƒD]Š\}}|j!j"||ƒ}t#|jd |j$d|d|d|d d!ƒ} | j d d d|dddtƒ| |j|<|d7}qÂWt|jdtdd"d#d$d%d&d'ƒ} | j d ddd d(d)dddtƒt%|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ƒ} | jdtƒt2|jd|jƒ|_3|j3jdtƒt|jdtdd6d7d8d9d:d;d<ƒ} | j d d dd dtƒdS(=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 sŸin 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., .(4tFrametSUNKENtpacktTOPtTRUEtBOTHtBOTTOMtXtButtonR3tbuttonOKtgridRt buttonCanceltframeKeySeqBasictframeKeySeqAdvancedtframeControlsBasictframeHelpAdvancedtNSEWtliftt ToggleLevelt buttonLeveltEWtLabelRtWtLEFTRtGROOVEtmodifier_checkbuttonstzipRRtmodifier_labeltgett CheckbuttontBuildKeyStringtListboxtSINGLEt listKeysFinaltbindtFinalKeySelectedtNSt ScrollbartVERTICALtyviewtconfigRt ClearKeySeqt buttonCleartEntrytentryKeysAdvanced(R+t frameMaint frameButtonstlabelTitleBasictlabelKeysBasicR6R,R-tlabeltcheckt labelFnAdvicetscrollKeysFinaltlabelTitleAdvancedtlabelHelpAdvanced((s./usr/lib/python2.7/idlelib/keybindingDialog.pyR0s‚ %%++ %%  +  "  "  ( %"    cCsZddlm}|jƒr4ddddg|_ndddg|_idd6|_d S( 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. iÿÿÿÿ(t macosxSupporttShifttControltOptiontCommandtAlttCtrlN(tidlelibR~trunningAsOSXAppRRb(R+R~((s./usr/lib/python2.7/idlelib/keybindingDialog.pyRs  cCs°|jjdƒd dkrl|jƒ|jjddƒ|jjƒ|jjƒ|jjƒt |_ n@|jƒ|jjddƒ|j jƒ|j jƒt |_ dS(NR2itAdvanceds<< Basic Key Binding EntrysAdvanced Key Binding Entry >>(RZtcgetRpRoRTRXRVRst focus_settTrueRRSRUR(R+((s./usr/lib/python2.7/idlelib/keybindingDialog.pyRYŽs        cCs|jƒdS(N(Re(R+tevent((s./usr/lib/python2.7/idlelib/keybindingDialog.pyRjscCsr|jƒ}}|jjtƒ}|rJ|j||ƒ}|j|ƒn|jjdtj |dƒdƒdS(Nt( t GetModifiersRhRctANCHORt TranslateKeyRRRtstringtjoin(R+tkeyListRtfinalKey((s./usr/lib/python2.7/idlelib/keybindingDialog.pyRe s cCs?g|jD]}|jƒ^q }g|D]}|r)|^q)S(N(RRc(R+R-tmodListtmod((s./usr/lib/python2.7/idlelib/keybindingDialog.pyR¨s"cCs[|jjdtƒ|jjtdƒx|jD]}|jdƒq0W|jjdƒdS(Nis0.0R(Rht select_cleartENDRntMOVETORRR(R+R-((s./usr/lib/python2.7/idlelib/keybindingDialog.pyRp¬s c Csd|_ttjtjƒ|_td ƒ|_d|_d|_d|_ |j|j|j|j|j|j }|j j t |ŒdS(NtF1tF2tF4tF5tF6tF7tF8tF9tF10tF11tF12s~!@#%^&*()_-+={}[]|;:,.<>/?tTabtSpacetReturnt BackSpacetDeletetInserttHometEndsPage Ups Page Downs Left Arrows Right ArrowsUp Arrows Down Arrow( R›RœRœRRžRŸR R¡R¢R£R¤R¥(R¦R§R¨(R©RªR«(R¬R­sPage Ups Page Downs Left Arrows Right ArrowsUp Arrows Down Arrow( t functionKeysttupleR’tascii_lowercasetdigitst alphanumKeystpunctuationKeystwhitespaceKeysteditKeystmoveKeysRhtinsertR™(R+tkeys((s./usr/lib/python2.7/idlelib/keybindingDialog.pyR³s    ,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}||jƒkr||}ndF|krD|tjkrD|jƒ}ndG|}|S(Hs2Translate from keycap symbol to the Tkinter keysymtspaceR§t 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.tlessRŒtgreaterRŽtslasht/tquestiont?tPriorsPage UptNexts Page DowntLefts Left ArrowtRights Right ArrowtUpsUp ArrowtDowns Down ArrowR¦RsKey-(R¸R’R°tupper(R+tkeyRt translateDict((s./usr/lib/python2.7/idlelib/keybindingDialog.pyR‘Âs  #  cCs8|js|jƒr4|jjƒ|_|jƒndS(N(RtKeysOKRRcRtdestroy(R+R‹((s./usr/lib/python2.7/idlelib/keybindingDialog.pyR3ÕscCsd|_|jƒdS(NR(RRö(R+R‹((s./usr/lib/python2.7/idlelib/keybindingDialog.pyRÚs c Csj|jjƒ}|jƒ|jjtƒ}|jƒ}|jƒ}t}d}|sttj d|d|ddƒnò|j dƒs¢tj d|d|ddƒnÄ| rÞ||j |j krÞtj d|d|ddƒnˆ|d gkr,||j |j dkr,d }tj d|d|d|ƒn:||j kr`d }tj d|d|d|ƒnt}|S(s©Validity 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.RŽsMissing the final KeysNo modifier key(s) specified.RR¦R§sBThe shift modifier by itself may not be used with this key symbol.s'This key combination is already in use.(sTabsSpace(RRctstripRhRRtsplitRt tkMessageBoxt showerrortendswithR®R¶RRŠ(R+R¸R•Rt keySequencetkeysOKR tmsg((s./usr/lib/python2.7/idlelib/keybindingDialog.pyRõÞs6      N(t__name__t __module__RRRRYRjReRRpRR‘tNoneR3RRõ(((s./usr/lib/python2.7/idlelib/keybindingDialog.pyRs ' O          t__main__cCs'd}ttddgƒ}|jGHdS(NRsGet Keyss find-again(RtrootR(tkeySeqtdlg((s./usr/lib/python2.7/idlelib/keybindingDialog.pytrunsR2tDialogR4( t__doc__tTkinterRúR’RRRtTkRRRORItmainloop(((s./usr/lib/python2.7/idlelib/keybindingDialog.pyts   ü