From d13d89a36993d49c61c11462f01901edfd30ae09 2008-08-13 21:28:05 From: gvaroquaux Date: 2008-08-13 21:28:05 Subject: [PATCH] Better fonts on MacOSX. Exit in ipythonx closes pylab/mlab windows. --- diff --git a/IPython/frontend/prefilterfrontend.py b/IPython/frontend/prefilterfrontend.py index 6b74027..b495382 100644 --- a/IPython/frontend/prefilterfrontend.py +++ b/IPython/frontend/prefilterfrontend.py @@ -107,6 +107,8 @@ This is the wx frontend, by Gael Varoquaux. This is EXPERIMENTAL code.""" def execute(self, python_string, raw_string=None): + if self.debug: + print 'Executing Python code:', repr(python_string) self.capture_output() LineFrontEndBase.execute(self, python_string, raw_string=raw_string) @@ -178,7 +180,8 @@ This is the wx frontend, by Gael Varoquaux. This is EXPERIMENTAL code.""" self.last_result = dict(number=self.prompt_number) try: for line in input_string.split('\n'): - filtered_lines.append(self.ipython0.prefilter(line, False)) + filtered_lines.append( + self.ipython0.prefilter(line, False).rstrip()) except: # XXX: probably not the right thing to do. self.ipython0.showsyntaxerror() @@ -186,6 +189,7 @@ This is the wx frontend, by Gael Varoquaux. This is EXPERIMENTAL code.""" finally: self.release_output() + # Clean up the trailing whitespace, to avoid indentation errors filtered_string = '\n'.join(filtered_lines) return filtered_string diff --git a/IPython/frontend/wx/console_widget.py b/IPython/frontend/wx/console_widget.py index a4ac703..df06a28 100644 --- a/IPython/frontend/wx/console_widget.py +++ b/IPython/frontend/wx/console_widget.py @@ -34,6 +34,8 @@ import re # screen: this should not be editable by the user. _DEFAULT_SIZE = 10 +if sys.platform == 'darwin': + _DEFAULT_STYLE = 12 _DEFAULT_STYLE = { 'stdout' : 'fore:#0000FF', diff --git a/IPython/frontend/wx/ipythonx.py b/IPython/frontend/wx/ipythonx.py index aaef3e7..df81443 100644 --- a/IPython/frontend/wx/ipythonx.py +++ b/IPython/frontend/wx/ipythonx.py @@ -54,6 +54,9 @@ class IPythonXController(WxController): wx.CallAfter(self.new_prompt, self.input_prompt_template.substitute( number=self.last_result['number'] + 1)) + else: + wx.CallAfter(wx.GetApp().Exit) + self.write('Exiting ...', refresh=False) def do_exit(self):