Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/idlelib/keybindingDialog.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@swdZddlTddlZddlZddlZdefd��YZedkrsddlm	Z	e	e�ndS(s6
Dialog for building Tkinter accelerator key bindings
i�(t*Nt
GetKeysDialogcBs�eZed�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
d
�Zd
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�|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
        tborderwidthitheighttwidthtWM_DELETE_WINDOWts+%d+%dii�N($tToplevelt__init__t	configuret	resizabletFALSEttitlet	transienttgrab_settprotocoltCanceltparenttactiontcurrentKeySequencestresultt	StringVart	keyStringtsettSetModifiersForPlatformt
modifier_varst	modifierstappendtFalsetadvancedt
CreateWidgetstLoadFinalKeyListtwithdrawtupdate_idletaskstgeometrytwinfo_rootxtwinfo_widthtwinfo_reqwidthtwinfo_rootytwinfo_heighttwinfo_reqheightt	deiconifytwait_window(tselfRRRRt_htesttmodifiertvariable((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR
s@


				
	
	



		0
c
CsZt|dddt�}|jdtdtdt�t|�}|jdtdt�t|ddd	d
d|j	�|_
|j
jdd
dd
dddd�t|ddd	d
d|j�|_
|j
jdd
dddddd�t|�|_t|�|_t|�|_t|�|_|jjdd
dd
dtdddd�|jjdd
dd
dtdddd�|jj�|jjdddd
dtdd�|jjdddd
dtdd�|jj�t|d|jdd�|_|jjd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!�}	|	jdd
d|dddt�|	|j|<|d7}q�Wt|jdtdd"d#d$d%d&d'�}
|
jdddd
d(d)dddt�t%|jd	d*d+d,d-t&�|_'|j'j(d.|j)�|j'jdd
dd)d/d)dt*�t+|jd0t,d|j'j-�}|j'j.d1|j/�|jdd
ddd/d)dt*�t|jdd2d|j0�|_1|j1jdddd
d(d)�t|jdtdd3|jd4d5�}|jdt�t2|jd|j�|_3|j3jdt�t|jdtdd6d7d8d9d:d;d<�}
|
jd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
selectmodes<ButtonRelease-1>trowspantorienttyscrollcommands
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: <Control-f>, <Shift-F2>, <F12>,
<Control-space>, <Meta-less>, <Control-Alt-Shift-X>.
Upper case is used when the Shift modifier is present!

s8'Emacs style' multi-keystroke bindings are specified as
s5follows: <Control-x><Control-y>, where the first key
s!is the 'do-nothing' keybinding.

s4Multiple separate bindings for one action should be
s,separated by a space, eg., <Alt-v> <Meta-v>.(4tFrametSUNKENtpacktTOPtTRUEtBOTHtBOTTOMtXtButtonR4tbuttonOKtgridRtbuttonCanceltframeKeySeqBasictframeKeySeqAdvancedtframeControlsBasictframeHelpAdvancedtNSEWtlifttToggleLeveltbuttonLeveltEWtLabelRtWtLEFTRtGROOVEtmodifier_checkbuttonstzipRRtmodifier_labeltgettCheckbuttontBuildKeyStringtListboxtSINGLEt
listKeysFinaltbindtFinalKeySelectedtNSt	ScrollbartVERTICALtyviewtconfigRtClearKeySeqtbuttonCleartEntrytentryKeysAdvanced(R+t	frameMaintframeButtonstlabelTitleBasictlabelKeysBasicR7R-R.tlabeltcheckt
labelFnAdvicetscrollKeysFinaltlabelTitleAdvancedtlabelHelpAdvanced((s./sys/lib/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./sys/lib/python2.7/idlelib/keybindingDialog.pyR�scCs�|jjd�d dkrl|j�|jjdd�|jj�|jj�|jj�t	|_
n@|j�|jjdd�|jj�|jj�t
|_
dS(NR3itAdvanceds<< Basic Key Binding EntrysAdvanced Key Binding Entry >>(R[tcgetRqRpRURYRWRtt	focus_settTrueRRTRVR(R+((s./sys/lib/python2.7/idlelib/keybindingDialog.pyRZ�s






cCs|j�dS(N(Rf(R+tevent((s./sys/lib/python2.7/idlelib/keybindingDialog.pyRk�scCsr|j�}}|jjt�}|rJ|j||�}|j|�n|jjdtj	|d�d�dS(Nt<t-t>(
tGetModifiersRiRdtANCHORtTranslateKeyRRRtstringtjoin(R+tkeyListRtfinalKey((s./sys/lib/python2.7/idlelib/keybindingDialog.pyRf�scCs?g|jD]}|j�^q
}g|D]}|r)|^q)S(N(RRd(R+R.tmodListtmod((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR��s"cCs[|jjdt�|jjtd�x|jD]}|jd�q0W|jjd�dS(Nis0.0R(Ritselect_cleartENDRotMOVETORRR(R+R.((s./sys/lib/python2.7/idlelib/keybindingDialog.pyRq�s
cCs�d|_ttjtj�|_td�|_d|_d|_d|_	|j|j|j|j|j|j	}|j
jt|�dS(NtF1tF2tF4tF5tF6tF7tF8tF9tF10tF11tF12s~!@#%^&*()_-+={}[]|;:,.<>/?tTabtSpacetReturnt	BackSpacetDeletetInserttHometEndsPage Ups	Page Downs
Left ArrowsRight ArrowsUp Arrows
Down Arrow(R�R�R�R�R�R�R�R�R�R�R�R�(R�R�R�(R�R�R�(R�R�sPage Ups	Page Downs
Left ArrowsRight ArrowsUp Arrows
Down Arrow(
tfunctionKeysttupleR�tascii_lowercasetdigitstalphanumKeystpunctuationKeystwhitespaceKeysteditKeystmoveKeysRitinsertR�(R+tkeys((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR�s				,cCsRi#dd6dd6dd6dd6d	d
6dd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%tasciicircumt^t	ampersandt&tasteriskRt	parenleftt(t
parenrightt)t
underscoret_tminusR�tplust+tequalt=t	braceleftt{t
bracerightt}tbracketleftt[tbracketrightt]tbart|t	semicolont;tcolont:tcommat,tperiodt.tlessR�tgreaterR�tslasht/tquestiont?tPriorsPage UptNexts	Page DowntLefts
Left ArrowtRightsRight ArrowtUpsUp ArrowtDowns
Down ArrowR�R�sKey-(R�R�R�tupper(R+tkeyRt
translateDict((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR��s 
#

cCs8|js|j�r4|jj�|_|j�ndS(N(RtKeysOKRRdRtdestroy(R+R�((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR4�scCsd|_|j�dS(NR(RR�(R+R�((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR�s	cCsj|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.R�R�R�sBThe shift modifier by itself may not be used with this key symbol.s'This key combination is already in use.(sTabsSpace(RRdtstripRiR�R�tsplitRttkMessageBoxt	showerrortendswithR�R�RR�(R+R�R�RtkeySequencetkeysOKRtmsg((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR��s6



N(t__name__t
__module__RRRRRZRkRfR�RqRR�tNoneR4RR�(((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR	s+	O								t__main__(trun(
t__doc__tTkinterR�R�R�RRRtidlelib.idle_test.htestR(((s./sys/lib/python2.7/idlelib/keybindingDialog.pyt<module>s
�

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.