##// END OF EJS Templates
Minor work on the GUI support in the kernel.
Brian Granger -
Show More
@@ -47,6 +47,9 b' we proposed the following informal protocol:'
47 47 to see if ``_in_event_loop`` attribute has been set. If it is set, you
48 48 *must* use its value. If it has not been set, you can query the toolkit
49 49 in the normal manner.
50 * If you want GUI support and no one else has created an application or
51 started the event loop you *must* do this. We don't want projects to
52 attempt to defer these things to someone else if they themselves need it.
50 53
51 54 The functions below implement this logic for each GUI toolkit. If you need
52 55 to create custom application subclasses, you will likely have to modify this
@@ -302,13 +302,15 b' class QtKernel(Kernel):'
302 302 """Start a kernel with QtPy4 event loop integration."""
303 303
304 304 from PyQt4 import QtGui, QtCore
305 self.app = QtGui.QApplication([])
305 from IPython.lib.guisupport import (
306 get_app_qt4, start_event_loop_qt4
307 )
308 self.app = get_app_qt4([" "])
306 309 self.app.setQuitOnLastWindowClosed (False)
307 310 self.timer = QtCore.QTimer()
308 311 self.timer.timeout.connect(self.do_one_iteration)
309 312 self.timer.start(50)
310 self.app.exec_()
311
313 start_event_loop_qt4(self.app)
312 314
313 315 class WxKernel(Kernel):
314 316 """A Kernel subclass with Wx support."""
@@ -317,6 +319,7 b' class WxKernel(Kernel):'
317 319 """Start a kernel with wx event loop support."""
318 320
319 321 import wx
322 from IPython.lib.guisupport import start_event_loop_wx
320 323 doi = self.do_one_iteration
321 324
322 325 # We have to put the wx.Timer in a wx.Frame for it to fire properly.
@@ -342,7 +345,7 b' class WxKernel(Kernel):'
342 345 # The redirect=False here makes sure that wx doesn't replace
343 346 # sys.stdout/stderr with its own classes.
344 347 self.app = IPWxApp(redirect=False)
345 self.app.MainLoop()
348 start_event_loop_wx(self.app)
346 349
347 350
348 351 class TkKernel(Kernel):
General Comments 0
You need to be logged in to leave comments. Login now