diff --git a/IPython/frontend/linefrontendbase.py b/IPython/frontend/linefrontendbase.py index 1a5c360..6f60d75 100644 --- a/IPython/frontend/linefrontendbase.py +++ b/IPython/frontend/linefrontendbase.py @@ -62,15 +62,23 @@ class LineFrontEndBase(FrontEndBase): # Set to true for debug output debug = False + # A banner to print at startup + banner = None + #-------------------------------------------------------------------------- # FrontEndBase interface #-------------------------------------------------------------------------- - def __init__(self, shell=None, history=None, *args, **kwargs): + def __init__(self, shell=None, history=None, banner=None, *args, **kwargs): if shell is None: shell = Interpreter() FrontEndBase.__init__(self, shell=shell, history=history) - + + if banner is not None: + self.banner = banner + if self.banner is not None: + self.write(self.banner, refresh=False) + self.new_prompt(self.input_prompt_template.substitute(number=1)) diff --git a/IPython/frontend/prefilterfrontend.py b/IPython/frontend/prefilterfrontend.py index 3e8bb4a..6b74027 100644 --- a/IPython/frontend/prefilterfrontend.py +++ b/IPython/frontend/prefilterfrontend.py @@ -59,7 +59,6 @@ class PrefilterFrontEnd(LineFrontEndBase): """ def __init__(self, *args, **kwargs): - LineFrontEndBase.__init__(self, *args, **kwargs) self.save_output_hooks() # Instanciate an IPython0 interpreter to be able to use the # prefiltering. @@ -69,9 +68,6 @@ class PrefilterFrontEnd(LineFrontEndBase): lambda s, string: self.write("\n"+string)) self.ipython0.write = self.write self._ip = _ip = IPApi(self.ipython0) - # XXX: Hack: mix the two namespaces - self.shell.user_ns = self.ipython0.user_ns - self.shell.user_global_ns = self.ipython0.user_global_ns # Make sure the raw system call doesn't get called, as we don't # have a stdin accessible. self._ip.system = self.system_call @@ -81,6 +77,15 @@ class PrefilterFrontEnd(LineFrontEndBase): 'ls -CF') # And now clean up the mess created by ipython0 self.release_output() + if not 'banner' in kwargs: + kwargs['banner'] = self.ipython0.BANNER + """ +This is the wx frontend, by Gael Varoquaux. This is EXPERIMENTAL code.""" + + LineFrontEndBase.__init__(self, *args, **kwargs) + # XXX: Hack: mix the two namespaces + self.shell.user_ns = self.ipython0.user_ns + self.shell.user_global_ns = self.ipython0.user_global_ns + self.shell.output_trap = RedirectorOutputTrap( out_callback=self.write, err_callback=self.write, diff --git a/IPython/frontend/wx/console_widget.py b/IPython/frontend/wx/console_widget.py index 0705c01..28e7411 100644 --- a/IPython/frontend/wx/console_widget.py +++ b/IPython/frontend/wx/console_widget.py @@ -175,7 +175,7 @@ class ConsoleWidget(editwindow.EditWindow): The prompt can be given with ascii escape sequences. """ - self.write(prompt) + self.write(prompt, refresh=False) # now we update our cursor giving end of prompt self.current_prompt_pos = self.GetLength() self.current_prompt_line = self.GetCurrentLine() @@ -253,7 +253,6 @@ class ConsoleWidget(editwindow.EditWindow): self.SetIndent(4) self.SetTabWidth(4) - self.EnsureCaretVisible() # we don't want scintilla's autocompletion to choose # automaticaly out of a single choice list, as we pop it up # automaticaly @@ -300,7 +299,6 @@ class ConsoleWidget(editwindow.EditWindow): self.StyleSetSpec(stc.STC_P_OPERATOR, p['operator']) self.StyleSetSpec(stc.STC_P_COMMENTBLOCK, p['comment']) - def _on_key_down(self, event, skip=True): """ Key press callback used for correcting behavior for console-like interfaces: the cursor is constraint to be after diff --git a/IPython/frontend/wx/ipythonx.py b/IPython/frontend/wx/ipythonx.py index 8c88f60..aaef3e7 100644 --- a/IPython/frontend/wx/ipythonx.py +++ b/IPython/frontend/wx/ipythonx.py @@ -16,6 +16,7 @@ You need wxPython to run this application. from wx_frontend import WxController import __builtin__ + class IPythonXController(WxController): """ Sub class of WxController that adds some application-specific bindings. @@ -26,6 +27,9 @@ class IPythonXController(WxController): def __init__(self, *args, **kwargs): WxController.__init__(self, *args, **kwargs) self.ipython0.ask_exit = self.do_exit + # Scroll to top + maxrange = self.GetScrollRange(wx.VERTICAL) + self.ScrollLines(-maxrange) def _on_key_down(self, event, skip=True):