Show More
@@ -60,7 +60,7 b' You can implement other color schemes easily, the syntax is fairly' | |||||
60 | self-explanatory. Please send back new schemes you develop to the author for |
|
60 | self-explanatory. Please send back new schemes you develop to the author for | |
61 | possible inclusion in future releases. |
|
61 | possible inclusion in future releases. | |
62 |
|
62 | |||
63 |
$Id: ultraTB.py |
|
63 | $Id: ultraTB.py 636 2005-07-17 03:11:11Z fperez $""" | |
64 |
|
64 | |||
65 | #***************************************************************************** |
|
65 | #***************************************************************************** | |
66 | # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu> |
|
66 | # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu> | |
@@ -99,24 +99,13 b' def inspect_error():' | |||||
99 | error('Internal Python error in the inspect module.\n' |
|
99 | error('Internal Python error in the inspect module.\n' | |
100 | 'Below is the traceback from this internal error.\n') |
|
100 | 'Below is the traceback from this internal error.\n') | |
101 |
|
101 | |||
102 | class TBTools: |
|
102 | # Make a global variable out of the color scheme table used for coloring | |
103 | """Basic tools used by all traceback printer classes.""" |
|
103 | # exception tracebacks. This allows user code to add new schemes at runtime. | |
104 |
|
104 | ExceptionColors = ColorSchemeTable() | ||
105 | def __init__(self,color_scheme = 'NoColor',call_pdb=0): |
|
|||
106 | # Whether to call the interactive pdb debugger after printing |
|
|||
107 | # tracebacks or not |
|
|||
108 | self.call_pdb = call_pdb |
|
|||
109 | if call_pdb: |
|
|||
110 | self.pdb = Debugger.Pdb() |
|
|||
111 | else: |
|
|||
112 | self.pdb = None |
|
|||
113 |
|
||||
114 | # Create color table |
|
|||
115 | self.ColorSchemeTable = ColorSchemeTable() |
|
|||
116 |
|
105 | |||
117 |
|
|
106 | # Populate it with color schemes | |
118 |
|
|
107 | C = TermColors # shorthand and local lookup | |
119 |
|
|
108 | ExceptionColors.add_scheme(ColorScheme( | |
120 |
|
|
109 | 'NoColor', | |
121 |
|
|
110 | # The color to be used for the top line | |
122 |
|
|
111 | topline = C.NoColor, | |
@@ -143,8 +132,8 b' class TBTools:' | |||||
143 |
|
|
132 | Normal = C.NoColor | |
144 |
|
|
133 | )) | |
145 |
|
134 | |||
146 |
|
|
135 | # make some schemes as instances so we can copy them for modification easily | |
147 |
|
|
136 | ExceptionColors.add_scheme(ColorScheme( | |
148 |
|
|
137 | 'Linux', | |
149 |
|
|
138 | # The color to be used for the top line | |
150 |
|
|
139 | topline = C.LightRed, | |
@@ -172,7 +161,7 b' class TBTools:' | |||||
172 |
|
|
161 | )) | |
173 |
|
162 | |||
174 |
|
|
163 | # For light backgrounds, swap dark/light colors | |
175 |
|
|
164 | ExceptionColors.add_scheme(ColorScheme( | |
176 |
|
|
165 | 'LightBG', | |
177 |
|
|
166 | # The color to be used for the top line | |
178 |
|
|
167 | topline = C.Red, | |
@@ -200,6 +189,21 b' class TBTools:' | |||||
200 |
|
|
189 | Normal = C.Normal | |
201 |
|
|
190 | )) | |
202 |
|
191 | |||
|
192 | class TBTools: | |||
|
193 | """Basic tools used by all traceback printer classes.""" | |||
|
194 | ||||
|
195 | def __init__(self,color_scheme = 'NoColor',call_pdb=0): | |||
|
196 | # Whether to call the interactive pdb debugger after printing | |||
|
197 | # tracebacks or not | |||
|
198 | self.call_pdb = call_pdb | |||
|
199 | if call_pdb: | |||
|
200 | self.pdb = Debugger.Pdb() | |||
|
201 | else: | |||
|
202 | self.pdb = None | |||
|
203 | ||||
|
204 | # Create color table | |||
|
205 | self.ColorSchemeTable = ExceptionColors | |||
|
206 | ||||
203 | self.set_colors(color_scheme) |
|
207 | self.set_colors(color_scheme) | |
204 | self.old_scheme = color_scheme # save initial value for toggles |
|
208 | self.old_scheme = color_scheme # save initial value for toggles | |
205 |
|
209 |
@@ -1,3 +1,18 b'' | |||||
|
1 | 2005-07-16 Fernando Perez <fperez@colorado.edu> | |||
|
2 | ||||
|
3 | * IPython/ultraTB.py (ExceptionColors): Make a global variable | |||
|
4 | out of the color scheme table used for coloring exception | |||
|
5 | tracebacks. This allows user code to add new schemes at runtime. | |||
|
6 | This is a minimally modified version of the patch at | |||
|
7 | http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw | |||
|
8 | for the contribution. | |||
|
9 | ||||
|
10 | * IPython/FlexCompleter.py (Completer.attr_matches): Add a | |||
|
11 | slightly modified version of the patch in | |||
|
12 | http://www.scipy.net/roundup/ipython/issue34, which also allows me | |||
|
13 | to remove the previous try/except solution (which was costlier). | |||
|
14 | Thanks to glehmann for the fix. | |||
|
15 | ||||
1 | 2005-06-08 Fernando Perez <fperez@colorado.edu> |
|
16 | 2005-06-08 Fernando Perez <fperez@colorado.edu> | |
2 |
|
17 | |||
3 | * IPython/iplib.py (write/write_err): Add methods to abstract all |
|
18 | * IPython/iplib.py (write/write_err): Add methods to abstract all |
General Comments 0
You need to be logged in to leave comments.
Login now