%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/idlelib/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/idlelib/MultiCall.pyo

ó
Pêáac@sdZddlZddlZddlZddlZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdJZdKZdLZdMZdNZ dOZ!ej"dkrdPdQdRdSfZ#eee e!fZ$n$dTdUdVdWfZ#eeeefZ$e%ge&e'e#ƒƒD]#Z(e#e(D]Z)e)e(f^qbqTƒZ*d"dXd#„ƒYZ+e&de'e#ƒ>ƒZ,ge,D]%Z-d$j.d%„e/e#ƒDƒƒ^q°Z0d&„Z1e1e,ƒZ2gZ3x]e,D]UZ-dZ4x9e&e'e#ƒƒD]%Z5de5>e-@re4e$e5OZ4qqWe3j6e4ƒqýWd'dYd(„ƒYZ7dZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpfZ8e7fde+fe'e8ƒdZ9e%ge&e'e8ƒƒD]#Z(e8e(D]Z)e)e(f^qúqìƒZ:ej;dBƒZ<ej;dCƒZ=dD„Z>dE„Z?iZ@dF„ZAdG„ZBeCdHkr‰ddIlDmEZEeEeBƒndS(qs˜
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ÿÿÿÿNiiiiiiiiii	i
iii
iiiiiiiiitdarwintShifttControltOptiontCommandtAlttMetatMt
_SimpleBindercBs,eZd„Zd„Zd„Zd„ZRS(cCsJ||_dt|dd|_||_||_g|_d|_dS(Nt<it>(ttypet_typestsequencetwidgett
widgetinsttbindedfuncstNonet	handlerid(tselfRRR((s-/usr/local/lib/python2.7/idlelib/MultiCall.pyt__init__Es				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/local/lib/python2.7/idlelib/MultiCall.pythandlerOs	#

(RRRRtbindRR
tappend(RttripletRR((s-/usr/local/lib/python2.7/idlelib/MultiCall.pyR Ms
	
cCsH|jj|ƒ|jsD|jj|j|j|jƒd|_ndS(N(RtremoveRtunbindRR
RR(RR"R((s-/usr/local/lib/python2.7/idlelib/MultiCall.pyR$]s	cCs/|jr+|jj|j|j|jƒndS(N(RRR$RR
(R((s-/usr/local/lib/python2.7/idlelib/MultiCall.pyt__del__cs	(t__name__t
__module__RR R$R%(((s-/usr/local/lib/python2.7/idlelib/MultiCall.pyRDs			tccs1|]'\}}d|>t@r|ddVqdS(iit-N(ts(t.0Rtm((s-/usr/local/lib/python2.7/idlelib/MultiCall.pys	<genexpr>ms	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/local/lib/python2.7/idlelib/MultiCall.pytnbitsvs
	c3s|]}ˆ|@VqdS(N((R+tx(tstate(s-/usr/local/lib/python2.7/idlelib/MultiCall.pys	<genexpr>stkeytreverse(tlisttsettsortRR!(tstatesR1t	statelistt	substates((R3s-/usr/local/lib/python2.7/idlelib/MultiCall.pytexpand_substatesrs	
"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/local/lib/python2.7/idlelib/MultiCall.pyR˜s*
		
#


(R@RA(RR?RR>R((s-/usr/local/lib/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/local/lib/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/local/lib/python2.7/idlelib/MultiCall.pyt<lambda>×R((RRERRGRHRRIRJRDRFR!RR RR@RA(
RR"RR*tdetailRR?RRKtdoit((RRR"s-/usr/local/lib/python2.7/idlelib/MultiCall.pyR Ës$
(
	
cs<‡‡‡fd†}ˆjs(|ƒnˆjj|ƒdS(Ncs ˆjˆdˆdjˆƒS(Nii(RR#((RRR"(s-/usr/local/lib/python2.7/idlelib/MultiCall.pyRLÞR((R@RAR!(RR"RRN((RRR"s-/usr/local/lib/python2.7/idlelib/MultiCall.pyR$Ýs	
cCs7x0|jD]%\}}|jj|j||ƒq
WdS(N(RFRR$R(RRKtid((s-/usr/local/lib/python2.7/idlelib/MultiCall.pyR%äs(R&R'RHRR R$R%(((s-/usr/local/lib/python2.7/idlelib/MultiCall.pyR=s
				tKeyPresstKeyt
KeyReleasetButtonPresstButtont
ButtonReleasetActivatet	CirculatetColormapt	Configuret
DeactivatetDestroytEntertExposetFocusIntFocusOuttGravitytLeavetMaptMotiont
MouseWheeltPropertytReparenttUnmapt
Visibilitys^\w+$s^[1-5]$cCsc|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/local/lib/python2.7/idlelib/MultiCall.pyt_parse_sequenceýs0'
	#		%
cCsb|dr:dt|dt|ddd|ddSdt|dt|dddSdS(NiR	iiR)R
(RJR(R"((s-/usr/local/lib/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	MultiCallcszeZ‡fd†Zddd‡fd†Zd‡fd†Z‡fd†Z‡fd†Zd‡fd†Zd„Z	RS(csXˆj|||Ži|_gtttƒƒD]}t||ˆ|ƒ^q/|_dS(N(Rt_MultiCall__eventinfoRRRRmt_MultiCall__binders(RtargstkwargsR(R(s-/usr/local/lib/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/local/lib/python2.7/idlelib/MultiCall.pyR Cs$ 
&
%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/local/lib/python2.7/idlelib/MultiCall.pyR$Ts$ 
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/local/lib/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#(RRR‚RRRKR"(R(s-/usr/local/lib/python2.7/idlelib/MultiCall.pyRƒos
cs]|dks||jkr+ˆj||ƒSttt|j|dƒƒˆj||ƒSdS(Ni(RRwt
event_infottupletmapRu(RR(R(s-/usr/local/lib/python2.7/idlelib/MultiCall.pyR„}s
	cSs`xY|jD]N}|j|\}}|r
x,|D]!}|j|dj||ƒq0Wq
q
WdS(Ni(RwRxR$(RRRRR"((s-/usr/local/lib/python2.7/idlelib/MultiCall.pyR%…s

N(
R&R'RRR R$R€RƒR„R%((R(s-/usr/local/lib/python2.7/idlelib/MultiCall.pyRv7s	(t_multicall_dict(RRv((Rs-/usr/local/lib/python2.7/idlelib/MultiCall.pytMultiCallCreator/s
V
cs!tjƒ}|jdƒttttjd|jƒƒƒƒ\}}}}|jd||dfƒt	tj
ƒ|ƒ‰ˆjƒdg‡fd†}|dƒ|dƒ|d	ƒ|d
ƒ|dƒ|dƒ|d
ƒ|dƒ|dƒ|dƒ|dƒ|dƒ|jƒdS(NsTest MultiCalls[x+]s+%d+%di–icsS‡fd†}ˆjd|d|ƒˆjd|dˆƒ|dcd7<dS(Ncs	ˆGHdS(N((R(RK(s-/usr/local/lib/python2.7/idlelib/MultiCall.pyR™ss
<<handler%d>>ii(R R€(RKR.R(ttext(RKs-/usr/local/lib/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
<Button-2>s<Alt-Button-1>s
<FocusOut>s<Enter>s<Leave>(
tTkintertTkttitleR6R†tinttreRjtgeometryRˆtTexttpacktmainloop(tparenttroottwidththeightR2tyRŠ((R‰s-/usr/local/lib/python2.7/idlelib/MultiCall.pyt_multi_call‘s(
3












t__main__(truniiii i@i€(R(R(R(R(R(R(R(RR(((RPRQ(RR(RSRT(RU(RV(RW(RX(RY(RZ(R[(R\(R](R^(R_(R`(Ra(Rb(Rc(Rd(Re(Rf(Rg(Rh(Ft__doc__tsysRiRR‹tMC_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_COMMANDtplatformt
_modifierst_modifier_maskstdictRRtnumbertnameRkRRER*tjoint	enumerateRJR<RGRIRRR!R=RRmRltcompileRnRoRtRuR‡RˆR™R&tidlelib.idle_test.htestR›(((s-/usr/local/lib/python2.7/idlelib/MultiCall.pyt<module>s–&
(/	
\		"&	*		b	

Zerion Mini Shell 1.0