##// END OF EJS Templates
Fixed a few bugs and added spin_qt4 and spin_wx.
Brian Granger -
Show More
@@ -3551,7 +3551,7 b' Defaulting color scheme to \'NoColor\'"""'
3551 are supports: wxPython, PyQt4, PyGTK, and Tk::
3551 are supports: wxPython, PyQt4, PyGTK, and Tk::
3552
3552
3553 %gui wx # enable wxPython event loop integration
3553 %gui wx # enable wxPython event loop integration
3554 %gui qt4 # enable PyQt4 event loop integration
3554 %gui qt4|qt # enable PyQt4 event loop integration
3555 %gui gtk # enable PyGTK event loop integration
3555 %gui gtk # enable PyGTK event loop integration
3556 %gui tk # enable Tk event loop integration
3556 %gui tk # enable Tk event loop integration
3557 %gui # disable all event loop integration
3557 %gui # disable all event loop integration
@@ -3576,7 +3576,7 b' Defaulting color scheme to \'NoColor\'"""'
3576 inputhook.clear_inputhook()
3576 inputhook.clear_inputhook()
3577 elif 'wx' in parameter_s:
3577 elif 'wx' in parameter_s:
3578 return inputhook.enable_wx(app)
3578 return inputhook.enable_wx(app)
3579 elif 'qt4' in parameter_s:
3579 elif ('qt4' in parameter_s) or ('qt' in parameter_s):
3580 return inputhook.enable_qt4(app)
3580 return inputhook.enable_qt4(app)
3581 elif 'gtk' in parameter_s:
3581 elif 'gtk' in parameter_s:
3582 return inputhook.enable_gtk(app)
3582 return inputhook.enable_gtk(app)
@@ -26,6 +26,31 b' def _dummy_mainloop(*args, **kw):'
26 pass
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 class InputHookManager(object):
54 class InputHookManager(object):
30 """Manage PyOS_InputHook for different GUI toolkits.
55 """Manage PyOS_InputHook for different GUI toolkits.
31
56
@@ -203,7 +228,7 b' class InputHookManager(object):'
203 self._hijack_qt4()
228 self._hijack_qt4()
204 if app:
229 if app:
205 from PyQt4 import QtGui
230 from PyQt4 import QtGui
206 app = QtGui.QApplication.instance()
231 app = QtCore.QCoreApplication.instance()
207 if app is None:
232 if app is None:
208 app = QtGui.QApplication(sys.argv)
233 app = QtGui.QApplication(sys.argv)
209 self._apps['qt4'] = app
234 self._apps['qt4'] = app
General Comments 0
You need to be logged in to leave comments. Login now