Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/internet/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyc


[XMc@sbdZddlZyddlZejdWnek
rDZnXddlZddlmZddl	m
Z
mZmZm
Z
ddlmZddlmZmZe
jdd	d
dZdZd
ejfdYZdejfdYZdZejeeeddZejeeedejjdkrUeZndgZ dS(s>
This module provides support for Twisted to interact with the PyGTK mainloop.

In order to use this support, simply do the following::

    |  from twisted.internet import gtkreactor
    |  gtkreactor.install()

Then use twisted.internet APIs as usual.  The other methods here are not
intended to be called directly.
iNs1.2(t
implements(tlogtruntimet	deprecatetversions(t
IReactorFDSet(t	posixbaset
selectreactortTwistedi
iishAll new applications should be written with gtk 2.x, which is supported by twisted.internet.gtk2reactor.t
GtkReactorcBseZdZeeejeeeddZ	dZ
dZdZdZ
dZdZd	ZdZd
ZdZdZd
dZdZdZdZRS(sG
    GTK+ event loop reactor.

    @ivar _reads: A dictionary mapping L{FileDescriptor} instances to gtk INPUT_READ
        watch handles.

    @ivar _writes: A dictionary mapping L{FileDescriptor} instances to gtk
        INTPUT_WRITE watch handles.

    @ivar _simtag: A gtk timeout handle for the next L{simulate} call.
    R	cCs/d|_i|_i|_tjj|dS(sb
        Initialize the file descriptor tracking dictionaries and the base
        class.
        N(tNonet_simtagt_readst_writesRtPosixReactorBaset__init__(tself((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyR:s			cCs;||jkr7tj|tjj|j|j|<ndS(N(Rtgtkt	input_addtGDKt
INPUT_READtcallback(Rtreader((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyt	addReaderEscCs;||jkr7tj|tjj|j|j|<ndS(N(R
RRRtINPUT_WRITER(Rtwriter((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyt	addWriterIscCs
|jjS(N(Rtkeys(R((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyt
getReadersNscCs
|jjS(N(R
R(R((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyt
getWritersRscCs|j|j|jS(N(t
_removeAllRR
(R((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyt	removeAllVscCs4||jkr0tj|j||j|=ndS(N(RRtinput_remove(RR((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pytremoveReaderZscCs4||jkr0tj|j||j|=ndS(N(R
RR (RR((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pytremoveWriter_scGs
d|_dS(Ni(R
tdoIterationTimer(Rtargs((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pytdoIterationTimeoutfs	cCstjddddd|tjr9tjddS|dkrIdStjt|d|j|_tjd|jrtj	|jd|_ndS(	Ntchanneltsystemteventt	iterationtreactoriii(RtmsgRtevents_pendingt
mainiterationttimeout_addtintR%R#ttimeout_removeR
(Rtdelay((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pytdoIterationis

	cCstjj|tjdS(N(RRtcrashRtmainquit(R((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyR3sicCs1|jd|tjd|jtjdS(NtinstallSignalHandlersi(tstartRunningRR.tsimulatetmainloop(RR5((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pytrunscCsd}d}yw|tjj@r7|j}|j}n|r|tjj@r|jr|j|kr|j}|j}qnWn2tj	d}t
jd|t
jnX|r|j
||||jkndS(NisError In %s(R
RRRtdoReadRtdisconnectedtdoWritetsystexc_infoRR+tdeferrt_disconnectSelectable(Rtsourcet	conditiontwhytdidRead((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyt
_readAndWrites 
cCs'tj||j|||jdS(Ni(RtcallWithLoggerRER7(RRARB((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyRs
cCs||jdk	r"tj|jn|jt|jd}|dkrVd}ntjt|d|j	|_dS(s7Run simulation loops and reschedule callbacks.
        g?iN(
RR
RR0trunUntilCurrenttminttimeoutR.R/R7(RRI((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyR7s
	N(t__name__t
__module__t__doc__RRRtdeprecatedModuleAttributetdeprecatedSincetdeprecationMessageRRRRRRR!R"R
R#R%R2R3R9RERR7(((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyR	)s(

													tPortableGtkReactorcBsHeZdZdZejeeeddZ	ddZ
dZRS(sReactor that works on Windows.

    input_add is not supported on GTK+ for Win32, apparently.

    @ivar _simtag: A gtk timeout handle for the next L{simulate} call.
    RPcCstjj|tjdS(N(Rt
SelectReactorR3RR4(R((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyR3sicCs(|jd||jtjdS(NR5(R6R7RR8(RR5((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyR9s
cCsv|jdk	r"tj|jn|jt|jd}|dkrVd}ntj|d|j|_dS(s7Run simulation loops and reschedule callbacks.
        g?iN(	RR
RR0titerateRHRIR.R7(RRI((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyR7s
	N(RJRKRLR
RRRMRNROR3R9R7(((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyRPs
	cCs't}ddlm}|||S(sFConfigure the twisted mainloop to be run inside the gtk mainloop.
    i(tinstallReactor(R	ttwisted.internet.mainRS(R*RS((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pytinstalls	
RUcCs't}ddlm}|||S(sFConfigure the twisted mainloop to be run inside the gtk mainloop.
    i(RS(RPRTRS(R*RS((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pytportableInstalls	
RVtposix(!RLR=tpygtktrequiretImportErrortAttributeErrorRtzope.interfaceRttwisted.pythonRRRRttwisted.internet.interfacesRttwisted.internetRRtVersionRNRORR	RQRPRURMRJRVtplatformtgetTypet__all__(((s?/usr/lib/python2.7/dist-packages/twisted/internet/gtkreactor.pyt<module>s0"$