diff options
author | shmel1k <shmel1k@ydb.tech> | 2023-11-26 18:16:14 +0300 |
---|---|---|
committer | shmel1k <shmel1k@ydb.tech> | 2023-11-26 18:43:30 +0300 |
commit | b8cf9e88f4c5c64d9406af533d8948deb050d695 (patch) | |
tree | 218eb61fb3c3b96ec08b4d8cdfef383104a87d63 /contrib/python/Twisted/py3/twisted/internet/wxsupport.py | |
parent | 523f645a83a0ec97a0332dbc3863bb354c92a328 (diff) | |
download | ydb-b8cf9e88f4c5c64d9406af533d8948deb050d695.tar.gz |
add kikimr_configure
Diffstat (limited to 'contrib/python/Twisted/py3/twisted/internet/wxsupport.py')
-rw-r--r-- | contrib/python/Twisted/py3/twisted/internet/wxsupport.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/contrib/python/Twisted/py3/twisted/internet/wxsupport.py b/contrib/python/Twisted/py3/twisted/internet/wxsupport.py new file mode 100644 index 0000000000..a9fab83d37 --- /dev/null +++ b/contrib/python/Twisted/py3/twisted/internet/wxsupport.py @@ -0,0 +1,57 @@ +# Copyright (c) Twisted Matrix Laboratories. +# See LICENSE for details. + +# +"""Old method of wxPython support for Twisted. + +twisted.internet.wxreactor is probably a better choice. + +To use:: + + | # given a wxApp instance called myWxAppInstance: + | from twisted.internet import wxsupport + | wxsupport.install(myWxAppInstance) + +Use Twisted's APIs for running and stopping the event loop, don't use +wxPython's methods. + +On Windows the Twisted event loop might block when dialogs are open +or menus are selected. + +Maintainer: Itamar Shtull-Trauring +""" + +import warnings + +warnings.warn("wxsupport is not fully functional on Windows, wxreactor is better.") + +from twisted.internet import reactor + + +class wxRunner: + """Make sure GUI events are handled.""" + + def __init__(self, app): + self.app = app + + def run(self): + """ + Execute pending WX events followed by WX idle events and + reschedule. + """ + # run wx events + while self.app.Pending(): + self.app.Dispatch() + + # run wx idle events + self.app.ProcessIdle() + reactor.callLater(0.02, self.run) + + +def install(app): + """Install the wxPython support, given a wxApp instance""" + runner = wxRunner(app) + reactor.callLater(0.02, runner.run) + + +__all__ = ["install"] |