Your IP : 52.15.49.90


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/keybindingDialog.cpython-35.opt-2.pyc



���]�0�@sqddlTddljZddlZddlZGdd�de�Zedkrmddl	m
Z
e
e�dS)�)�*Nc@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zddd�Z
ddd�Zdd�ZdS)�
GetKeysDialogFcCs�tj||�|jdd�|jdtdt�|j|�|j|�|j�|jd|j	�||_
||_||_d|_
t|�|_|jjd�|j�g|_x:|jD]/}t|�}|jd�|jj|�q�Wd|_|j�|j�|j�|j�|jd|j�|j�d	|j�d	|j�|s�|j�d	|j �d	nd
f�|j!�|j"�dS)N�borderwidth��height�widthZWM_DELETE_WINDOW�Fz+%d+%d��)#�Toplevel�__init__Z	configureZ	resizable�FALSE�titleZ	transientZgrab_set�protocol�Cancel�parent�action�currentKeySequences�resultZ	StringVar�	keyString�set�SetModifiersForPlatform�
modifier_vars�	modifiers�append�advanced�
CreateWidgets�LoadFinalKeyListZwithdrawZupdate_idletasksZgeometryZwinfo_rootxZwinfo_widthZwinfo_reqwidthZwinfo_rootyZwinfo_heightZwinfo_reqheightZ	deiconifyZwait_window)�selfrrrrZ_htest�modifier�variable�r!�5/opt/alt/python35/lib64/python3.5/keybindingDialog.pyr
s@


				
	
	



		0
zGetKeysDialog.__init__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)=Nrr	ZreliefZside�expand�fill�text�OKr�Zcommand�rowr�columnZpadxrZpadyr�ZstickyzAdvanced Key Binding Entry >>ZstickzNew keys for  'z' :ZanchorZjustifyZtextvariableZipadxZipadyr ZonvalueZoffvaluerz!Select the desired modifier keys
z"above, and the final key from the
zlist on the right.

z"Use upper case Symbols when using
z&the Shift modifier.  (Letters will be
zconverted automatically.)Z
columnspan��r�
Z
selectmodez<ButtonRelease-1>ZrowspanZorientZyscrollcommandz
Clear KeyszEnter new binding(s) for  'z' :
z2(These bindings will not be checked for validity!)z4Key bindings are specified using Tkinter keysyms as
z�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!

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>.)4ZFrameZSUNKEN�packZTOP�TRUEZBOTHZBOTTOM�XZButtonr&ZbuttonOKZgridrZbuttonCancel�frameKeySeqBasic�frameKeySeqAdvanced�frameControlsBasic�frameHelpAdvancedZNSEW�lift�ToggleLevel�buttonLevelZEWZLabelr�WZLEFTrZGROOVEZmodifier_checkbuttons�ziprr�modifier_label�getZCheckbutton�BuildKeyStringZListboxZSINGLE�
listKeysFinal�bind�FinalKeySelectedZNSZ	ScrollbarZVERTICAL�yview�configr�ClearKeySeqZbuttonClearZEntry�entryKeysAdvanced)rZ	frameMainZframeButtonsZlabelTitleBasicZlabelKeysBasicr)rr Zlabel�checkZ
labelFnAdviceZscrollKeysFinalZlabelTitleAdvancedZlabelHelpAdvancedr!r!r"r5s�%%++
%%
+	"	"

(%"

zGetKeysDialog.CreateWidgetscCsLtjdkr'ddddg|_ndddg|_ddi|_dS)N�darwin�ShiftZControlZOptionZCommandZAltZCtrl)�sys�platformrr:)rr!r!r"r�sz%GetKeysDialog.SetModifiersForPlatformcCs�|jjd�dd�dkrr|j�|jjdd�|jj�|jj�|jj�d|_	n@|j�|jjdd�|j
j�|jj�d|_	dS)Nr%r'ZAdvancedz<< Basic Key Binding EntryTzAdvanced Key Binding Entry >>F)r7ZcgetrBrAr2r5r4rCZ	focus_setrr1r3)rr!r!r"r6�s"






