From 6b65921df18e087a193f1908eda275ddf254a1ab 2008-08-12 16:16:02 From: gvaroquaux Date: 2008-08-12 16:16:02 Subject: [PATCH] Clean up the test application for the wx frontend. --- diff --git a/IPython/frontend/wx/ipythonx.py b/IPython/frontend/wx/ipythonx.py old mode 100644 new mode 100755 index 8458a6f..5c6ef04 --- a/IPython/frontend/wx/ipythonx.py +++ b/IPython/frontend/wx/ipythonx.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python """ Entry point for a simple application giving a graphical frontend to ipython. @@ -12,7 +13,7 @@ class IPythonXController(WxController): bindings. """ - debug = True + debug = False def __init__(self, *args, **kwargs): WxController.__init__(self, *args, **kwargs) @@ -66,8 +67,20 @@ class IPythonX(wx.Frame): def main(): + from optparse import OptionParser + usage = """usage: %prog [options] + +Simple graphical frontend to IPython, using WxWidgets.""" + parser = OptionParser(usage=usage) + parser.add_option("-d", "--debug", + action="store_true", dest="debug", default=False, + help="Enable debug message for the wx frontend.") + + options, args = parser.parse_args() + app = wx.PySimpleApp() frame = IPythonX(None, wx.ID_ANY, 'IPythonX') + frame.shell.debug = options.debug frame.shell.SetFocus() frame.shell.app = app frame.SetSize((680, 460)) diff --git a/IPython/frontend/wx/wx_frontend.py b/IPython/frontend/wx/wx_frontend.py index 17693b3..55882a3 100644 --- a/IPython/frontend/wx/wx_frontend.py +++ b/IPython/frontend/wx/wx_frontend.py @@ -72,7 +72,7 @@ class WxController(ConsoleWidget, PrefilterFrontEnd): input_prompt_template = string.Template(prompt_in1) # Print debug info on what is happening to the console. - debug = True + debug = False # The title of the terminal, as captured through the ANSI escape # sequences. @@ -422,7 +422,6 @@ class WxController(ConsoleWidget, PrefilterFrontEnd): if self.debug: print >>sys.__stdout__, repr(self.input_buffer) PrefilterFrontEnd._on_enter(self) - #self._colorize_input_buffer() #-------------------------------------------------------------------------- @@ -451,6 +450,8 @@ class WxController(ConsoleWidget, PrefilterFrontEnd): def _colorize_input_buffer(self): """ Keep the input buffer lines at a bright color. """ + if not self._input_state == 'readline': + return end_line = self.GetCurrentLine() + 1 for i in range(self.current_prompt_line, end_line): if i in self._markers: