From 0fd5069ea5b61b79c23302461ae138e3eecbfc65 2008-07-20 19:40:39 From: Gael Varoquaux Date: 2008-07-20 19:40:39 Subject: [PATCH] Tracebacks in red. --- diff --git a/IPython/frontend/wx/wx_frontend.py b/IPython/frontend/wx/wx_frontend.py index 1663a68..b1e35dc 100644 --- a/IPython/frontend/wx/wx_frontend.py +++ b/IPython/frontend/wx/wx_frontend.py @@ -31,9 +31,10 @@ from IPython.frontend.prefilterfrontend import PrefilterFrontEnd #_COMMAND_BG = '#FAFAF1' # Nice green _RUNNING_BUFFER_BG = '#FDFFD3' # Nice yellow +_ERROR_BG = '#FFF1F1' # Nice red _RUNNING_BUFFER_MARKER = 31 - +_ERROR_MARKER = 30 #------------------------------------------------------------------------------- # Classes to implement the Wx frontend @@ -61,6 +62,9 @@ class IPythonWxController(PrefilterFrontEnd, ConsoleWidget): # Marker for running buffer. self.MarkerDefine(_RUNNING_BUFFER_MARKER, stc.STC_MARK_BACKGROUND, background=_RUNNING_BUFFER_BG) + # Marker for tracebacks. + self.MarkerDefine(_ERROR_MARKER, stc.STC_MARK_BACKGROUND, + background=_ERROR_BG) @@ -122,7 +126,7 @@ class IPythonWxController(PrefilterFrontEnd, ConsoleWidget): end_line = self.current_prompt_line \ + max(1, len(raw_string.split('\n'))-1) for i in range(self.current_prompt_line, end_line): - self.MarkerAdd(i, 31) + self.MarkerAdd(i, _RUNNING_BUFFER_MARKER) # Update the display: wx.Yield() ## Remove the trailing "\n" for cleaner display @@ -137,6 +141,15 @@ class IPythonWxController(PrefilterFrontEnd, ConsoleWidget): if hasattr(self, '_cursor'): del self._cursor + + def show_traceback(self): + start_line = self.GetCurrentLine() + PrefilterFrontEnd.show_traceback(self) + wx.Yield() + for i in range(start_line, self.GetCurrentLine()): + self.MarkerAdd(i, _ERROR_MARKER) + + #-------------------------------------------------------------------------- # Private API #--------------------------------------------------------------------------