Hacked By AnonymousFox

Current Path : /opt/alt/python33/lib64/python3.3/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/idlelib/__pycache__/MultiCall.cpython-33.pyo

�
��fyDc@svdZddlZddlZddlZddlmZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZZd[Zd\Zd]Z d^Z!d_Z"ej#�rddZ$eee!e"fZ%ndiZ$eeee fZ%e&d!d"�e'e(e$��D��Z)Gd#d$�d$�Z*e'de(e$�>�Z+d%d"�e+D�Z,d&d'�Z-e-e+�Z.gZ/x]e+D]UZ0dZ1x9e'e(e$��D]%Z2de2>e0@r�e1e%e2OZ1q�q�We/j3e1�q�WGd(d)�d)�Z4d�Z5e4fde*fe(e5�dZ6e&dCd"�e'e(e5��D��Z7ej8dD�Z9ej8dE�Z:dFdG�Z;dHdI�Z<iZ=dJdK�Z>e?dLkrrej@�ZAe>ejB�eA�ZCeCjD�dgdMdN�ZEeEdO�eEdP�eEdQ�eEdR�eEdS�eEdT�eEdU�eEdV�eEdW�eEdX�eEdY�eAjF�ndS(�u�
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.
iN(u
macosxSupportiiiiiiiii	i
iii
iiiiiiiiiuShiftuControluOptionuCommanduAltuMetauMcCs-g|]#}t|D]}||f�qqS((u
_modifiers(u.0unumberuname((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
<listcomp>8s	u
<listcomp>cBsD|EeZdZdd�Zdd�Zdd�Zdd�Zd	S(
u
_SimpleBindercCsJ||_dt|dd|_||_||_g|_d|_dS(Nu<iu>(utypeu_typesusequenceuwidgetu
widgetinstubindedfuncsuNoneu	handlerid(uselfutypeuwidgetu
widgetinst((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu__init__Es				u_SimpleBinder.__init__cCsY|jsE|j|jdd�}|jj|j|j|�|_n|jj|�dS(NcSss||_i}x]tt|�ddd�D]?}||}||kr,d||<||�}|rk|Sq,q,WdS(Nii����i����T(umc_typeurangeulenuTrue(ueventulumc_typeu	wascalleduiufuncur((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyuhandlerOs	#

u#_SimpleBinder.bind.<locals>.handler(u	handleridubindedfuncsutypeuwidgetubindu
widgetinstusequenceuappend(uselfutripletufuncuhandler((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyubindMs
	
u_SimpleBinder.bindcCsH|jj|�|jsD|jj|j|j|j�d|_ndS(N(ubindedfuncsuremoveuwidgetuunbindu
widgetinstusequenceu	handleriduNone(uselfutripletufunc((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyuunbind]s	u_SimpleBinder.unbindcCs/|jr+|jj|j|j|j�ndS(N(u	handleriduwidgetuunbindu
widgetinstusequence(uself((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu__del__cs	u_SimpleBinder.__del__N(u__name__u
__module__u__qualname__u__init__ubinduunbindu__del__(u
__locals__((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
_SimpleBinderDsu
_SimpleBindercs8g|].�dj�fdd�tt�D���qS(uc3s1|]'\}}d|>�@r|ddVqdS(iiu-N((u.0uium(us(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu	<genexpr>ms	u<listcomp>.<genexpr>(ujoinu	enumerateu
_modifiers(u.0((usu6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
<listcomp>ms	csodd�}g}xV|D]N�tt�fdd�|D���}|jd|dd�|j|�qW|S(u�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(unumber of bits set in n base 2ii(udivmod(ununburem((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyunbitsvs
	uexpand_substates.<locals>.nbitsc3s|]}�|@VqdS(N((u.0ux(ustate(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu	<genexpr>su#expand_substates.<locals>.<genexpr>ukeyureverseT(ulistusetusortuTrueuappend(ustatesunbitsu	statelistu	substates((ustateu6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyuexpand_substatesrs
%uexpand_substatescBsP|EeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS(u_ComplexBindercCs%||||j|jdd�}|S(NcSs�dg|dd�<||_||_i}d}x||D]t}xatt|�ddd�D]C}	||	}
|
|kr[d||
<||	|�}|r�Pq�q[q[W|r8Pq8q8Wg|dd�<x|D]
}|�q�Wg|dd�<|r�|SdS(NiTi����i����(uTrueumc_typeumc_stateuNoneurangeulen(ueventulistsumc_typeumc_stateuishandlerrunningudoafterhandleru	wascalleduruluiufuncuf((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyuhandler�s*		
#


u0_ComplexBinder.__create_handler.<locals>.handler(uishandlerrunningudoafterhandler(uselfulistsumc_typeumc_stateuhandler((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu__create_handler�s
u_ComplexBinder.__create_handlercs�|�_t|d�_|�_|�_idd�tD�d6�_g�_g�_	g�_
x�tD]�}�fdd�t|D�}�j||t
|�}dt|�jd}�jj|�jj�j||�f�qkWdS(NicSsg|]}g�qS(((u.0us((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
<listcomp>�s	u+_ComplexBinder.__init__.<locals>.<listcomp>cs!g|]}�jd|�qS(N(ubindedfuncsuNone(u.0ui(uself(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
<listcomp>�s	u<u>(utypeu_typesutypenameuwidgetu
widgetinstu_statesuNoneubindedfuncsu
handleridsuishandlerrunningudoafterhandleru_state_subsetsu_ComplexBinder__create_handleru_state_codesu_state_namesuappendubind(uselfutypeuwidgetu
widgetinstusulistsuhandleruseq((uselfu6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu__init__�s						
u_ComplexBinder.__init__cs�d�jkr�dd�tD��j�d<x�tD]����fdd��ddfD�}�j|�jt��}dt��j�df}�jj	|�j
j�j||�f�q8Wn���fdd�}�j
s�|�n�jj	|�dS(NicSsg|]}g�qS(((u.0us((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
<listcomp>�s	u'_ComplexBinder.bind.<locals>.<listcomp>cs2g|](}t�D]}�j||�qqS((u_state_subsetsubindedfuncs(u.0udetailui(usuself(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
<listcomp>�s	u	<%s%s-%s>cs �j�d�dj��S(Nii(ubindedfuncsuappend((ufuncuselfutriplet(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu<lambda>�su%_ComplexBinder.bind.<locals>.<lambda>(ubindedfuncsu_statesuNoneu_ComplexBinder__create_handlerutypeu_state_codesu_state_namesutypenameu
handleridsuappenduwidgetubindu
widgetinstuishandlerrunningudoafterhandler(uselfutripletufunculistsuhandlerusequdoit((ufuncususelfutripletu6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyubind�s

	
u_ComplexBinder.bindcs?���fdd�}�js+|�n�jj|�dS(Ncs �j�d�dj��S(Nii(ubindedfuncsuremove((ufuncuselfutriplet(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu<lambda>�su'_ComplexBinder.unbind.<locals>.<lambda>(uishandlerrunningudoafterhandleruappend(uselfutripletufuncudoit((ufuncuselfutripletu6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyuunbind�s	
u_ComplexBinder.unbindcCs7x0|jD]%\}}|jj|j||�q
WdS(N(u
handleridsuwidgetuunbindu
widgetinst(uselfusequid((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu__del__�su_ComplexBinder.__del__N(u__name__u
__module__u__qualname__u_ComplexBinder__create_handleru__init__ubinduunbindu__del__(u
__locals__((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu_ComplexBinder�s
u_ComplexBinderuKeyPressuKeyu
KeyReleaseuButtonPressuButtonu
ButtonReleaseuActivateu	CirculateuColormapu	Configureu
DeactivateuDestroyuEnteruExposeuFocusInuFocusOutuGravityuLeaveuMapuMotionu
MouseWheeluPropertyuReparentuUnmapu
VisibilitycCs-g|]#}t|D]}||f�qqS((u_types(u.0unumberuname((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
<listcomp>�s	u^\w+$u^[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(u-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.
    iu<iu>u-cSsg|]}t|�qS((u_type_names(u.0us((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
<listcomp>s	u#_parse_sequence.<locals>.<listcomp>uKeyPressu
KeyReleasei����Ni����(uKeyPressu
KeyRelease(
uNoneusplitu_modifier_namesu_type_namesu_binder_classesu
_SimpleBinderu
_keysym_reu
_button_reulenumatch(usequenceuwordsu	modifiersutypeudetailutype_re((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu_parse_sequence�s0'
			%
u_parse_sequencecCsb|dr:dt|dt|ddd|ddSdt|dt|dddSdS(Niu<iiu-u>(u_state_namesu_types(utriplet((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu_triplet_to_sequence$s
0u_triplet_to_sequencecs>�tkrt�SG�fdd�d��}|t�<|S(u�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.
    cs�|EeZdZ�fdd�Zddd�fdd�Zd�fdd�Z�fdd�Z�fd	d
�Zd�fdd�Z	d
d�Z
dS(u#MultiCallCreator.<locals>.MultiCallcsK�j�||�i�_��fdd�ttt��D��_dS(Ncs&g|]}t||����qS((u_binder_classes(u.0ui(uselfuwidget(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
<listcomp>=s	u@MultiCallCreator.<locals>.MultiCall.__init__.<locals>.<listcomp>(u__init__u_MultiCall__eventinfourangeulenu_typesu_MultiCall__binders(uselfuargsukwargs(uwidget(uselfu6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu__init__7s	u,MultiCallCreator.<locals>.MultiCall.__init__cs/t|�tkrt|�dkr|dd�dkr|dd�dkr||jkr|j|}|ddk	r�x4|dD]%}|j|dj||d�q�Wn||d<|ddk	rx0|dD]!}|j|dj||�q�Wqq|gg|j|<n�j||||�S(Niu<<u>>iii����(utypeustrulenu_MultiCall__eventinfouNoneu_MultiCall__bindersuunbindubind(uselfusequenceufuncuaddueiutriplet(uwidget(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyubind@s$,
&
%u(MultiCallCreator.<locals>.MultiCall.bindcs�t|�tkr�t|�dkr�|dd�dkr�|dd�dkr�||jkr�|j|\}}|dk	r�x)|D]!}|j|dj||�q�Wd|j|d<q�n�j|||�S(Niu<<u>>iii����(utypeustrulenu_MultiCall__eventinfouNoneu_MultiCall__bindersuunbind(uselfusequenceufuncidufuncutripletsutriplet(uwidget(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyuunbindRs$,
u*MultiCallCreator.<locals>.MultiCall.unbindcs�||jkr%dgg|j|<n|j|\}}xs|D]k}t|�}|dkrs�j|||�q?|dk	r�|j|dj||�n|j|�q?WdS(Ni(u_MultiCall__eventinfouNoneu_parse_sequenceu	event_addu_MultiCall__bindersubinduappend(uselfuvirtualu	sequencesufuncutripletsusequtriplet(uwidget(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu	event_add]s
u-MultiCallCreator.<locals>.MultiCall.event_addcs�||jkrdS|j|\}}xs|D]k}t|�}|dkra�j|||�q-|dk	r�|j|dj||�n|j|�q-WdS(Ni(u_MultiCall__eventinfou_parse_sequenceuNoneuevent_deleteu_MultiCall__bindersuunbinduremove(uselfuvirtualu	sequencesufuncutripletsusequtriplet(uwidget(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyuevent_deletens
u0MultiCallCreator.<locals>.MultiCall.event_deletecs]|dks||jkr+�j||�Sttt|j|d���j||�SdS(Ni(uNoneu_MultiCall__eventinfou
event_infoutupleumapu_triplet_to_sequence(uselfuvirtual(uwidget(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu
event_info|s
	u.MultiCallCreator.<locals>.MultiCall.event_infocSs`xY|jD]N}|j|\}}|r
x,|D]!}|j|dj||�q0Wq
q
WdS(Ni(u_MultiCall__eventinfou_MultiCall__bindersuunbind(uselfuvirtualufuncutripletsutriplet((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu__del__�s

u+MultiCallCreator.<locals>.MultiCall.__del__N(u__name__u
__module__u__qualname__u__init__uNoneubinduunbindu	event_adduevent_deleteu
event_infou__del__(u
__locals__(uwidget(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu	MultiCall4s	u	MultiCall(u_multicall_dict(uwidgetu	MultiCall((uwidgetu6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyuMultiCallCreator,s
X
uMultiCallCreatoru__main__csT�fdd�}tjd|d|�tjd|d��|dd7<dS(Ncst��dS(N(uprint(uevent(useq(u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyuhandler�subindseq.<locals>.handleru
<<handler%d>>ii(utextubindu	event_add(usequnuhandler((usequ6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyubindseq�subindsequ<Key>u
<Control-Key>u<Alt-Key-a>u<Control-Key-a>u<Alt-Control-Key-a>u<Key-b>u<Control-Button-1>u<Alt-Button-1>u
<FocusOut>u<Enter>u<Leave>iiii i@i�(uShift(uControl(uOption(uCommand((uShift(uControl(uOption(uCommand(uControl(uAlt(uShift(uMetauM((uControl(uAlt(uShift(uMetauM(uKeyPressuKey(u
KeyRelease(uButtonPressuButton(u
ButtonRelease(uActivate(u	Circulate(uColormap(u	Configure(u
Deactivate(uDestroy(uEnter(uExpose(uFocusIn(uFocusOut(uGravity(uLeave(uMap(uMotion(u
MouseWheel(uProperty(uReparent(uUnmap(u
Visibility((uKeyPressuKey(u
KeyRelease(uButtonPressuButton(u
ButtonRelease(uActivate(u	Circulate(uColormap(u	Configure(u
Deactivate(uDestroy(uEnter(uExpose(uFocusIn(uFocusOut(uGravity(uLeave(uMap(uMotion(u
MouseWheel(uProperty(uReparent(uUnmap(u
Visibility(Gu__doc__usysureutkinteruidlelibu
macosxSupportuMC_KEYPRESSu
MC_KEYRELEASEuMC_BUTTONPRESSuMC_BUTTONRELEASEuMC_ACTIVATEuMC_CIRCULATEuMC_COLORMAPuMC_CONFIGUREu
MC_DEACTIVATEu
MC_DESTROYuMC_ENTERu	MC_EXPOSEu
MC_FOCUSINuMC_FOCUSOUTu
MC_GRAVITYuMC_LEAVEuMC_MAPu	MC_MOTIONu
MC_MOUSEWHEELuMC_PROPERTYuMC_REPARENTuMC_UNMAPu
MC_VISIBILITYuMC_SHIFTu
MC_CONTROLuMC_ALTuMC_METAu	MC_OPTIONu
MC_COMMANDurunningAsOSXAppu
_modifiersu_modifier_masksudicturangeulenu_modifier_namesu
_SimpleBinderu_statesu_state_namesuexpand_substatesu_state_subsetsu_state_codesusuruiuappendu_ComplexBinderu_typesu_binder_classesu_type_namesucompileu
_keysym_reu
_button_reu_parse_sequenceu_triplet_to_sequenceu_multicall_dictuMultiCallCreatoru__name__uTkurootuTextutextupackubindsequmainloop(((u6/opt/alt/python33/lib64/python3.3/idlelib/MultiCall.pyu<module>s�(	

\"'c













Hacked By AnonymousFox1.0, Coded By AnonymousFox