Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/idlelib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/idlelib/__pycache__/config_key.cpython-38.pyc
U

@��g�8�@s�dZddlmZmZmZmZddlmZmZm	Z	m
Z
mZmZddlm
Z
ddlmZddlZddlZdZeejej�Zed�Zd	Zd
ZdZeeeeeeZdd
�ZGdd�de�Zedkr�ddlm Z e dddd�ddl!m"Z"e"e�dS)z6
Dialog for building Tkinter accelerator key bindings
�)�Toplevel�Listbox�	StringVar�TclError)�Frame�Button�Checkbutton�Entry�Label�	Scrollbar)�
messagebox)�
_setup_dialogN)ZF1ZF2ZF3ZF4ZF5ZF6ZF7ZF8ZF9ZF10ZF11ZF12z~!@#%^&*()_-+={}[]|;:,.<>/?)�Tab�SpaceZReturn)Z	BackSpaceZDeleteZInsert)ZHomeZEnd�Page Up�	Page Down�
Left Arrow�Right Arrow�Up Arrow�
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
numbersign�percentZasciicircumZ	ampersandZasteriskZ	parenleftZ
parenrightZ
underscoreZminusZplusZequalZ	braceleftZ
bracerightZbracketleftZbracketrightZbarZ	semicolonZcolonZcommaZperiodZlessZgreaterZslashZquestionZPriorZNextZLeftZRightZUpZDownr)#r�~�!�@�#�%�^�&�*�(�)�_�-�+�=�{�}�[�]�|�;�:�,�.�<�>�/�?rrrrrrr�ShiftzKey-)�get�string�ascii_lowercase�upper)�key�	modifiers�mapping�r:�1/opt/cppython/lib/python3.8/idlelib/config_key.py�
translate_keysP�r<c@s�eZdZdZddd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zddd�Z	dd�Z
dd�Zdd�Zd dd�Z
d!dd�Zdd�Zdd�ZdS)"�
GetKeysDialogzKey Sequence ErrorF)�_htest�_utestc	CsJt�||�|��|jdd�|jddd�|�|�|�|�t|�|��|�	d|j
�||_||_||_
d|_t|�|_|j�d�|��g|_|jD]"}t|�}|�d�|j�|�q�d|_|��|��|�d|��|��d|��d|��|�s$|��d|��dnd	f�|�sF|� �|�!�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)�height�widthZWM_DELETE_WINDOW�z+%d+%d��N)"r�__init__ZwithdrawZ	configureZ	resizable�titleZ	transientr
Zgrab_set�protocol�cancel�parent�action�current_key_sequences�resultr�
key_string�set�set_modifiers_for_platform�
modifier_varsr8�append�advanced�create_widgetsZupdate_idletasksZgeometryZwinfo_rootxZwinfo_widthZwinfo_reqwidthZwinfo_rootyZwinfo_heightZwinfo_reqheightZ	deiconifyZwait_window)	�selfrKrHrLrMr>r?�modifier�variabler:r:r;rG1sN




�����zGetKeysDialog.__init__cOstj||�dS�N)r�	showerror)rV�args�kwargsr:r:r;rZbszGetKeysDialog.showerrorc	Cs,t|ddd�|_}|jdddd�t|�}|jdd	d
�t|dd|jd
�|_|jjddddd�t|dd|jd
�|_|jjddddd�t|dd�|_	|j	jdddddd�t
|j	d|j�d�d�}|jdd�t
|j	d|jddd�}|jddd	d�t|�|_
|j
jddddd �i|_d}t|j|j�D]T\}}|j�||�}t|j
|j|||d!d"�}	|	jd|ddd#�|	|j|<|d7}�q.t
|j
dd$d%�}
|
jddd&ddd'�t|j
d(d)d*d+�|_|jjdBt��|j�d-|j�|jjdd&d&d.d/�t|j
d0|jjd1�}|jj|jd2�|jddd&d.d/�t|j
d3|j d4�|_!|j!jddd&d5�t|d6d�|_"|j"jdddddd�t
|j"dd7|j�d8�d9d%�}|jdd�t#|j"|jd:�|_$|j$jd	d;�t|�|_%|j%jddddd �t
|j%dd<d%�}
|
jdddd=�t||j&d>d?�|_'|j'jddd@dddA�|�&�dS)CNrEZsunken)rA�relief�topTZboth)�side�expand�fillZbottom�x)r_raZOK�)�textrC�commandrr@)�row�column�padx�padyZCancel�Zkeyseq_basic)�nameZnsew)rfrg�stickyrhrizNew keys for 'z' :�rd�w)�anchor�leftZgroove)�justify�textvariabler]rA)ZipadxZipadyra)rfrgrlrhrD)rerdrXZonvalueZoffvalue)rfrgrhrlz�Select 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.))rqrd�)rfrg�
columnspanrhrl��
Zsingle)rCrBZ
selectmode�endz<ButtonRelease-1>�ns)rfrgZrowspanrlZvertical)Zorientre)Zyscrollcommandz
Clear Keys)rdre)rfrgrtZkeyseq_advancedzEnter new binding(s) for 'z' :
z2(These bindings will not be checked for validity!))rr)raa�Key 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>.)rfrgrl�<< Basic Key Binding Entry)rerdZew)rfrgZstickrhri)rw)(r�frame�packr�okZ	button_okZgridrJZ
button_cancel�frame_keyseq_basicr
rLrO�frame_controls_basicZmodifier_checkbuttons�zipr8rR�modifier_labelr3r�build_key_stringr�list_keys_final�insert�AVAILABLE_KEYS�bind�final_key_selectedr�yview�configrP�
clear_key_seqZbutton_clear�frame_keyseq_advancedr	�
advanced_keys�frame_help_advanced�toggle_level�button_level)rVrzZ
frame_buttonsZbasic_titleZ
basic_keysrgrWrXZlabel�checkZ
help_basicZscroll_keys_finalZadvanced_titleZ
help_advancedr:r:r;rUfs������
�
��������
�
�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.
        �darwinr2ZControlZOptionZCommandZAltZCtrlN)�sys�platformr8r��rVr:r:r;rQ�s
