ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/thread-self/root/usr/lib64/python2.7/idlelib/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/thread-self/root/usr/lib64/python2.7/idlelib/MultiCall.pyc

�
_цdc@s)dZddlZddlZddlZddlZddlmZdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdTZdUZdVZ dWZ!dXZ"dYZ#ej$�r'dZd[d\d]fZ%eee"e#fZ&n$d^d_d`dafZ%ee ee!fZ&e'ge(e)e%��D]#Z*e%e*D]Z+e+e*f^qoqa�Z,d"dbd#��YZ-e(de)e%�>�Z.ge.D]%Z/d$j0d%�e1e%�D��^q�Z2d&�Z3e3e.�Z4gZ5x]e.D]UZ/dZ6x9e(e)e%��D]%Z7de7>e/@r)e6e&e7OZ6q)q)We5j8e6�q
Wd'dcd(��YZ9dddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzfZ:e9fde-fe)e:�dZ;e'ge(e)e:��D]#Z*e:e*D]Z+e+e*f^qq��Z<ej=dB�Z>ej=dC�Z?dD�Z@dE�ZAiZBdF�ZCeDdGkr%ejE�ZFeCejG�eF�ZHeHjI�dgdH�ZJeJdI�eJdJ�eJdK�eJdL�eJdM�eJdN�eJdO�eJdP�eJdQ�eJdR�eJdS�eFjK�ndS({s�
MultiCall - a class which inherits its methods from a Tkinter widget (Text, for
example), but enables multiple calls of functions per virtual event - all
matching events will be called, not only the most specific one. This is done
by wrapping the event functions - event_add, event_delete and event_info.
MultiCall recognizes only a subset of legal event sequences. Sequences which
are not recognized are treated by the original Tk handling mechanism. A
more-specific event will be called before a less-specific event.

The recognized sequences are complete one-event sequences (no emacs-style
Ctrl-X Ctrl-C, no shortcuts like <3>), for all types of events.
Key/Button Press/Release events can have modifiers.
The recognized modifiers are Shift, Control, Option and Command for Mac, and
Control, Alt, Shift, Meta/M for other platforms.

For all events which were handled by MultiCall, a new member is added to the
event instance passed to the binded functions - mc_type. This is one of the
event type constants defined in this module (such as MC_KEYPRESS).
For Key/Button events (which are handled by MultiCall and may receive
modifiers), another member is added - mc_state. This member gives the state
of the recognized modifiers, as a combination of the modifier constants
also defined in this module (for example, MC_SHIFT).
Using these members is absolutely portable.

The order by which events are called is defined by these rules:
1. A more-specific event will be called before a less-specific event.
2. A recently-binded event will be called before a previously-binded event,
   unless this conflicts with the first rule.
Each function will be called at most once for each event.
i����N(t
macosxSupportiiiiiiiiii	i
iii
iiiiiiiiitShifttControltOptiontCommandtAlttMetatMt
_SimpleBindercBs,eZd�Zd�Zd�Zd�ZRS(cCsJ||_dt|dd|_||_||_g|_d|_dS(Nt<it>(ttypet_typestsequencetwidgett
widgetinsttbindedfuncstNonet	handlerid(tselfRRR((s)/usr/lib64/python2.7/idlelib/MultiCall.pyt__init__Fs				cCsV|jsB|j|jd�}|jj|j|j|�|_n|jj|�dS(NcSss||_i}x]tt|�ddd�D]?}||}||kr,t||<||�}|rk|Sq,q,WdS(Nii����(tmc_typetrangetlentTrue(teventtlRt	wascalledtitfunctr((s)/usr/lib64/python2.7/idlelib/MultiCall.pythandlerPs	#

(RRRRtbindRR
tappend(RttripletRR((s)/usr/lib64/python2.7/idlelib/MultiCall.pyR Ns
	
cCsH|jj|�|jsD|jj|j|j|j�d|_ndS(N(RtremoveRtunbindRR
RR(RR"R((s)/usr/lib64/python2.7/idlelib/MultiCall.pyR$^s	cCs/|jr+|jj|j|j|j�ndS(N(RRR$RR
(R((s)/usr/lib64/python2.7/idlelib/MultiCall.pyt__del__ds	(t__name__t
__module__RR R$R%(((s)/usr/lib64/python2.7/idlelib/MultiCall.pyREs			tccs1|]'\}}d|>t@r|ddVqdS(iit-N(ts(t.0Rtm((s)/usr/lib64/python2.7/idlelib/MultiCall.pys	<genexpr>ns	csid�}g}xS|D]K�tt�fd�|D���}|jd|dt�|j|�qW|S(s�For each item of states return a list containing all combinations of
    that item with individual bits reset, sorted by the number of set bits.
    cSs6d}x)|r1t|d�\}}||7}q	W|S(snumber of bits set in n base 2ii(tdivmod(tntnbtrem((s)/usr/lib64/python2.7/idlelib/MultiCall.pytnbitsws
	c3s|]}�|@VqdS(N((R+tx(tstate(s)/usr/lib64/python2.7/idlelib/MultiCall.pys	<genexpr>�stkeytreverse(tlisttsettsortRR!(tstatesR1t	statelistt	substates((R3s)/usr/lib64/python2.7/idlelib/MultiCall.pytexpand_substatesss	
"t_ComplexBindercBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs"||||j|jd�}|S(NcSs�tg|(||_||_i}d}x||D]t}xatt|�ddd�D]C}	||	}
|
|krRt||
<||	|�}|r�Pq�qRqRW|r/Pq/q/Wg|(x|D]
}|�q�Wg|(|r�|SdS(Nii����(RRtmc_stateRRR(RtlistsRR>tishandlerrunningtdoafterhandlerRRRRRtf((s)/usr/lib64/python2.7/idlelib/MultiCall.pyR�s*
		
#


(R@RA(RR?RR>R((s)/usr/lib64/python2.7/idlelib/MultiCall.pyt__create_handler�s
c	Cs||_t|d|_||_||_igtD]}g^q6d6|_g|_g|_	g|_
x�tD]�}gt|D]}|jd|^q�}|j||t
|�}dt||jd}|jj||jj|j||�f�qqWdS(NiR	R
(RRttypenameRRt_statesRRt
handleridsR@RAt_state_subsetst_ComplexBinder__create_handlert_state_codest_state_namesR!R (	RRRRR*RR?Rtseq((s)/usr/lib64/python2.7/idlelib/MultiCall.pyR�s			#			
(c
s+�d�jkr�gtD]}g^q�j�d<x�tD]�}g�ddfD](}t|D]}�j||^qcqU}�j|�jt|�}dt|�j�df}�j	j
|�jj�j
||�f�q>Wn���fd�}	�js|	�n�jj
|	�dS(Nis	<%s%s-%s>cs �j�d�dj��S(Nii(RR!((RRR"(s)/usr/lib64/python2.7/idlelib/MultiCall.pyt<lambda>�s(RRERRGRHRRIRJRDRFR!RR RR@RA(
RR"RR*tdetailRR?RRKtdoit((RRR"s)/usr/lib64/python2.7/idlelib/MultiCall.pyR �s$
(
	
cs<���fd�}�js(|�n�jj|�dS(Ncs �j�d�dj��S(Nii(RR#((RRR"(s)/usr/lib64/python2.7/idlelib/MultiCall.pyRL�s(R@RAR!(RR"RRN((RRR"s)/usr/lib64/python2.7/idlelib/MultiCall.pyR$�s	
cCs7x0|jD]%\}}|jj|j||�q
WdS(N(RFRR$R(RRKtid((s)/usr/lib64/python2.7/idlelib/MultiCall.pyR%�s(R&R'RHRR R$R%(((s)/usr/lib64/python2.7/idlelib/MultiCall.pyR=�s
				tKeyPresstKeyt
KeyReleasetButtonPresstButtont
ButtonReleasetActivatet	CirculatetColormapt	Configuret
DeactivatetDestroytEntertExposetFocusIntFocusOuttGravitytLeavetMaptMotiont
MouseWheeltPropertytReparenttUnmapt
Visibilitys^\w+$s^[1-5]$c	Csc|s'|ddks'|ddkr+d	Stj|dd!d�}d}x7|r�|dtkr�|dt|d>O}|d=qMW|r�|dtkr�t|d}|d=nd	St|tkr�|s�|r�d	Sd	}nw|gd
D]}t|^q�krt}nt}|s d	}n6t	|�dkrR|j
|d�rR|d}nd	S|||fS(s-Get a string which should describe an event sequence. If it is
    successfully parsed as one, return a tuple containing the state (as an int),
    the event type (as an index of _types), and the detail - None if none, or a
    string if there is one. If the parsing is unsuccessful, return None.
    iR	i����R
iR)RPRRN(RPRR(Rtstringtsplitt_modifier_namest_type_namest_binder_classesRt
_keysym_ret
_button_reRtmatch(R
twordst	modifiersRRMR*ttype_re((s)/usr/lib64/python2.7/idlelib/MultiCall.pyt_parse_sequence�s0'
	#		%
cCsb|dr:dt|dt|ddd|ddSdt|dt|dddSdS(NiR	iiR)R
(RJR(R"((s)/usr/lib64/python2.7/idlelib/MultiCall.pyt_triplet_to_sequence(s
0cs>�tkrt�Sd�f�fd��Y}|t�<|S(s�Return a MultiCall class which inherits its methods from the
    given widget class (for example, Tkinter.Text). This is used
    instead of a templating mechanism.
    t	MultiCallcs�eZe�ej�st��fd�Zddd�fd�Zd�fd�Z	�fd�Z
�fd�Zd�fd�Zd�Z
RS(csX�j|||�i|_gttt��D]}t||�|�^q/|_dS(N(Rt_MultiCall__eventinfoRRRRmt_MultiCall__binders(RtargstkwargsR(R(s)/usr/lib64/python2.7/idlelib/MultiCall.pyR;s	cs#t|�tkr
t|�dkr
|d dkr
|ddkr
||jkr�|j|}|ddk	r�x4|dD]%}|j|dj||d�q{Wn||d<|ddk	r
x0|dD]!}|j|dj||�q�Wq
q
|gg|j|<n�j||||�S(Nis<<i����s>>ii(RtstrRRwRRxR$R (RR
RtaddteiR"(R(s)/usr/lib64/python2.7/idlelib/MultiCall.pyR Ds$ 
&
%cs�t|�tkr�t|�dkr�|d dkr�|ddkr�||jkr�|j|\}}|dk	r�x)|D]!}|j|dj||�qyWd|j|d<q�n�j|||�S(Nis<<i����s>>ii(RR{RRwRRxR$(RR
tfuncidRttripletsR"(R(s)/usr/lib64/python2.7/idlelib/MultiCall.pyR$Us$ 
cs�||jkr%dgg|j|<n|j|\}}xs|D]k}t|�}|dkrs�j|||�q?|dk	r�|j|dj||�n|j|�q?WdS(Ni(RwRRtt	event_addRxR R!(Rtvirtualt	sequencesRRRKR"(R(s)/usr/lib64/python2.7/idlelib/MultiCall.pyR�`s
cs�||jkrdS|j|\}}xs|D]k}t|�}|dkra�j|||�q-|dk	r�|j|dj||�n|j|�q-WdS(Ni(RwRtRtevent_deleteRxR$R#(RR�R�RRRKR"(R(s)/usr/lib64/python2.7/idlelib/MultiCall.pyR�ps
cs]|dks||jkr+�j||�Sttt|j|d���j||�SdS(Ni(RRwt
event_infottupletmapRu(RR�(R(s)/usr/lib64/python2.7/idlelib/MultiCall.pyR�~s
	cSs`xY|jD]N}|j|\}}|r
x,|D]!}|j|dj||�q0Wq
q
WdS(Ni(RwRxR$(RR�RRR"((s)/usr/lib64/python2.7/idlelib/MultiCall.pyR%�s

N(R&R't
issubclasstTkintertMisctAssertionErrorRRR R$R�R�R�R%((R(s)/usr/lib64/python2.7/idlelib/MultiCall.pyRv8s	(t_multicall_dict(RRv((Rs)/usr/lib64/python2.7/idlelib/MultiCall.pytMultiCallCreator0s
V
t__main__csS�fd�}tjd|d|�tjd|d��|dcd7<dS(Ncs	�GHdS(N((R(RK(s)/usr/lib64/python2.7/idlelib/MultiCall.pyR�ss
<<handler%d>>ii(ttextR R�(RKR.R((RKs)/usr/lib64/python2.7/idlelib/MultiCall.pytbindseq�ss<Key>s
<Control-Key>s<Alt-Key-a>s<Control-Key-a>s<Alt-Control-Key-a>s<Key-b>s<Control-Button-1>s<Alt-Button-1>s
<FocusOut>s<Enter>s<Leave>iiii i@i�(R(R(R(R(R(R(R(RR(((sKeyPressRQ(s
KeyRelease(RSRT(RU(RV(RW(RX(RY(RZ(R[(R\(R](R^(R_(R`(Ra(Rb(Rc(Rd(Re(Rf(Rg(Rh(Lt__doc__tsysRitreR�tidlelibRtMC_KEYPRESSt
MC_KEYRELEASEtMC_BUTTONPRESStMC_BUTTONRELEASEtMC_ACTIVATEtMC_CIRCULATEtMC_COLORMAPtMC_CONFIGUREt
MC_DEACTIVATEt
MC_DESTROYtMC_ENTERt	MC_EXPOSEt
MC_FOCUSINtMC_FOCUSOUTt
MC_GRAVITYtMC_LEAVEtMC_MAPt	MC_MOTIONt
MC_MOUSEWHEELtMC_PROPERTYtMC_REPARENTtMC_UNMAPt
MC_VISIBILITYtMC_SHIFTt
MC_CONTROLtMC_ALTtMC_METAt	MC_OPTIONt
MC_COMMANDtrunningAsOSXAppt
_modifierst_modifier_maskstdictRRtnumbertnameRkRRER*tjoint	enumerateRJR<RGRIRRR!R=RRmRltcompileRnRoRtRuR�R�R&tTktroottTextR�tpackR�tmainloop(((s)/usr/lib64/python2.7/idlelib/MultiCall.pyt<module>s�&
(/	
\		"&	*		a













Zerion Mini Shell 1.0