[pyzo] 08/19: GUI integration for tornado runs actual event loop for better performance
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Fri Jul 1 16:22:03 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository pyzo.
commit 111e485dbff3612037f832553968801596a4c802
Author: Almar Klein <almar.klein at gmail.com>
Date: Thu Jun 23 22:53:24 2016 +0200
GUI integration for tornado runs actual event loop for better performance
---
pyzo/pyzokernel/guiintegration.py | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/pyzo/pyzokernel/guiintegration.py b/pyzo/pyzokernel/guiintegration.py
index d6cf84a..5f7fa22 100644
--- a/pyzo/pyzokernel/guiintegration.py
+++ b/pyzo/pyzokernel/guiintegration.py
@@ -210,6 +210,10 @@ class App_tornado(App_base):
# Replace mainloop with a dummy
def dummy_start():
printDirect(mainloopWarning)
+ sys._pyzoInterpreter.ignore_sys_exit = True
+ self.app.add_callback(reset_sys_exit)
+ def reset_sys_exit():
+ sys._pyzoInterpreter.ignore_sys_exit = False
def run_sync(func, timeout=None):
self.app.start = self.app._original_start
try:
@@ -226,21 +230,25 @@ class App_tornado(App_base):
# Notify that we integrated the event loop
self.app._in_event_loop = 'Pyzo'
+
+ self._warned_about_process_events = False
def process_events(self):
- self.app.run_sync(lambda x=None: None)
+ if not self._warned_about_process_events:
+ print('Warning: cannot process events synchronously in Tornado')
+ self._warned_about_process_events = True
+ #self.app.run_sync(lambda x=None: None)
- # def run(self, repl_callback, sleeptime=None):
- # from tornado.ioloop import PeriodicCallback
- # # Create timer
- # self._timer = PeriodicCallback(repl_callback, 0.05*1000)
- # self._timer.start()
- # # Enter mainloop
- # self.app._original_start()
- #
- # def quit(self):
- # self.app.stop()
-
+ def run(self, repl_callback, sleeptime=None):
+ from tornado.ioloop import PeriodicCallback
+ # Create timer
+ self._timer = PeriodicCallback(repl_callback, 0.05*1000)
+ self._timer.start()
+ # Enter mainloop
+ self.app._original_start()
+
+ def quit(self):
+ self.app.stop()
class App_qt(App_base):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyzo.git
More information about the debian-science-commits
mailing list