Your IP : 3.145.92.213


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



���]�H�@s�ddlZddlZddlZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdPZdQZdRZdSZdTZdUZej dkr�dZZ!eeeefZ"nd_Z!eeeefZ"e#d d!�e$e%e!��D��Z&d"Z'Gd#d$�d$�Z(e$de%e!�>�Z)d%d!�e)D�Z*d&d'�Z+e+e)�Z,gZ-xZe)D]RZ.dZ/x6e$e%e!��D]"Z0de0>e.@r�e/e"e0OZ/q�We-j1e/�q�WGd(d)�d)�Z2dwZ3e2fde(fe%e3�dZ4e#dCd!�e$e%e3��D��Z5ej6dD�Z7ej6dE�Z8dFdG�Z9dHdI�Z:iZ;dJdK�Z<dLdM�Z=e>dNkr�ddOl?m@Z@e@e=�dS)x�N���������	�
���
����������darwin�Shift�Control�Option�Command�Alt�Meta�McCs-g|]#}t|D]}||f�qqS�)�
_modifiers)�.0�number�namer r �./opt/alt/python35/lib64/python3.5/MultiCall.py�
<listcomp>7s	r&zapplication has been destroyedc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
_SimpleBindercCsJ||_dt|dd|_||_||_g|_d|_dS)N�<r�>)�type�_types�sequence�widget�
widgetinst�bindedfuncs�	handlerid)�selfr*r-r.r r r%�__init__Js				z_SimpleBinder.__init__cCsV|jsB|j|jdd�}|jj|j|j|�|_|jj|�dS)NcSsp||_i}xZtt|�ddd�D]<}||}||kr,d||<||�}|r,|Sq,WdS)NrT���r3)�mc_type�range�len)�event�lr4�	wascalled�i�func�rr r r%�handlerTs	#

z#_SimpleBinder.bind.<locals>.handler)r0r/r*r-�bindr.r,�append)r1�tripletr;r=r r r%r>Rs
	
z_SimpleBinder.bindcCsE|jj|�|jsA|jj|j|j|j�d|_dS)N)r/�remover-�unbindr.r,r0)r1r@r;r r r%rBbs	z_SimpleBinder.unbindcCsq|jrmy#|jj|j|j|j�Wn>tjk
rl}zt|jdkrZ�WYdd}~XnXdS)Nr)	r0r-rBr.r,�tkinter�TclError�APPLICATION_GONE�args)r1�er r r%�__del__hs	z_SimpleBinder.__del__N)�__name__�
__module__�__qualname__r2r>rBrHr r r r%r'Isr'cs8g|].�dj�fdd�tt�D���qS)�c3s1|]'\}}d|>�@r|ddVqdS)rr�-Nr )r"r:�m)�sr r%�	<genexpr>ws	z<listcomp>.<genexpr>)�join�	enumerater!)r"r )rOr%r&ws	csodd�}g}xV|D]N�tt�fdd�|D���}|jd|dd�|j|�qW|S)NcSs6d}x)|r1t|d�\}}||7}q	W|S)Nrr)�divmod)�n�nb�remr r r%�nbits�s
	zexpand_substates.<locals>.nbitsc3s|]}�|@VqdS)Nr )r"�x)�stater r%rP�sz#expand_substates.<locals>.<genexpr>�key�reverseT)�list�set�sortr?)ZstatesrWZ	statelistZ	substatesr )rYr%�expand_substates|s
%r_c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�_ComplexBindercCs%||||j|jdd�}|S)NcSs�dg|dd�<||_||_i}d}xs|D]k}x[tt|�ddd�D]=}	||	}
|
|kr[d||
<||	|�}|r[Pq[W|r8Pq8Wg|dd�<x|D]
}|�q�Wg|dd�<|r�|SdS)NTrr3r3)r4�mc_stater5r6)r7�listsr4ra�ishandlerrunning�doafterhandlerr9r<r8r:r;�fr r r%r=�s*		
#


