Your IP : 3.145.168.68


Current Path : /opt/alt/python34/lib64/python3.4/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/idlelib/__pycache__/keybindingDialog.cpython-34.pyc

�
e f�0�@szdZddlTddljZddlZddlZGdd�de�Ze	dkrvddl
mZee�ndS)z6
Dialog for building Tkinter accelerator key bindings
�)�*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)a3
        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
        _htest - bool, change box location when running htest
        �borderwidth��height�widthZWM_DELETE_WINDOW�Fz+%d+%d��N)#�Toplevel�__init__Z	configureZ	resizableZFALSE�titleZ	transientZgrab_setZprotocol�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)�selfrr
rrZ_htest�modifier�variable�r�=/opt/alt/python34/lib64/python3.4/idlelib/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�expandZfill�text�OKr�Zcommand�rowr�columnZpadxrZpadyr�ZstickyzAdvanced Key Binding Entry >>ZstickzNew keys for  'z' :ZanchorZjustifyZtextvariableZipadxZipadyrZonvalueZoffvaluerz!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>.)4ZFrameZSUNKENZpackZTOPZTRUEZBOTHZBOTTOM�XZButtonr#ZbuttonOKZgridrZbuttonCancel�frameKeySeqBasic�frameKeySeqAdvanced�frameControlsBasic�frameHelpAdvancedZNSEW�lift�ToggleLevel�buttonLevelZEWZLabelr�WZLEFTrZGROOVEZmodifier_checkbuttons�ziprr�modifier_label�getZCheckbutton�BuildKeyStringZListboxZSINGLE�
listKeysFinalZbind�FinalKeySelectedZNSZ	ScrollbarZVERTICAL�yview�configr�ClearKeySeqZbuttonClearZEntry�entryKeysAdvanced)rZ	frameMainZframeButtonsZlabelTitleBasicZlabelKeysBasicr&rrZlabelZcheckZ
labelFnAdviceZscrollKeysFinalZlabelTitleAdvancedZlabelHelpAdvancedrrr r5s�%%++
%%
+	"	"

(%"

zGetKeysDialog.CreateWidgetscCsMtjdkr'ddddg|_ndddg|_idd6|_dS)	aUDetermine 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.
        �darwin�ShiftZControlZOptionZCommandZAltZCtrlN)�sys�platformrr5)rrrr 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)r2Zcgetr<r;r-r0r/r=Z	focus_setrr,r.)rrrr r1�s"






zGetKeysDialog.ToggleLevelcCs|j�dS)N)r7)r�eventrrr r9�szGetKeysDialog.FinalKeySelectedcCso|j�}}|jjt�}|rJ|j||�}|j|�n|jjddj|�d�dS)N�<�-�>)	�GetModifiersr8r6�ANCHOR�TranslateKeyrrr�join)rZkeyListr�finalKeyrrr r7�szGetKeysDialog.BuildKeyStringcCs'dd�|jD�}dd�|D�S)NcSsg|]}|j��qSr)r6)�.0rrrr �
<listcomp>�s	z.GetKeysDialog.GetModifiers.<locals>.<listcomp>cSsg|]}|r|�qSrr)rK�modrrr rL�s	)r)rZmodListrrr rF�szGetKeysDialog.GetModifierscCs[|jjdt�|jjtd�x|jD]}|jd�q0W|jjd�dS)Nrz0.0r)r8Zselect_clear�ENDr:ZMOVETOrrr)rrrrr r<�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)rOrPrPrQrRrSrTrUrVrWrXrY)rZr[r\)r]r^r_)r`rarbrcrdrerfrg)
�functionKeys�tuple�string�ascii_lowercaseZdigitsZalphanumKeysZpunctuationKeysZwhitespaceKeysZeditKeys�moveKeysr8�insertrN)r�keysrrr r�s				,zGetKeysDialog.LoadFinalKeyListcCsLi#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}||kr||}ndF|kr>|tjkr>|j�}ndG|}|S)Hz2Translate from keycap symbol to the Tkinter keysymZspacer[Z
asciitilde�~Zexclam�!�at�@Z
numbersign�#Zpercent�%Zasciicircum�^Z	ampersand�&ZasteriskrZ	parenleft�(Z
parenright�)Z
underscore�_ZminusrDZplus�+Zequal�=Z	braceleft�{Z
braceright�}Zbracketleft�[Zbracketright�]Zbar�|Z	semicolon�;Zcolon�:Zcomma�,Zperiod�.ZlessrCZgreaterrEZslash�/Zquestion�?ZPriorzPage UpZNextz	Page DownZLeftz
Left ArrowZRightzRight ArrowZUpzUp ArrowZDownz
Down ArrowrZr?zKey-)rjrk�upper)r�keyrZ
translateDictrrr rH�s 
#

zGetKeysDialog.TranslateKeyNcCs8|js|j�r4|jj�|_|j�ndS)N)r�KeysOKrr6r�destroy)rrBrrr r#�szGetKeysDialog.OKcCsd|_|j�dS)Nr)rr�)rrBrrr 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)z�Validity check on user's 'basic' keybinding selection.

        Doesn't check the string produced by the advanced dialog because
        'modifiers' isn't set.

        FzKey Sequence Errorr
r�messagezNo keys specified.rEzMissing the final KeyzNo modifier key(s) specified.r?rZr[zBThe shift modifier by itself may not be used with this key symbol.z'This key combination is already in use.T)zTabzSpace)
rr6�stripr8rGrF�split�tkMessageBoxZ	showerror�endswithrhrlr)rrnrJrZkeySequenceZkeysOKr
�msgrrr r��s6



zGetKeysDialog.KeysOK)�__name__�
__module__�__qualname__rrrr1r9r7rFr<rrHr#rr�rrrr r	s+Or�__main__)�run)�__doc__ZtkinterZtkinter.messageboxZ
messageboxr�rjr@rrr�Zidlelib.idle_test.htestr�rrrr �<module>s
�

?>