<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
3
2a`4                 @   sz   d dl T d dlmZ d dl mZ d dlZd dlZG dd deZedkrvd dl	m
Z
 e
d	d
dd d dlmZ ee dS )    )*)	Scrollbar)
messageboxNc               @   s   e Zd ZdZdddddZdd Zdd	 Zd
d Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zd#ddZd$ddZdd  Zd!d" ZdS )%GetKeysDialogzKey Sequence ErrorF)_htest_utestc      	      C   sN  t j| | | j  | jdd | jttd | j| | j| | j  | j	d| j
 || _|| _|| _d| _t| | _| jjd | j  g | _x,| jD ]"}t| }|jd | jj| qW d| _| j  | j  | j  | jd|j |j d | j d   |j |s(|j d | j  d  nd	 f  |sJ| j!  | j"  d S )
N   )borderwidth)heightwidthZWM_DELETE_WINDOW Fz+%d+%d      )#Toplevel__init__ZwithdrawZ	configureZ	resizableZFALSEtitleZ	transientZgrab_setZprotocolCancelparentactioncurrentKeySequencesresultZ	StringVar	keyStringsetSetModifiersForPlatformmodifier_vars	modifiersappendadvancedCreateWidgetsLoadFinalKeyListZupdate_idletasksZgeometryZwinfo_rootxZwinfo_widthZwinfo_reqwidthZwinfo_rootyZwinfo_heightZwinfo_reqheightZ	deiconifyZwait_window)	selfr   r   r   r   r   r   modifiervariable r#   //opt/alt/python36/lib64/python3.6/config_key.pyr      sB    




*zGetKeysDialog.__init__c             O   s   t j|| d S )N)r   	showerror)r    argskwargsr#   r#   r$   r%   >   s    zGetKeysDialog.showerrorc          	   C   s  t | dtd}|jtttd t | }|jttd t|dd| j	d| _
| j
jddd	d	d
 t|dd| jd| _| jjddd	d	d
 t || _t || _t || _t || _| jjddtd	d	d | jjddtd	d	d | jj  | jjddtd	d | jjddtd	d | jj  t|| jdd| _| jjddtd	d	d t| jd| j d d}|jtd t| jt| jtdd}|jd	d	td i | _d}xft| j| j D ]T\}}| j!j"||}t#| j| j$|||dd}	|	jd|dtd |	| j|< |d7 }qW t| jtd?d!}
|
jddd"dtd# t%| jd$d%t&d&| _'| j'j(d'| j) | j'jdd"d"t*d( t+| jt,| j'j-d)}| j'j.|j/d* |jdd	d"t*d( t| jd+| j0d,| _1| j1jddd"d- t| jtd.| j d/ d0 d!}|jtd t2| j| jd1| _3| j3jtd2 t| jtdEd!}|jddtd: d S )FNr   )r	   relief)sideexpandfill)r)   r+   OK   )textr   commandr   r   )rowcolumnpadxpadyr      )r0   r1   stickyr2   r3   )r0   r1   r5   r2   zAdvanced Key Binding Entry >>)r/   r.   )r0   r1   Zstickr2   r3   zNew keys for  'z' :)r.   )Zanchor)justifytextvariabler(   r	   )ZipadxZipadyr+   r   )r/   r.   r"   ZonvalueZoffvalue)r0   r1   r2   r5   z!Select the desired modifier keys
z"above, and the final key from the
zlist on the right.

z"Use upper case Symbols when using
z&the Shift modifier.  (Letters will be
zconverted automatically.))r6   r.      )r0   r1   
columnspanr2   r5      
   )r   r
   Z
selectmodez<ButtonRelease-1>)r0   r1   Zrowspanr5   )Zorientr/   )Zyscrollcommandz
Clear Keys)r.   r/   )r0   r1   r9   zEnter new binding(s) for  'z' :
z2(These bindings will not be checked for validity!))r7   )r+   z4Key bindings are specified using Tkinter keysyms as
zin 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!

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

z4Multiple separate bindings for one action should be
z,separated by a space, eg., <Alt-v> <Meta-v>.)r0   r1   r5   zCSelect the desired modifier keys
above, and the final key from the
zWSelect the desired modifier keys
above, and the final key from the
list on the right.

zySelect the desired modifier keys
above, and the final key from the
list on the right.

Use upper case Symbols when using
zSelect 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
zSelect 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.)zKey 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!

a  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
a@  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
aa  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.

a  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
a  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>.)4ZFrameZSUNKENpackZTOPZTRUEZBOTHZBOTTOMXZButtonr,   ZbuttonOKZgridr   ZbuttonCancelframeKeySeqBasicframeKeySeqAdvancedframeControlsBasicframeHelpAdvancedZNSEWliftToggleLevelbuttonLevelZEWZLabelr   WZLEFTr   ZGROOVEZmodifier_checkbuttonszipr   r   modifier_labelgetZCheckbuttonBuildKeyStringZListboxZSINGLElistKeysFinalbindFinalKeySelectedZNSr   ZVERTICALyviewconfigr   ClearKeySeqZbuttonClearZEntryentryKeysAdvanced)r    Z	frameMainZframeButtonsZlabelTitleBasicZlabelKeysBasicr1   r!   r"   ZlabelZcheckZlabelFnAdviceZscrollKeysFinalZlabelTitleAdvancedZlabelHelpAdvancedr#   r#   r$   r   B   s    







 


 zGetKeysDialog.CreateWidgetsc             C   s4   t jdkrddddg| _ndddg| _ddi| _d S )NdarwinShiftZControlZOptionZCommandZAltZCtrl)sysplatformr   rG   )r    r#   r#   r$   r      s    
z%GetKeysDialog.SetModifiersForPlatformc             C   s   | j jdd d dkrT| j  | j jdd | jj  | jj  | jj  d| _	n0| j  | j jdd | j
j  | jj  d| _	d S )	Nr.   r-   ZAdvancedz<< Basic Key Binding Entry)r.   TzAdvanced Key Binding Entry >>F)rD   ZcgetrO   rN   r?   rB   rA   rP   Z	focus_setr   r>   r@   )r    r#   r#   r$   rC      s    




zGetKeysDialog.ToggleLevelc             C   s   | j   d S )N)rI   )r    eventr#   r#   r$   rL      s    zGetKeysDialog.FinalKeySelectedc             C   sP   | j   }}| jjt}|r2| j||}|j| | jjddj| d  d S )N<->)	GetModifiersrJ   rH   ANCHORTranslateKeyr   r   r   join)r    ZkeyListr   finalKeyr#   r#   r$   rI      s    
zGetKeysDialog.BuildKeyStringc             C   s   dd | j D }dd |D S )Nc             S   s   g | ]}|j  qS r#   )rH   ).0r"   r#   r#   r$   
<listcomp>   s    z.GetKeysDialog.GetModifiers.<locals>.<listcomp>c             S   s   g | ]}|r|qS r#   r#   )r^   modr#   r#   r$   r_      s    )r   )r    ZmodListr#   r#   r$   rY      s    zGetKeysDialog.GetModifiersc             C   sF   | j jdt | j jtd x| jD ]}|jd q$W | jjd d S )Nr   z0.0r   )rJ   Zselect_clearENDrM   ZMOVETOr   r   r   )r    r"   r#   r#   r$   rO      s
    zGetKeysDialog.ClearKeySeqc             C   sn   d| _ ttjtj | _td| _d| _d| _d| _	| j| j | j  | j | j | j	 }| j
jtf|  d S ) NF1F2F3F4F5F6F7F8F9F10F11F12z~!@#%^&*()_-+={}[]|;:,.<>/?TabSpaceReturn	BackSpaceDeleteInsertHomeEndPage Up	Page Down
Left ArrowRight ArrowUp Arrow
Down Arrow)rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   )rn   ro   rp   )rq   rr   rs   )rt   ru   rv   rw   rx   ry   rz   r{   )functionKeystuplestringascii_lowercasedigitsZalphanumKeysZpunctuationKeysZwhitespaceKeysZeditKeysmoveKeysrJ   insertra   )r    keysr#   r#   r$   r      s     
 $zGetKeysDialog.LoadFinalKeyListc          $   C   s   ddddddddd	d
dddddddddddddddddddddd d!d"d#d$#}||kr\|| }d%|krv|t jkrv|j }d&| }|S )'NZspaceZ
asciitildeZexclamZatZ
numbersignpercentZasciicircumZ	ampersandZasteriskZ	parenleftZ
parenrightZ
underscoreZminusZplusZequalZ	braceleftZ
bracerightZbracketleftZbracketrightZbarZ	semicolonZcolonZcommaZperiodZlessZgreaterZslashZquestionZPriorZNextZLeftZRightZUpZDownrn   )#ro   ~!@#%^&r   ()_rW   +={}[]|;:,.rV   rX   /?zPage Upz	Page Downz
Left ArrowzRight ArrowzUp Arrowz
Down Arrowrn   rR   zKey-)r~   r   upper)r    keyr   ZtranslateDictr#   r#   r$   r[      s     

zGetKeysDialog.TranslateKeyNc             C   s\   | j j j }|s(| j| j| dd d S | js8| j|rH| j|rH|| _| j	  | j
  d S )NzNo key specified.)r   r   message)r   rH   stripr%   keyerror_titler   KeysOKbind_okr   grab_releasedestroy)r    rU   r   r#   r#   r$   r,      s    
zGetKeysDialog.OKc             C   s   d| _ | j  | j  d S )Nr   )r   r   r   )r    rU   r#   r#   r$   r      s    zGetKeysDialog.Cancelc             C   s   | j jt}| j }d}| j}dd | jD }|jdsJ| j|| dd n~| rr|| j| j	 krr| j|| dd nV|d	gkr|| j| j	 d krd}| j|| |d n"||krd}| j|| |d nd}|S )NFc             S   s   g | ]}|D ]}|qqS r#   r#   )r^   Zkeylistr   r#   r#   r$   r_     s    z(GetKeysDialog.KeysOK.<locals>.<listcomp>rX   zMissing the final Key)r   r   zNo modifier key(s) specified.)r   r   r   rR   rn   ro   zBThe shift modifier by itself may not be used with this key symbol.z'This key combination is already in use.T)rn   ro   )
rJ   rH   rZ   rY   r   r   endswithr%   r|   r   )r    r   r]   r   ZkeysOKr   Zkey_sequencesmsgr#   r#   r$   r      s,    



zGetKeysDialog.KeysOKc             C   sb   y| j |dd }W n8 tk
rL } z| j| j| d| d dS d }~X nX | j|| dS d S )Nc               S   s   d S )Nr#   r#   r#   r#   r$   <lambda>  s    z'GetKeysDialog.bind_ok.<locals>.<lambda>z2The entered key sequence is not accepted.

Error: )r   r   r   FT)rK   ZTclErrorr%   r   Zunbind)r    r   Zbindingerrr#   r#   r$   r     s    zGetKeysDialog.bind_ok)N)N)__name__
__module____qualname__r   r   r%   r   r   rC   rL   rI   rY   rO   r   r[   r,   r   r   r   r#   r#   r#   r$   r      s    -O

!r   __main__)mainz!idlelib.idle_test.test_config_keyr   F)	verbosityexit)run)ZtkinterZtkinter.ttkr   r   r~   rS   r   r   r   Zunittestr   Zidlelib.idle_test.htestr   r#   r#   r#   r$   <module>   s     