z0_ComplexBinder.__create_handler.<locals>.handler)rcrd)r1rbr4rar=r r r%Z__create_handler�s
z_ComplexBinder.__create_handlercs�|�_t|d�_|�_|�_ddd�tD�i�_g�_g�_g�_	x�tD]�}�fdd�t
|D�}�j||t|�}dt
|�jd}�jj|�jj�j||�f�qjWdS)NrcSsg|]}g�qSr r )r"rOr r r%r&�s	z+_ComplexBinder.__init__.<locals>.<listcomp>cs!g|]}�jd|�qS)N)r/)r"r:)r1r r%r&�s	r(r))r*r+�typenamer-r.�_statesr/�
handleridsrcrd�_state_subsets�_ComplexBinder__create_handler�_state_codes�_state_namesr?r>)r1r*r-r.rOrbr=�seqr )r1r%r2�s						
z_ComplexBinder.__init__cs�d�jkr�dd�tD��j�d<x�tD]����fdd��ddfD�}�j|�jt��}dt��j�df}�jj|�j	j
�j||�f�q8W���fdd�}�js�|�n�j
j|�dS)NrcSsg|]}g�qSr r )r"rOr r r%r&�s	z'_ComplexBinder.bind.<locals>.<listcomp>cs2g|](}t�D]}�j||�qqSr )rir/)r"�detailr:)rOr1r r%r&�s	z	<%s%s-%s>cs �j�d�dj��S)Nrr)r/r?r )r;r1r@r r%�<lambda>�sz%_ComplexBinder.bind.<locals>.<lambda>)r/rgrjr*rkrlrfrhr?r-r>r.rcrd)r1r@r;rbr=rm�doitr )r;rOr1r@r%r>�s

	
z_ComplexBinder.bindcs?���fdd�}�js+|�n�jj|�dS)Ncs �j�d�dj��S)Nrr)r/rAr )r;r1r@r r%ro�sz'_ComplexBinder.unbind.<locals>.<lambda>)rcrdr?)r1r@r;rpr )r;r1r@r%rB�s	
z_ComplexBinder.unbindcCs|xu|jD]j\}}y|jj|j||�Wq
tjk
rs}zt|jdkra�WYdd}~Xq
Xq
WdS)Nr)rhr-rBr.rCrDrErF)r1rm�idrGr r r%rH�sz_ComplexBinder.__del__N)rIrJrKrjr2r>rBrHr r r r%r`�s
r`�KeyPress�Key�
KeyRelease�ButtonPress�Button�
ButtonRelease�Activate�	Circulate�Colormap�	Configure�
Deactivate�Destroy�Enter�Expose�FocusIn�FocusOut�Gravity�Leave�Map�Motion�
MouseWheel�Property�Reparent�Unmap�
VisibilitycCs-g|]#}t|D]}||f�qqSr )r+)r"r#r$r r r%r&s	z^\w+$z^[1-5]$cCsY|s'|ddks'|d
dkr+dS|dd�jd�}d}x7|r�|dtkr�|dt|d>O}|d=qMW|r�|dtkr�t|d}|d=ndSt|tkr�|s�|r�dSd}nm|dd�dD�krt}nt}|sd}n6t|�dkrH|j|d�rH|d}ndS|||fS)
Nrr(rr)rMcSsg|]}t|�qSr )�_type_names)r"rOr r r%r&$s	z#_parse_sequence.<locals>.<listcomp>rrrtr3r3)rrrt)	�split�_modifier_namesr��_binder_classesr'�
_keysym_re�
_button_rer6�match)r,Zwords�	modifiersr*rnZtype_rer r r%�_parse_sequences0'
			%
