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