Show More
@@ -34,7 +34,7 class PipedProcess(Thread): | |||||
34 | """ |
|
34 | """ | |
35 | process = Popen((self.command_string + ' 2>&1', ), shell=True, |
|
35 | process = Popen((self.command_string + ' 2>&1', ), shell=True, | |
36 | universal_newlines=True, |
|
36 | universal_newlines=True, | |
37 | stdout=PIPE, stdin=PIPE) |
|
37 | stdout=PIPE, stdin=PIPE, ) | |
38 | self.process = process |
|
38 | self.process = process | |
39 | while True: |
|
39 | while True: | |
40 | out_char = process.stdout.read(1) |
|
40 | out_char = process.stdout.read(1) |
@@ -12,6 +12,8 class IPythonXController(WxController): | |||||
12 | bindings. |
|
12 | bindings. | |
13 | """ |
|
13 | """ | |
14 |
|
14 | |||
|
15 | debug = False | |||
|
16 | ||||
15 | def __init__(self, *args, **kwargs): |
|
17 | def __init__(self, *args, **kwargs): | |
16 | WxController.__init__(self, *args, **kwargs) |
|
18 | WxController.__init__(self, *args, **kwargs) | |
17 | self.ipython0.ask_exit = self.do_exit |
|
19 | self.ipython0.ask_exit = self.do_exit |
@@ -276,7 +276,6 class WxController(PrefilterFrontEnd, ConsoleWidget): | |||||
276 | """ Capture the character events, let the parent |
|
276 | """ Capture the character events, let the parent | |
277 | widget handle them, and put our logic afterward. |
|
277 | widget handle them, and put our logic afterward. | |
278 | """ |
|
278 | """ | |
279 | print >>sys.__stderr__, event.KeyCode |
|
|||
280 | current_line_number = self.GetCurrentLine() |
|
279 | current_line_number = self.GetCurrentLine() | |
281 | if event.KeyCode in (ord('c'), ord('C')) and event.ControlDown(): |
|
280 | if event.KeyCode in (ord('c'), ord('C')) and event.ControlDown(): | |
282 | # Capture Control-C |
|
281 | # Capture Control-C | |
@@ -290,13 +289,23 class WxController(PrefilterFrontEnd, ConsoleWidget): | |||||
290 | raise KeyboardException |
|
289 | raise KeyboardException | |
291 | # XXX: We need to make really sure we |
|
290 | # XXX: We need to make really sure we | |
292 | # get back to a prompt. |
|
291 | # get back to a prompt. | |
293 |
elif self._input_state == 'subprocess' and |
|
292 | elif self._input_state == 'subprocess' and ( | |
294 | and event.Modifiers in (wx.MOD_NONE, wx.MOD_WIN): |
|
293 | ( event.KeyCode<256 and | |
|
294 | event.Modifiers in (wx.MOD_NONE, wx.MOD_WIN, wx.MOD_SHIFT)) | |||
|
295 | or | |||
|
296 | ( event.KeyCode in (ord('d'), ord('D')) and | |||
|
297 | event.ControlDown())): | |||
295 | # We are running a process, we redirect keys. |
|
298 | # We are running a process, we redirect keys. | |
296 | ConsoleWidget._on_key_down(self, event, skip=skip) |
|
299 | ConsoleWidget._on_key_down(self, event, skip=skip) | |
297 | if self.debug: |
|
300 | char = chr(event.KeyCode) | |
298 | print >>sys.__stderr__, chr(event.KeyCode) |
|
301 | # Deal with some inconsistency in wx keycodes: | |
299 | self._running_process.process.stdin.write(chr(event.KeyCode)) |
|
302 | if char == '\r': | |
|
303 | char = '\n' | |||
|
304 | elif not event.ShiftDown(): | |||
|
305 | char = char.lower() | |||
|
306 | if event.ControlDown() and event.KeyCode in (ord('d'), ord('D')): | |||
|
307 | char = '\04' | |||
|
308 | self._running_process.process.stdin.write(char) | |||
300 | self._running_process.process.stdin.flush() |
|
309 | self._running_process.process.stdin.flush() | |
301 | elif event.KeyCode in (ord('('), 57): |
|
310 | elif event.KeyCode in (ord('('), 57): | |
302 | # Calltips |
|
311 | # Calltips |
General Comments 0
You need to be logged in to leave comments.
Login now