ϪfdZddlmZmZ ddlmZmZm Z ddl mZddlmZmZGdde ZGd d ej&Zd Zd gZy #e $r ddl mZmZm Z YFwxYw)aa 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. )EmptyQueue) CallAfter PySimpleAppTimer) wxPySimpleApp wxCallAfterwxTimer)_threadedselect)logruntimeceZdZdZdZdZy)ProcessEventsTimerz Timer that tells wx to process pending events. This is necessary on macOS, probably due to a bug in wx, if we want wxCallAfters to be handled when modal dialogs, menus, etc. are open. c<tj|||_yN)r __init__wxappselfrs > --2248rcjt|dr t|y|jj|y)zm Schedule function to run in main wx/Twisted thread. Called by the select() thread. rN)hasattrr _postQueueput)rfs r_runInMainThreadzWxReactor._runInMainThreadbs) 4 ! N OO   "rcRt|dr|jjyy)z Stop the wx event loop if it hasn't already been stopped. Called during Twisted event loop shutdown. rN)r2r ExitMainLooprs r_stopWxzWxReactor._stopWxns# 4 ! JJ # # % "rc\t_tds.tjdj t jj||rjdjjddjjddfdtjjr&t!j"}|j%dj"j'j"}`j(sJj+|j- jj/d }|y |)y #t0$rtj2Y!wxYw#t4$rYYwxYw) z$ Start the reactor. rzMregisterWxApp() was not called on reactor, registering my own wxApp instance.)installSignalHandlersraftershutdownc:jjdSr)r3r4rsrzWxReactor.run..s)<)> ? ""7J E "" Z!B     $ $ &"4::.A GGAJ   J~~ IIK  & & ( "++D+9Ay"$)" "s$F3E<<FF F+*F+N)T) rrrrr.r$r,r0r6r9rNr rrr"r"=s, I  9 #&7"rr"c6t}ddlm}|||S)zP Configure the twisted mainloop to be run inside the wxPython mainloop. r)installReactor)r"twisted.internet.mainrP)reactorrPs rr+r+skG47 Nrr+N)rqueuerrwxrr rrrr r) wxPython.wxtwisted.internetr twisted.pythonr r rr/r"r+__all__r rrrYsp,@-'**&q"55q"h +u@??@s A AA