z(GetKeysDialog.set_modifiers_for_platformcCs�|j�d��d�rN|��|jjdd�|j��|j��|j�	�d|_
n0|��|jjdd�|j��|j��d|_
dS)	z'Toggle between basic and advanced keys.rdZAdvancedryrmTzAdvanced Key Binding Entry >>FN)
r�Zcget�
startswithr�r�r�Zliftr�r�Z	focus_setrTr}r~r�r:r:r;r��s




zGetKeysDialog.toggle_levelNcCs|��dS)z3Handler for clicking on key in basic settings list.N)r��rV�eventr:r:r;r��sz GetKeysDialog.final_key_selectedcCsN|��}}|j�d�}|r0t||�}|�|�|j�dd�|��d��dS)z2Create formatted string of modifiers plus the key.ror.r"r/N)�
get_modifiersr�r3r<rSrOrP�join)rV�keylistr8�	final_keyr:r:r;r��s

zGetKeysDialog.build_key_stringcCsdd�|jD�}dd�|D�S)z9Return ordered list of modifiers that have been selected.cSsg|]}|���qSr:)r3)�.0rXr:r:r;�
<listcomp>�sz/GetKeysDialog.get_modifiers.<locals>.<listcomp>cSsg|]}|r|�qSr:r:)r��modr:r:r;r��s)rR)rVZmod_listr:r:r;r��szGetKeysDialog.get_modifierscCsB|j�dd�|j�dd�|jD]}|�d�q"|j�d�dS)z#Clear modifiers and keys selection.rrwZmovetoz0.0rDN)r�Zselect_clearr�rRrPrO)rVrXr:r:r;r��s

zGetKeysDialog.clear_key_seqcCs\|j����}|s(|j|j|dd�dS|js8|�|�rH|�|�rH||_|�	�|�
�dS)NzNo key specified.�rHrK�message)rOr3�striprZ�keyerror_titlerT�keys_ok�bind_okrN�grab_release�destroy)rVr��keysr:r:r;r|s
�zGetKeysDialog.okcCsd|_|��|��dS)NrD)rNr�r�r�r:r:r;rJszGetKeysDialog.cancelcCs�|j�d�}|��}|j}dd�|jD�}|�d�sF|j||dd�nt|sh|ttkrh|j||dd�nR|d	gkr�|ttd
kr�d}|j|||d�n"||kr�d}|j|||d�nd
SdS)z�Validity check on user's 'basic' keybinding selection.

        Doesn't check the string produced by the advanced dialog because
        'modifiers' isn't set.
        rocSsg|]}|D]}|�qqSr:r:)r�r�r7r:r:r;r�s�z)GetKeysDialog.keys_ok.<locals>.<listcomp>r/zMissing the final Key)rKr�zNo modifier key(s) specified.r�r2)rrzBThe shift modifier by itself may not be used with this key symbol.z'This key combination is already in use.TF)	r�r3r�r�rM�endswithrZ�
FUNCTION_KEYS�	MOVE_KEYS)rVr�r�r8rHZ
key_sequences�msgr:r:r;r�s4
�
��

��zGetKeysDialog.keys_okc
Csjz|�|dd��}Wn@tk
rT}z"|j|j|d|��d�WY�dSd}~XYnX|�||�dSdS)z:Return True if Tcl accepts the new keys else show message.cSsdSrYr:r:r:r:r;�<lambda>6�z'GetKeysDialog.bind_ok.<locals>.<lambda>z2The entered key sequence is not accepted.

Error: r�FNT)r�rrZr�Zunbind)rVr�Zbinding�errr:r:r;r�3s�zGetKeysDialog.bind_ok)N)N)N)�__name__�
__module__�__qualname__r�rGrZrUrQr�r�r�r�r�r|rJr�r�r:r:r:r;r=,s �1f
	

r=�__main__)�mainz!idlelib.idle_test.test_config_keyrEF)�	verbosity�exit)�run)#�__doc__�tkinterrrrrZtkinter.ttkrrrr	r
rrZtkinter.simpledialogr
r4r�r��tupler5�digitsZ
ALPHANUM_KEYSZPUNCTUATION_KEYSZWHITESPACE_KEYSZ	EDIT_KEYSr�r�r<r=r�Zunittestr�Zidlelib.idle_test.htestr�r:r:r:r;�<module>s8 
���

F1le Man4ger