##// END OF EJS Templates
keep track of the sigint timer, and cancel it on a new prompt
Siyu Zhang -
Show More
@@ -71,6 +71,8 b' def create_inputhook_qt4(mgr, app=None):'
71 71
72 72 got_kbdint = [False]
73 73
74 sigint_timer = [None]
75
74 76 def inputhook_qt4():
75 77 """PyOS_InputHook python hook for Qt4.
76 78
@@ -126,12 +128,13 b' def create_inputhook_qt4(mgr, app=None):'
126 128 pid = os.getpid()
127 129 print("^C")
128 130
129 timer = threading.Timer( .01,
131 if(not sigint_timer[0]):
132 sigint_timer[0] = threading.Timer(.01,
130 133 os.kill,
131 134 args=[pid, signal.SIGINT]
132 135 )
133 136
134 timer.start()
137 sigint_timer[0].start()
135 138 else:
136 139 print("\nKeyboardInterrupt - Ctrl-C again for new prompt")
137 140
@@ -152,6 +155,10 b' def create_inputhook_qt4(mgr, app=None):'
152 155 (in case the latter was temporarily deactivated after a
153 156 CTRL+C)
154 157 """
158 if(sigint_timer[0]):
159 sigint_timer[0].cancel()
160 sigint_timer[0] = None
161
155 162 if got_kbdint[0]:
156 163 mgr.set_inputhook(inputhook_qt4)
157 164 got_kbdint[0] = False
General Comments 0
You need to be logged in to leave comments. Login now