zGetKeysDialog.ToggleLevelcCs|j�dS)N)r<)r�eventr!r!r"r?�szGetKeysDialog.FinalKeySelectedcCsl|j�}}|jjt�}|rG|j||�}|j|�|jjddj|�d�dS)N�<�-�>)	�GetModifiersr=r;�ANCHOR�TranslateKeyrrr�join)rZkeyListr�finalKeyr!r!r"r<�s
zGetKeysDialog.BuildKeyStringcCs'dd�|jD�}dd�|D�S)NcSsg|]}|j��qSr!)r;)�.0r r!r!r"�
<listcomp>�s	z.GetKeysDialog.GetModifiers.<locals>.<listcomp>cSsg|]}|r|�qSr!r!)rR�modr!r!r"rS�s	)r)rZmodListr!r!r"rM�szGetKeysDialog.GetModifierscCs[|jjdt�|jjtd�x|jD]}|jd�q0W|jjd�dS)Nrz0.0r)r=Zselect_clear�ENDr@ZMOVETOrrr)rr r!r!r"rB�s
zGetKeysDialog.ClearKeySeqcCs�d|_ttjtj�|_td�|_d|_d|_d|_	|j|j|j|j|j|j	}|j
jt|�dS)N�F1�F2�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)rVrWrWrXrYrZr[r\r]r^r_r`)rarbrc)rdrerf)rgrhrirjrkrlrmrn)
�functionKeys�tuple�string�ascii_lowercase�digitsZalphanumKeysZpunctuationKeysZwhitespaceKeysZeditKeys�moveKeysr=�insertrU)r�keysr!r!r"r�s				,zGetKeysDialog.LoadFinalKeyListcFCs#ddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdEi#}||kr�||}dF|kr|tjkr|j�}dG|}|S)HNrbZspace�~Z
asciitilde�!Zexclam�@Zat�#Z
numbersign�%�percent�^Zasciicircum�&Z	ampersandrZasterisk�(Z	parenleft�)Z
parenright�_Z
underscorerKZminus�+Zplus�=Zequal�{Z	braceleft�}Z
braceright�[Zbracketleft�]Zbracketright�|Zbar�;Z	semicolon�:Zcolon�,Zcomma�.ZperiodrJZlessrLZgreater�/Zslash�?ZquestionzPage UpZPriorz	Page DownZNextz
Left ArrowZLeftzRight ArrowZRightzUp ArrowZUpz
Down ArrowZDownrarFzKey-)rqrr�upper)r�keyrZ
translateDictr!r!r"rO�s 

zGetKeysDialog.TranslateKeyNcCs5|js|j�r1|jj�|_|j�dS)N)r�KeysOKrr;r�destroy)rrIr!r!r"r&�szGetKeysDialog.OKcCsd|_|j�dS)Nr)rr�)rrIr!r!r"r�s	zGetKeysDialog.CancelcCsj|jj�}|j�|jjt�}|j�}|j�}d}d}|sttjd|d|dd�n�|j	d�s�tjd|d|dd�n�|r�||j
|jkr�tjd|d|dd	�n�|d
gkr,||j
|jdkr,d
}tjd|d|d|�n:||jkr`d}tjd|d|d|�nd}|S)NFzKey Sequence Errorrr�messagezNo keys specified.rLzMissing the final KeyzNo modifier key(s) specified.rFrarbzBThe shift modifier by itself may not be used with this key symbol.z'This key combination is already in use.T)rarb)
rr;�stripr=rNrM�split�tkMessageBoxZ	showerror�endswithrortr)rrvrQrZkeySequenceZkeysOKr�msgr!r!r"r��s6



zGetKeysDialog.KeysOK)�__name__�
__module__�__qualname__rrrr6r?r<rMrBrrOr&rr�r!r!r!r"r	s+Or�__main__)�run)�tkinterZtkinter.messageboxZ
messageboxr�rqrGrrr�Zidlelib.idle_test.htestr�r!r!r!r"�<module>s
�

?>