• File: config_key.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/config_key.cpython-37.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 11.07 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Nj8@sdZddlmZmZmZmZddlmZmZm	Z	m
Z
mZmZddlm
Z
ddlZddlZdZeejejZedZdZd	Zd
ZeeeeeeZddZGd
ddeZedkrddlmZeddddddlm Z e edS)z6
Dialog for building Tkinter accelerator key bindings
)ToplevelListbox	StringVarTclError)FrameButtonCheckbuttonEntryLabel	Scrollbar)
messageboxN)ZF1ZF2ZF3ZF4ZF5ZF6ZF7ZF8ZF9ZF10ZF11ZF12z~!@#%^&*()_-+={}[]|;:,.<>/?)TabSpaceZReturn)Z	BackSpaceZDeleteZInsert)ZHomeZEndzPage Upz	Page Downz
Left ArrowzRight ArrowzUp Arrowz
Down Arrowc$Cs|ddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$#}|||}d%|krr|tjkrr|}d&|S)'z3Translate from keycap symbol to the Tkinter keysym.ZspaceZ
asciitildeZexclamZatZ
numbersignZpercentZasciicircumZ	ampersandZasteriskZ	parenleftZ
parenrightZ
underscoreZminusZplusZequalZ	braceleftZ
bracerightZbracketleftZbracketrightZbarZ	semicolonZcolonZcommaZperiodZlessZgreaterZslashZquestionZPriorZNextZLeftZRightZUpZDownr
)#r~!@#%^&*()_-+={}[]|;:,.<>/?zPage Upz	Page Downz
Left ArrowzRight ArrowzUp Arrowz
Down Arrowr
ShiftzKey-)getstringascii_lowercaseupper)key	modifiersmappingr27/opt/alt/python37/lib64/python3.7/idlelib/config_key.py
translate_keys r4c@seZdZdZdddddZddZdd	Zd
dZdd
ZdddZ	ddZ
ddZddZd ddZ
d!ddZddZddZdS)"
GetKeysDialogzKey Sequence ErrorF)_htest_utestc	CsFt||||jdd|jddd||||||d|j	||_
||_||_d|_
t||_|jd|g|_x,|jD]"}t|}|d|j|qWd|_|||d||d|d||s |d|dnd	f|sB|| d
S)a
        parent - parent of this dialog
        title - string which is the title of the popup dialog
        action - string, the name of the virtual event these keys will be
                 mapped to
        current_key_sequences - list, a list of all key sequence lists
                 currently mapped to virtual events, for overlap checking
        _htest - bool, change box location when running htest
        _utest - bool, do not wait when running unittest
        )borderwidthF)heightwidthZWM_DELETE_WINDOWz+%d+%dN)!r__init__ZwithdrawZ	configureZ	resizabletitleZ	transientZgrab_setZprotocolcancelparentactioncurrent_key_sequencesresultr
key_stringsetset_modifiers_for_platform
modifier_varsr0appendadvancedcreate_widgetsZupdate_idletasksZgeometryZwinfo_rootxZwinfo_widthZwinfo_reqwidthZwinfo_rootyZwinfo_heightZwinfo_reqheightZ	deiconifyZwait_window)	selfrBr@rCrDr6r7modifiervariabler2r2r3r?0s@