r�cCsb|dr:dt|dt|ddd|ddSdt|dt|dddSdS)Nrr(rrrMr))rlr+)r@r r r%�_triplet_to_sequence2s
0r�cs>�tkrt�SG�fdd�d��}|t�<|S)Ncs�eZdZ�fdd�Zddd�fdd�Zd�fdd�Z�fdd	�Z�fd
d�Zd�fdd
�Zdd�Z	dS)z#MultiCallCreator.<locals>.MultiCallcsK�j�||�i�_��fdd�ttt��D��_dS)Ncs&g|]}t||����qSr )r�)r"r:)r1r-r r%r&Ks	z@MultiCallCreator.<locals>.MultiCall.__init__.<locals>.<listcomp>)r2�_MultiCall__eventinfor5r6r+�_MultiCall__binders)r1rF�kwargs)r-)r1r%r2Es	z,MultiCallCreator.<locals>.MultiCall.__init__Ncs&t|�tkrt|�dkr|dd�dkr|dd�dkr||jkr�|j|}|ddk	r�x1|dD]%}|j|dj||d�q�W||d<|ddk	rxC|dD]!}|j|dj||�q�Wn|gg|j|<�j||||�S)Nrz<<z>>rr���)r*�strr6r�r�rBr>)r1r,r;�add�eir@)r-r r%r>Ns$,
#
"z(MultiCallCreator.<locals>.MultiCall.bindcs�t|�tkr�t|�dkr�|dd�dkr�|dd�dkr�||jkr�|j|\}}|dk	r�x)|D]!}|j|dj||�q�Wd|j|d<�j|||�S)Nrz<<z>>rrr�)r*r�r6r�r�rB)r1r,Zfuncidr;�tripletsr@)r-r r%rB`s$,
z*MultiCallCreator.<locals>.MultiCall.unbindcs�||jkr"dgg|j|<|j|\}}xp|D]h}t|�}|dkrp�j|||�q<|dk	r�|j|dj||�|j|�q<WdS)Nr)r�r��	event_addr�r>r?)r1�virtual�	sequencesr;r�rmr@)r-r r%r�ks
z-MultiCallCreator.<locals>.MultiCall.event_addcs�||jkrdS|j|\}}xp|D]h}t|�}|dkra�j|||�q-|dk	r�|j|dj||�|j|�q-WdS)Nr)r�r��event_deleter�rBrA)r1r�r�r;r�rmr@)r-r r%r�|s
z0MultiCallCreator.<locals>.MultiCall.event_deletecs]|dks||jkr+�j||�Sttt|j|d���j||�SdS)Nr)r��
event_info�tuple�mapr�)r1r�)r-r r%r��s
	z.MultiCallCreator.<locals>.MultiCall.event_infocSs�x�|jD]�}|j|\}}|r
xn|D]f}y|j|dj||�Wq0tjk
r�}zt|jdkr��WYdd}~Xq0Xq0Wq
WdS)Nrr)r�r�rBrCrDrErF)r1r�r;r�r@rGr r r%rH�s
z+MultiCallCreator.<locals>.MultiCall.__del__)
rIrJrKr2r>rBr�r�r�rHr )r-r r%�	MultiCallBs	r�)�_multicall_dict)r-r�r )r-r%�MultiCallCreator:s
[
r�cs$tj�}|jd�ttttjd|j����\}}}}|jd||df�t	tj
�|���j�dg�fdd�}|d�|d	�|d
�|d�|d�|d
�|d�|d�|d�|d�|d�|d�|j�dS)NzTest MultiCallz[x+]z+%d+%d�rcsT�fdd�}�jd|d|��jd|d��|dd7<dS)Ncst��dS)N)�print)r7)rmr r%r=�sz-_multi_call.<locals>.bindseq.<locals>.handlerz
<<handler%d>>rr)r>r�)rmrTr=)�text)rmr%�bindseq�sz_multi_call.<locals>.bindseqz<Key>z
<Control-Key>z<Alt-Key-a>z<Control-Key-a>z<Alt-Control-Key-a>z<Key-b>z<Control-Button-1>z
<Button-2>z<Alt-Button-1>z
<FocusOut>z<Enter>z<Leave>)
rCZTk�titler\r��int�rer�Zgeometryr�ZText�packZmainloop)�parent�root�widthZheightrX�yr�r )r�r%�_multi_call�s(
3












r��__main__)�runrrr	� �@��r�r�r�r)r�r�r�r��r�r�r�rr)r�r�r�r��rrrs�rt�rurv�rw�rx�ry�rz�r{�r|�r}�r~�r�r��r��r��r��r��r��r��r��r��r��r�)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)A�sysr�rCZMC_KEYPRESSZ
MC_KEYRELEASEZMC_BUTTONPRESSZMC_BUTTONRELEASEZMC_ACTIVATEZMC_CIRCULATEZMC_COLORMAPZMC_CONFIGUREZ
MC_DEACTIVATEZ
MC_DESTROYZMC_ENTERZ	MC_EXPOSEZ
MC_FOCUSINZMC_FOCUSOUTZ
MC_GRAVITYZMC_LEAVEZMC_MAPZ	MC_MOTIONZ
MC_MOUSEWHEELZMC_PROPERTYZMC_REPARENTZMC_UNMAPZ
MC_VISIBILITYZMC_SHIFTZ
MC_CONTROLZMC_ALTZMC_METAZ	MC_OPTIONZ
MC_COMMAND�platformr!Z_modifier_masks�dictr5r6r�rEr'rgrlr_rirkrOr<r:r?r`r+r�r��compiler�r�r�r�r�r�r�rIZidlelib.idle_test.htestr�r r r r%�<module> s�
-	

`"'g

?>