##// END OF EJS Templates
FIX: make sure the QSocketNotifier is disabled...
Thomas A Caswell -
Show More
@@ -7,6 +7,7 b' from IPython.external.qt_for_kernel import QtCore, QtGui'
7 _appref = None
7 _appref = None
8 _already_warned = False
8 _already_warned = False
9
9
10
10 def inputhook(context):
11 def inputhook(context):
11 global _appref
12 global _appref
12 app = QtCore.QCoreApplication.instance()
13 app = QtCore.QCoreApplication.instance()
@@ -41,9 +42,12 b' def inputhook(context):'
41 # loop when there is input ready to read.
42 # loop when there is input ready to read.
42 notifier = QtCore.QSocketNotifier(context.fileno(),
43 notifier = QtCore.QSocketNotifier(context.fileno(),
43 QtCore.QSocketNotifier.Read)
44 QtCore.QSocketNotifier.Read)
44 # connect the callback we care about before we turn it on
45 try:
45 notifier.activated.connect(event_loop.exit)
46 # connect the callback we care about before we turn it on
46 notifier.setEnabled(True)
47 notifier.activated.connect(event_loop.exit)
47 # only start the event loop we are not already flipped
48 notifier.setEnabled(True)
48 if not context.input_is_ready():
49 # only start the event loop we are not already flipped
49 event_loop.exec_()
50 if not context.input_is_ready():
51 event_loop.exec_()
52 finally:
53 notifier.setEnabled(False)
General Comments 0
You need to be logged in to leave comments. Login now