*zGetKeysDialog.__init__cOstj||dS)N)r	showerror)rMargskwargsr2r2r3rP`szGetKeysDialog.showerrorc	Cs0t|ddd|_}|jddddt|}|jdd	d
t|dd|jd
|_|jjdddddt|dd|jd
|_|jjdddddt|dd|_	|j	jddddddt
|j	d|jdd}|jddt
|j	d|jddd}|jddd	dt||_
|j
jddddd i|_d}xft|j|jD]T\}}|j||}t|j
|j|||d!d"}	|	jd|ddd#|	|j|<|d7}q0Wt
|j
dd$d%}
|
jddd&ddd't|j
d(d)d*d+|_|jjdBt|jd-|j|jjdd&d&d.d/t|j
d0|jjd1}|jj|jd2|jddd&d.d/t|j
d3|j d4|_!|j!jddd&d5t|d6d|_"|j"jddddddt
|j"dd7|jd8d9d%}|jddt#|j"|jd:|_$|j$jd	d;t||_%|j%jddddd t
|j%dd<d%}
|
jdddd=t||j&d>d?|_'|j'jddd@dddA|&dS)CNr=Zsunken)r9relieftopTZboth)sideexpandfillZbottomx)rUrWZOK)textr;commandrr8)rowcolumnpadxpadyZCancelZkeyseq_basic)nameZnsew)r\r]stickyr^r_zNew keys for 'z' :)rZw)anchorleftZgroove)justifytextvariablerSr9)ZipadxZipadyrW)r\r]rbr^r<)r[rZrOZonvalueZoffvalue)r\r]r^rbzSelect the desired modifier keys
above, and the final key from the
list on the right.

Use upper case Symbols when using
the Shift modifier.  (Letters will be
converted automatically.))rfrZ)r\r]
columnspanr^rb
Zsingle)r;r:Z
selectmodeendz<ButtonRelease-1>ns)r\r]ZrowspanrbZvertical)Zorientr[)Zyscrollcommandz
Clear Keys)rZr[)r\r]riZkeyseq_advancedzEnter new binding(s) for 'z' :
z2(These bindings will not be checked for validity!))rg)rWaKey bindings are specified using Tkinter keysyms as
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!

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

Multiple separate bindings for one action should be
separated by a space, eg., <Alt-v> <Meta-v>.)r\r]rbz<< Basic Key Binding Entry)r[rZZew)r\r]Zstickr^r_)rl)(rframeZpackrokZ	button_okZgridrAZ
button_cancelframe_keyseq_basicr
rCrFframe_controls_basicZmodifier_checkbuttonszipr0rImodifier_labelr+rbuild_key_stringrlist_keys_finalinsertAVAILABLE_KEYSbindfinal_key_selectedryviewconfigrG
clear_key_seqZbutton_clearframe_keyseq_advancedr	
advanced_keysframe_help_advancedtoggle_levelbutton_level)rMrnZ
frame_buttonsZbasic_titleZ
basic_keysr]rNrOZlabelZcheckZ
help_basicZscroll_keys_finalZadvanced_titleZ
help_advancedr2r2r3rLds






zGetKeysDialog.create_widgetscCs4tjdkrddddg|_ndddg|_ddi|_dS)	aVDetermine 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.
        darwinr*ZControlZOptionZCommandZAltZCtrlN)sysplatformr0rs)rMr2r2r3rHs
z(GetKeysDialog.set_modifiers_for_platformcCs|jddrN||jjdd|j|j|j	d|_
n0||jjdd|j|jd|_
dS)	z'Toggle between basic and advanced keys.rZZAdvancedz<< Basic Key Binding Entry)rZTzAdvanced Key Binding Entry >>FN)
rZcget
startswithr|r{r}Zliftrr~Z	focus_setrKrprq)rMr2r2r3rs




zGetKeysDialog.toggle_levelNcCs|dS)z3Handler for clicking on key in basic settings list.N)rt)rMeventr2r2r3rysz GetKeysDialog.final_key_selectedcCsN|}}|jd}|r0t||}|||jdd|ddS)z2Create formatted string of modifiers plus the key.rdr&rr'N)
get_modifiersrur+r4rJrFrGjoin)rMkeylistr0	final_keyr2r2r3rts

zGetKeysDialog.build_key_stringcCsdd|jD}dd|DS)z9Return ordered list of modifiers that have been selected.cSsg|]}|qSr2)r+).0rOr2r2r3
<listcomp>sz/GetKeysDialog.get_modifiers.<locals>.<listcomp>cSsg|]}|r|qSr2r2)rmodr2r2r3rs)rI)rMZmod_listr2r2r3rszGetKeysDialog.get_modifierscCsF|jdd|jddx|jD]}|dq$W|jddS)z#Clear modifiers and keys selection.rrlZmovetoz0.0r<N)ruZselect_clearrzrIrGrF)rMrOr2r2r3r|s
zGetKeysDialog.clear_key_seqcCs\|j}|s(|j|j|dddS|js8||rH||rH||_|	|
dS)NzNo key specified.)r@rBmessage)rFr+striprPkeyerror_titlerKkeys_okbind_okrEgrab_releasedestroy)rMrkeysr2r2r3ros
zGetKeysDialog.okcCsd|_||dS)Nr<)rErr)rMrr2r2r3rA
szGetKeysDialog.cancelcCs|jd}|}|j}dd|jD}|dsF|j||ddnt|sh|ttkrh|j||ddnR|d	gkr|ttd
krd}|j|||dn"||krd}|j|||dnd
SdS)zValidity check on user's 'basic' keybinding selection.

        Doesn't check the string produced by the advanced dialog because
        'modifiers' isn't set.
        rdcSsg|]}|D]}|qqSr2r2)rrr/r2r2r3rsz)GetKeysDialog.keys_ok.<locals>.<listcomp>r'zMissing the final Key)rBrzNo modifier key(s) specified.)r@rBrr*)r
rzBThe shift modifier by itself may not be used with this key symbol.z'This key combination is already in use.TF)	rur+rrrDendswithrP
FUNCTION_KEYS	MOVE_KEYS)rMrrr0r@Z
key_sequencesmsgr2r2r3rs*



zGetKeysDialog.keys_okc
Csdy||dd}Wn:tk
rN}z|j|j|d|ddSd}~XYnX|||dSdS)z:Return True if Tcl accepts the new keys else show message.cSsdS)Nr2r2r2r2r3<lambda>4z'GetKeysDialog.bind_ok.<locals>.<lambda>z2The entered key sequence is not accepted.

Error: )r@rBrFNT)rxrrPrZunbind)rMrZbindingerrr2r2r3r1szGetKeysDialog.bind_ok)N)N)N)__name__
__module____qualname__rr?rPrLrHrryrtrr|rorArrr2r2r2r3r5+s/f
	

r5__main__)mainz!idlelib.idle_test.test_config_keyr=F)	verbosityexit)run)!__doc__ZtkinterrrrrZtkinter.ttkrrrr	r
rrr,rrtupler-ZdigitsZ
ALPHANUM_KEYSZPUNCTUATION_KEYSZWHITESPACE_KEYSZ	EDIT_KEYSrrwr4r5rZunittestrZidlelib.idle_test.htestrr2r2r2r3<module>s*