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/wxreactor.pyc

ó
[³XMc@sÍdZddlZy ddlmZmZmZWn-e	k
raddl
mZmZmZnXddlmZm
Z
ddlmZdefd„ƒYZd	ejfd
„ƒYZd„ZdgZdS(
sa
This module provides wxPython event loop support for Twisted.

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

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

Then, when your root wxApp has been created::

    | from twisted.internet import reactor
    | reactor.registerWxApp(yourApp)
    | reactor.run()

Then use twisted.internet APIs as usual. Stop the event loop using
reactor.stop(), not yourApp.ExitMainLoop().

IMPORTANT: tests will fail when run under this reactor. This is
expected and probably does not reflect on the reactor's ability to run
real applications.
iÿÿÿÿN(tPySimpleAppt	CallAftertTimer(t
wxPySimpleApptwxCallAftertwxTimer(tlogtruntime(t_threadedselecttProcessEventsTimercBs eZdZd„Zd„ZRS(sÊ
    Timer that tells wx to process pending events.

    This is necessary on OS X, probably due to a bug in wx, if we want
    wxCallAfters to be handled when modal dialogs, menus, etc.  are open.
    cCstj|ƒ||_dS(N(Rt__init__twxapp(tselfR((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pyR
-s
cCs|jjƒdS(s5
        Called repeatedly by wx event loop.
        N(RtProcessPendingEvents(R((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pytNotify2s(t__name__t
__module__t__doc__R
R(((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pyR	&s	t	WxReactorcBsMeZdZeZd„Zd„Zd„Zd„Zd„Z	e
d„ZRS(s[
    wxPython reactor.

    wxPython drives the event loop, select() runs in a thread.
    cCs
||_dS(s;
        Register wxApp instance with the reactor.
        N(R(RR((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pyt
registerWxAppCscCsIy&ddl}|j|j|jƒWntk
r:dSX|jƒdS(sO
        wx sometimes removes our own signal handlers, so re-add them.
        iÿÿÿÿN(tsignaltSIGINTtdefault_int_handlertImportErrort_handleSignals(RR((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pyt_installSignalHandlersAgainJs
cCs*|jr
dSt|_tjj|ƒdS(s#
        Stop the reactor.
        N(t	_stoppingtTrueRtThreadedSelectReactortstop(R((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pyRWs		cCs0t|dƒrt|ƒn|jj|ƒdS(sm
        Schedule function to run in main wx/Twisted thread.

        Called by the select() thread.
        RN(thasattrRt
_postQueuetput(Rtf((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pyt_runInMainThreadas
cCs#t|dƒr|jjƒndS(s
        Stop the wx event loop if it hasn't already been stopped.

        Called during Twisted event loop shutdown.
        RN(RRtExitMainLoop(R((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pyt_stopWxnscsxtjƒˆ_tˆdƒs>tjdƒˆjtƒƒnˆjˆjd|ƒ|rpˆj	dˆj
ƒnˆjddˆjƒˆjdd‡fd†ƒt
jjƒrÐtˆjƒ}|jdƒnˆjjƒˆj}ˆ`ˆjstˆjƒ|jƒxhyˆjjd	d
ƒ}Wntjk
r>qqX|dkrOPny|ƒWqtjƒqXqndS(s$
        Start the reactor.
        RsMregisterWxApp() was not called on reactor, registering my own wxApp instance.tinstallSignalHandlersitaftertshutdowncsˆjjdƒS(N(RR tNone((R(s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pyt<lambda>‹sittimeoutg{®Gáz„?N(tQueueRRRtmsgRRt
interleaveR"t	callLaterRtaddSystemEventTriggerR$RtplatformtisMacOSXR	RtStarttMainLoopRRR
tgettEmptyR(terr(RR%ttRR!((Rs>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pytrunxs>

		

(RRRtFalseRRRRR"R$RR8(((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pyR:s		
	
	
	
cCs'tƒ}ddlm}||ƒ|S(sP
    Configure the twisted mainloop to be run inside the wxPython mainloop.
    iÿÿÿÿ(tinstallReactor(Rttwisted.internet.mainR:(treactorR:((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pytinstall®s	
R=(RR+twxRRRRRRRtwxPython.wxttwisted.pythonRRttwisted.internetRR	RRR=t__all__(((s>/usr/lib/python2.7/dist-packages/twisted/internet/wxreactor.pyt<module>s 
 t