##// END OF EJS Templates
Fixed a few bugs and added spin_qt4 and spin_wx.
Brian Granger -
Show More
@@ -3550,11 +3550,11 b' Defaulting color scheme to \'NoColor\'"""'
3550 3550 interrupts should work without any problems. The following toolkits
3551 3551 are supports: wxPython, PyQt4, PyGTK, and Tk::
3552 3552
3553 %gui wx # enable wxPython event loop integration
3554 %gui qt4 # enable PyQt4 event loop integration
3555 %gui gtk # enable PyGTK event loop integration
3556 %gui tk # enable Tk event loop integration
3557 %gui # disable all event loop integration
3553 %gui wx # enable wxPython event loop integration
3554 %gui qt4|qt # enable PyQt4 event loop integration
3555 %gui gtk # enable PyGTK event loop integration
3556 %gui tk # enable Tk event loop integration
3557 %gui # disable all event loop integration
3558 3558
3559 3559 WARNING: after any of these has been called you can simply create
3560 3560 an application object, but DO NOT start the event loop yourself, as
@@ -3576,7 +3576,7 b' Defaulting color scheme to \'NoColor\'"""'
3576 3576 inputhook.clear_inputhook()
3577 3577 elif 'wx' in parameter_s:
3578 3578 return inputhook.enable_wx(app)
3579 elif 'qt4' in parameter_s:
3579 elif ('qt4' in parameter_s) or ('qt' in parameter_s):
3580 3580 return inputhook.enable_qt4(app)
3581 3581 elif 'gtk' in parameter_s:
3582 3582 return inputhook.enable_gtk(app)
@@ -26,6 +26,31 b' def _dummy_mainloop(*args, **kw):'
26 26 pass
27 27
28 28
29 def spin_qt4():
30 from PyQt4 import QtCore, QtGui
31
32 app = QtCore.QCoreApplication.instance()
33 if app is not None and app.thread == QtCore.QThread.currentThread():
34 timer = QtCore.QTimer()
35 QtCore.QObject.connect(timer,
36 QtCore.SIGNAL('timeout()'),
37 QtCore.SLOT('quit()'))
38 self.timer.start(100)
39 QtCore.QCoreApplication.exec_()
40 timer.stop()
41
42
43 def spin_wx():
44 app = wx.GetApp()
45 if app is not None and wx.Thread_IsMain():
46 evtloop = wx.EventLoop()
47 ea = wx.EventLoopActivator(evtloop)
48 while evtloop.Pending():
49 evtloop.Dispatch()
50 app.ProcessIdle()
51 del ea
52
53
29 54 class InputHookManager(object):
30 55 """Manage PyOS_InputHook for different GUI toolkits.
31 56
@@ -203,7 +228,7 b' class InputHookManager(object):'
203 228 self._hijack_qt4()
204 229 if app:
205 230 from PyQt4 import QtGui
206 app = QtGui.QApplication.instance()
231 app = QtCore.QCoreApplication.instance()
207 232 if app is None:
208 233 app = QtGui.QApplication(sys.argv)
209 234 self._apps['qt4'] = app
General Comments 0
You need to be logged in to leave comments. Login now