Show More
@@ -86,10 +86,12 b' class WxController(ConsoleWidget, PrefilterFrontEnd):' | |||||
86 |
|
86 | |||
87 |
|
87 | |||
88 | # The buffer being edited. |
|
88 | # The buffer being edited. | |
89 |
# We are duplicating the defin |
|
89 | # We are duplicating the definition here because of multiple | |
90 | # inheritence |
|
90 | # inheritence | |
91 | def _set_input_buffer(self, string): |
|
91 | def _set_input_buffer(self, string): | |
92 |
|
|
92 | ConsoleWidget._set_input_buffer(self, string) | |
|
93 | wx.Yield() | |||
|
94 | self._colorize_input_buffer() | |||
93 |
|
95 | |||
94 | def _get_input_buffer(self): |
|
96 | def _get_input_buffer(self): | |
95 | """ Returns the text in current edit buffer. |
|
97 | """ Returns the text in current edit buffer. | |
@@ -276,9 +278,11 b' class WxController(ConsoleWidget, PrefilterFrontEnd):' | |||||
276 | self.GotoPos(self.GetLength()) |
|
278 | self.GotoPos(self.GetLength()) | |
277 | PrefilterFrontEnd.execute(self, python_string, raw_string=raw_string) |
|
279 | PrefilterFrontEnd.execute(self, python_string, raw_string=raw_string) | |
278 |
|
280 | |||
|
281 | def save_output_hooks(self): | |||
|
282 | self.__old_raw_input = __builtin__.raw_input | |||
|
283 | PrefilterFrontEnd.save_output_hooks(self) | |||
279 |
|
284 | |||
280 | def capture_output(self): |
|
285 | def capture_output(self): | |
281 | self.__old_raw_input = __builtin__.raw_input |
|
|||
282 | __builtin__.raw_input = self.raw_input |
|
286 | __builtin__.raw_input = self.raw_input | |
283 | PrefilterFrontEnd.capture_output(self) |
|
287 | PrefilterFrontEnd.capture_output(self) | |
284 |
|
288 | |||
@@ -312,6 +316,8 b' class WxController(ConsoleWidget, PrefilterFrontEnd):' | |||||
312 | """ |
|
316 | """ | |
313 | self._input_state = 'readline' |
|
317 | self._input_state = 'readline' | |
314 | ConsoleWidget.new_prompt(self, prompt) |
|
318 | ConsoleWidget.new_prompt(self, prompt) | |
|
319 | i = self.current_prompt_line | |||
|
320 | self._markers[i] = self.MarkerAdd(i, _INPUT_MARKER) | |||
315 |
|
321 | |||
316 |
|
322 | |||
317 | def write(self, *args, **kwargs): |
|
323 | def write(self, *args, **kwargs): | |
@@ -415,9 +421,8 b' class WxController(ConsoleWidget, PrefilterFrontEnd):' | |||||
415 | """ |
|
421 | """ | |
416 | if self.debug: |
|
422 | if self.debug: | |
417 | print >>sys.__stdout__, repr(self.input_buffer) |
|
423 | print >>sys.__stdout__, repr(self.input_buffer) | |
418 | i = self.GetLineCount() |
|
|||
419 | self._markers[i] = self.MarkerAdd(i, _INPUT_MARKER) |
|
|||
420 | PrefilterFrontEnd._on_enter(self) |
|
424 | PrefilterFrontEnd._on_enter(self) | |
|
425 | #self._colorize_input_buffer() | |||
421 |
|
426 | |||
422 |
|
427 | |||
423 | #-------------------------------------------------------------------------- |
|
428 | #-------------------------------------------------------------------------- | |
@@ -443,6 +448,15 b' class WxController(ConsoleWidget, PrefilterFrontEnd):' | |||||
443 | self.write(''.join(_out_buffer), refresh=False) |
|
448 | self.write(''.join(_out_buffer), refresh=False) | |
444 | self._buffer_flush_timer.Stop() |
|
449 | self._buffer_flush_timer.Stop() | |
445 |
|
450 | |||
|
451 | def _colorize_input_buffer(self): | |||
|
452 | """ Keep the input buffer lines at a bright color. | |||
|
453 | """ | |||
|
454 | end_line = self.GetCurrentLine() + 1 | |||
|
455 | for i in range(self.current_prompt_line, end_line): | |||
|
456 | if i in self._markers: | |||
|
457 | self.MarkerDeleteHandle(self._markers[i]) | |||
|
458 | self._markers[i] = self.MarkerAdd(i, _INPUT_MARKER) | |||
|
459 | ||||
446 |
|
460 | |||
447 | if __name__ == '__main__': |
|
461 | if __name__ == '__main__': | |
448 | class MainWindow(wx.Frame): |
|
462 | class MainWindow(wx.Frame): |
General Comments 0
You need to be logged in to leave comments.
Login now