##// END OF EJS Templates
Merge pull request #6321 from efiring/fix_nap_qt_wx...
Min RK -
r17668:9d6cfce2 merge
parent child Browse files
Show More
@@ -104,7 +104,7 b' class InputHookManager(object):'
104 This class installs various hooks under ``PyOSInputHook`` to handle
104 This class installs various hooks under ``PyOSInputHook`` to handle
105 GUI event loop integration.
105 GUI event loop integration.
106 """
106 """
107
107
108 def __init__(self):
108 def __init__(self):
109 if ctypes is None:
109 if ctypes is None:
110 warn("IPython GUI event loop requires ctypes, %gui will not be available")
110 warn("IPython GUI event loop requires ctypes, %gui will not be available")
@@ -204,14 +204,16 b' class InputHookManager(object):'
204 app = wx.App(redirect=False, clearSigInt=False)
204 app = wx.App(redirect=False, clearSigInt=False)
205 """
205 """
206 import wx
206 import wx
207
207
208 wx_version = V(wx.__version__).version
208 wx_version = V(wx.__version__).version
209
209
210 if wx_version < [2, 8]:
210 if wx_version < [2, 8]:
211 raise ValueError("requires wxPython >= 2.8, but you have %s" % wx.__version__)
211 raise ValueError("requires wxPython >= 2.8, but you have %s" % wx.__version__)
212
212
213 from IPython.lib.inputhookwx import inputhook_wx
213 from IPython.lib.inputhookwx import inputhook_wx
214 from IPython.external.appnope import nope
214 self.set_inputhook(inputhook_wx)
215 self.set_inputhook(inputhook_wx)
216 nope()
215 self._current_gui = GUI_WX
217 self._current_gui = GUI_WX
216 import wx
218 import wx
217 if app is None:
219 if app is None:
@@ -227,13 +229,15 b' class InputHookManager(object):'
227
229
228 This merely sets PyOS_InputHook to NULL.
230 This merely sets PyOS_InputHook to NULL.
229 """
231 """
232 from IPython.external.appnope import nap
230 if GUI_WX in self._apps:
233 if GUI_WX in self._apps:
231 self._apps[GUI_WX]._in_event_loop = False
234 self._apps[GUI_WX]._in_event_loop = False
232 self.clear_inputhook()
235 self.clear_inputhook()
236 nap()
233
237
234 def enable_qt4(self, app=None):
238 def enable_qt4(self, app=None):
235 """Enable event loop integration with PyQt4.
239 """Enable event loop integration with PyQt4.
236
240
237 Parameters
241 Parameters
238 ----------
242 ----------
239 app : Qt Application, optional.
243 app : Qt Application, optional.
@@ -254,8 +258,10 b' class InputHookManager(object):'
254 app = QtGui.QApplication(sys.argv)
258 app = QtGui.QApplication(sys.argv)
255 """
259 """
256 from IPython.lib.inputhookqt4 import create_inputhook_qt4
260 from IPython.lib.inputhookqt4 import create_inputhook_qt4
261 from IPython.external.appnope import nope
257 app, inputhook_qt4 = create_inputhook_qt4(self, app)
262 app, inputhook_qt4 = create_inputhook_qt4(self, app)
258 self.set_inputhook(inputhook_qt4)
263 self.set_inputhook(inputhook_qt4)
264 nope()
259
265
260 self._current_gui = GUI_QT4
266 self._current_gui = GUI_QT4
261 app._in_event_loop = True
267 app._in_event_loop = True
@@ -267,9 +273,11 b' class InputHookManager(object):'
267
273
268 This merely sets PyOS_InputHook to NULL.
274 This merely sets PyOS_InputHook to NULL.
269 """
275 """
276 from IPython.external.appnope import nap
270 if GUI_QT4 in self._apps:
277 if GUI_QT4 in self._apps:
271 self._apps[GUI_QT4]._in_event_loop = False
278 self._apps[GUI_QT4]._in_event_loop = False
272 self.clear_inputhook()
279 self.clear_inputhook()
280 nap()
273
281
274 def enable_gtk(self, app=None):
282 def enable_gtk(self, app=None):
275 """Enable event loop integration with PyGTK.
283 """Enable event loop integration with PyGTK.
@@ -299,7 +307,7 b' class InputHookManager(object):'
299
307
300 def disable_gtk(self):
308 def disable_gtk(self):
301 """Disable event loop integration with PyGTK.
309 """Disable event loop integration with PyGTK.
302
310
303 This merely sets PyOS_InputHook to NULL.
311 This merely sets PyOS_InputHook to NULL.
304 """
312 """
305 self.clear_inputhook()
313 self.clear_inputhook()
@@ -333,7 +341,7 b' class InputHookManager(object):'
333
341
334 def disable_tk(self):
342 def disable_tk(self):
335 """Disable event loop integration with Tkinter.
343 """Disable event loop integration with Tkinter.
336
344
337 This merely sets PyOS_InputHook to NULL.
345 This merely sets PyOS_InputHook to NULL.
338 """
346 """
339 self.clear_inputhook()
347 self.clear_inputhook()
@@ -359,7 +367,7 b' class InputHookManager(object):'
359 without first creating a window. You should thus not create another
367 without first creating a window. You should thus not create another
360 window but use instead the created one. See 'gui-glut.py' in the
368 window but use instead the created one. See 'gui-glut.py' in the
361 docs/examples/lib directory.
369 docs/examples/lib directory.
362
370
363 The default screen mode is set to:
371 The default screen mode is set to:
364 glut.GLUT_DOUBLE | glut.GLUT_RGBA | glut.GLUT_DEPTH
372 glut.GLUT_DOUBLE | glut.GLUT_RGBA | glut.GLUT_DEPTH
365 """
373 """
@@ -393,7 +401,7 b' class InputHookManager(object):'
393
401
394 def disable_glut(self):
402 def disable_glut(self):
395 """Disable event loop integration with glut.
403 """Disable event loop integration with glut.
396
404
397 This sets PyOS_InputHook to NULL and set the display function to a
405 This sets PyOS_InputHook to NULL and set the display function to a
398 dummy one and set the timer to a dummy timer that will be triggered
406 dummy one and set the timer to a dummy timer that will be triggered
399 very far in the future.
407 very far in the future.
General Comments 0
You need to be logged in to leave comments. Login now