##// END OF EJS Templates
Revert Shell.py changes, they don't work.
fperez -
r21:90110a9c
parent child
Show More
@@ -4,7 +4,7
4 All the matplotlib support code was co-developed with John Hunter,
4 All the matplotlib support code was co-developed with John Hunter,
5 matplotlib's author.
5 matplotlib's author.
6
6
7 $Id: Shell.py 874 2005-09-20 20:13:04Z fperez $"""
7 $Id: Shell.py 882 2005-09-20 23:17:41Z fperez $"""
8
8
9 #*****************************************************************************
9 #*****************************************************************************
10 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
10 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
@@ -34,6 +34,9 from IPython.Struct import Struct
34 from IPython.Magic import Magic
34 from IPython.Magic import Magic
35 from IPython import ultraTB
35 from IPython import ultraTB
36
36
37 # global flag to pass around information about Ctrl-C without exceptions
38 KBINT = False
39
37 # global flag to turn on/off Tk support.
40 # global flag to turn on/off Tk support.
38 USE_TK = False
41 USE_TK = False
39
42
@@ -241,8 +244,18 class IPShellEmbed:
241 #-----------------------------------------------------------------------------
244 #-----------------------------------------------------------------------------
242 def sigint_handler (signum,stack_frame):
245 def sigint_handler (signum,stack_frame):
243 """Sigint handler for threaded apps.
246 """Sigint handler for threaded apps.
244 """
247
245 raise KeyboardInterrupt
248 This is a horrible hack to pass information about SIGINT _without_ using
249 exceptions, since I haven't been able to properly manage cross-thread
250 exceptions in GTK/WX. In fact, I don't think it can be done (or at least
251 that's my understanding from a c.l.py thread where this was discussed)."""
252
253 global KBINT
254
255 print '\nKeyboardInterrupt - Press <Enter> to continue.',
256 Term.cout.flush()
257 # Set global flag so that runsource can know that Ctrl-C was hit
258 KBINT = True
246
259
247 class MTInteractiveShell(InteractiveShell):
260 class MTInteractiveShell(InteractiveShell):
248 """Simple multi-threaded shell."""
261 """Simple multi-threaded shell."""
@@ -277,6 +290,13 class MTInteractiveShell(InteractiveShell):
277
290
278 Modified version of code.py's runsource(), to handle threading issues.
291 Modified version of code.py's runsource(), to handle threading issues.
279 See the original for full docstring details."""
292 See the original for full docstring details."""
293
294 global KBINT
295
296 # If Ctrl-C was typed, we reset the flag and return right away
297 if KBINT:
298 KBINT = False
299 return False
280
300
281 try:
301 try:
282 code = self.compile(source, filename, symbol)
302 code = self.compile(source, filename, symbol)
General Comments 0
You need to be logged in to leave comments. Login now