diff --git a/IPython/frontend/piped_process.py b/IPython/frontend/piped_process.py index 6e51a7d..5339fdd 100644 --- a/IPython/frontend/piped_process.py +++ b/IPython/frontend/piped_process.py @@ -34,7 +34,7 @@ class PipedProcess(Thread): """ process = Popen((self.command_string + ' 2>&1', ), shell=True, universal_newlines=True, - stdout=PIPE, stdin=PIPE) + stdout=PIPE, stdin=PIPE, ) self.process = process while True: out_char = process.stdout.read(1) diff --git a/IPython/frontend/wx/ipythonx.py b/IPython/frontend/wx/ipythonx.py index b16908b..7045e3c 100644 --- a/IPython/frontend/wx/ipythonx.py +++ b/IPython/frontend/wx/ipythonx.py @@ -12,6 +12,8 @@ class IPythonXController(WxController): bindings. """ + debug = False + def __init__(self, *args, **kwargs): WxController.__init__(self, *args, **kwargs) self.ipython0.ask_exit = self.do_exit diff --git a/IPython/frontend/wx/wx_frontend.py b/IPython/frontend/wx/wx_frontend.py index 3bab573..dc8056b 100644 --- a/IPython/frontend/wx/wx_frontend.py +++ b/IPython/frontend/wx/wx_frontend.py @@ -276,7 +276,6 @@ class WxController(PrefilterFrontEnd, ConsoleWidget): """ Capture the character events, let the parent widget handle them, and put our logic afterward. """ - print >>sys.__stderr__, event.KeyCode current_line_number = self.GetCurrentLine() if event.KeyCode in (ord('c'), ord('C')) and event.ControlDown(): # Capture Control-C @@ -290,13 +289,23 @@ class WxController(PrefilterFrontEnd, ConsoleWidget): raise KeyboardException # XXX: We need to make really sure we # get back to a prompt. - elif self._input_state == 'subprocess' and event.KeyCode<256 \ - and event.Modifiers in (wx.MOD_NONE, wx.MOD_WIN): + elif self._input_state == 'subprocess' and ( + ( event.KeyCode<256 and + event.Modifiers in (wx.MOD_NONE, wx.MOD_WIN, wx.MOD_SHIFT)) + or + ( event.KeyCode in (ord('d'), ord('D')) and + event.ControlDown())): # We are running a process, we redirect keys. ConsoleWidget._on_key_down(self, event, skip=skip) - if self.debug: - print >>sys.__stderr__, chr(event.KeyCode) - self._running_process.process.stdin.write(chr(event.KeyCode)) + char = chr(event.KeyCode) + # Deal with some inconsistency in wx keycodes: + if char == '\r': + char = '\n' + elif not event.ShiftDown(): + char = char.lower() + if event.ControlDown() and event.KeyCode in (ord('d'), ord('D')): + char = '\04' + self._running_process.process.stdin.write(char) self._running_process.process.stdin.flush() elif event.KeyCode in (ord('('), 57): # Calltips