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

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


��Qc@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	�Zd
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
        tborderwidthitheighttwidthtWM_DELETE_WINDOWts+%d+%diN($tToplevelt__init__t	configuret	resizabletFALSEttitlet	transienttgrab_settprotocoltCanceltparenttactiontcurrentKeySequencestresultt	StringVart	keyStringtsettSetModifiersForPlatformt
modifier_varst	modifierstappendtFalsetadvancedt
CreateWidgetstLoadFinalKeyListtwithdrawtupdate_idletaskstgeometrytwinfo_rootxtwinfo_widthtwinfo_reqwidthtwinfo_rootytwinfo_heighttwinfo_reqheightt	deiconifytwait_window(tselfRRRRtmodifiertvariable((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR	s>


				
	
	



	
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>.(4tFrametSUNKENtpacktTOPtTRUEtBOTHtBOTTOMtXtButtonR3tbuttonOKtgridRtbuttonCanceltframeKeySeqBasictframeKeySeqAdvancedtframeControlsBasictframeHelpAdvancedtNSEWtlifttToggleLeveltbuttonLeveltEWtLabelRtWtLEFTRtGROOVEtmodifier_checkbuttonstzipRRtmodifier_labeltgettCheckbuttontBuildKeyStringtListboxtSINGLEt
listKeysFinaltbindtFinalKeySelectedtNSt	ScrollbartVERTICALtyviewtconfigRtClearKeySeqtbuttonCleartEntrytentryKeysAdvanced(R+t	frameMaintframeButtonstlabelTitleBasictlabelKeysBasicR6R,R-tlabeltcheckt
labelFnAdvicetscrollKeysFinaltlabelTitleAdvancedtlabelHelpAdvanced((s./sys/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./sys/lib/python2.7/idlelib/keybindingDialog.pyRs
cCs�|jjd�d dkrl|j�|jjdd�|jj�|jj�|jj�t	|_
n@|j�|jjdd�|jj�|jj�t
|_
dS(NR2itAdvanceds<< Basic Key Binding EntrysAdvanced Key Binding Entry >>(RZtcgetRpRoRTRXRVRst	focus_settTrueRRSRUR(R+((s./sys/lib/python2.7/idlelib/keybindingDialog.pyRY�s






cCs|j�dS(N(Re(R+tevent((s./sys/lib/python2.7/idlelib/keybindingDialog.pyRj�scCsr|j�}}|jjt�}|rJ|j||�}|j|�n|jjdtj	|d�d�dS(Nt<t-t>(
tGetModifiersRhRctANCHORtTranslateKeyRRRtstringtjoin(R+tkeyListRtfinalKey((s./sys/lib/python2.7/idlelib/keybindingDialog.pyRe�scCs?g|jD]}|j�^q
}g|D]}|r)|^q)S(N(RRc(R+R-tmodListtmod((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR��s"cCs[|jjdt�|jjtd�x|jD]}|jd�q0W|jjd�dS(Nis0.0R(Rhtselect_cleartENDRntMOVETORRR(R+R-((s./sys/lib/python2.7/idlelib/keybindingDialog.pyRp�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alphanumKeystpunctuationKeystwhitespaceKeysteditKeystmoveKeysRhtinsertR�(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�RsKey-(R�R�R�tupper(R+tkeyRt
translateDict((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR��s 
#

cCs8|js|j�r4|jj�|_|j�ndS(N(RtKeysOKRRcRtdestroy(R+R�((s./sys/lib/python2.7/idlelib/keybindingDialog.pyR3�scCsd|_|j�dS(NR(RR�(R+R�((s./sys/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(RRctstripRhR�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__RRRRYRjReR�RpRR�tNoneR3RR�(((s./sys/lib/python2.7/idlelib/keybindingDialog.pyRs	'	O								t__main__cCs'd}ttddg�}|jGHdS(NRsGet Keyss
find-again(RtrootR(tkeySeqtdlg((s./sys/lib/python2.7/idlelib/keybindingDialog.pytrunsR2tDialogR4(
t__doc__tTkinterR�R�RRRtTkRRRORItmainloop(((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 [email protected].