From 3ffb5e70e589c2508420758b01b2a1bac2e9bc7f 2011-06-20 23:40:12 From: MinRK Date: 2011-06-20 23:40:12 Subject: [PATCH] expand default_editor message to include configurable Also set the default editor to notepad on Windows. --- diff --git a/IPython/frontend/qt/console/ipython_widget.py b/IPython/frontend/qt/console/ipython_widget.py index e2c2255..a2c12b3 100644 --- a/IPython/frontend/qt/console/ipython_widget.py +++ b/IPython/frontend/qt/console/ipython_widget.py @@ -40,6 +40,11 @@ default_output_sep2 = '' # Base path for most payload sources. zmq_shell_source = 'IPython.zmq.zmqshell.ZMQInteractiveShell' +if sys.platform.startswith('win'): + default_editor = 'notepad' +else: + default_editor = '' + #----------------------------------------------------------------------------- # IPythonWidget class #----------------------------------------------------------------------------- @@ -54,7 +59,7 @@ class IPythonWidget(FrontendWidget): custom_edit = Bool(False) custom_edit_requested = QtCore.Signal(object, object) - editor = Unicode('default', config=True, + editor = Unicode(default_editor, config=True, help=""" A command for invoking a system text editor. If the string contains a {filename} format specifier, it will be used. Otherwise, the filename will @@ -406,8 +411,10 @@ class IPythonWidget(FrontendWidget): """ if self.custom_edit: self.custom_edit_requested.emit(filename, line) - elif self.editor == 'default': - self._append_plain_text('No default editor available.\n') + elif not self.editor: + self._append_plain_text('No default editor available.\n' + 'Specify a GUI text editor in the `IPythonWidget.editor` configurable\n' + 'to enable the %edit magic') else: try: filename = '"%s"' % filename