aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Twisted/py2/twisted/internet/pyuisupport.py
diff options
context:
space:
mode:
authorshmel1k <shmel1k@ydb.tech>2023-11-26 18:16:14 +0300
committershmel1k <shmel1k@ydb.tech>2023-11-26 18:43:30 +0300
commitb8cf9e88f4c5c64d9406af533d8948deb050d695 (patch)
tree218eb61fb3c3b96ec08b4d8cdfef383104a87d63 /contrib/python/Twisted/py2/twisted/internet/pyuisupport.py
parent523f645a83a0ec97a0332dbc3863bb354c92a328 (diff)
downloadydb-b8cf9e88f4c5c64d9406af533d8948deb050d695.tar.gz
add kikimr_configure
Diffstat (limited to 'contrib/python/Twisted/py2/twisted/internet/pyuisupport.py')
-rw-r--r--contrib/python/Twisted/py2/twisted/internet/pyuisupport.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/contrib/python/Twisted/py2/twisted/internet/pyuisupport.py b/contrib/python/Twisted/py2/twisted/internet/pyuisupport.py
new file mode 100644
index 0000000000..1e7def5911
--- /dev/null
+++ b/contrib/python/Twisted/py2/twisted/internet/pyuisupport.py
@@ -0,0 +1,37 @@
+# Copyright (c) Twisted Matrix Laboratories.
+# See LICENSE for details.
+
+
+"""
+This module integrates PyUI with twisted.internet's mainloop.
+
+Maintainer: Jp Calderone
+
+See doc/examples/pyuidemo.py for example usage.
+"""
+
+# System imports
+import pyui
+
+def _guiUpdate(reactor, delay):
+ pyui.draw()
+ if pyui.update() == 0:
+ pyui.quit()
+ reactor.stop()
+ else:
+ reactor.callLater(delay, _guiUpdate, reactor, delay)
+
+
+def install(ms=10, reactor=None, args=(), kw={}):
+ """
+ Schedule PyUI's display to be updated approximately every C{ms}
+ milliseconds, and initialize PyUI with the specified arguments.
+ """
+ d = pyui.init(*args, **kw)
+
+ if reactor is None:
+ from twisted.internet import reactor
+ _guiUpdate(reactor, ms / 1000.0)
+ return d
+
+__all__ = ["install"]