Permalink
Browse files

expand default_editor message to include configurable

Also set the default editor to notepad on Windows.
  • Loading branch information...
minrk committed Jun 1, 2011
1 parent 3590ff4 commit d35e2d216d61ff85f70e8fdd72236712b9f35331
Showing with 10 additions and 3 deletions.
  1. +10 −3 IPython/frontend/qt/console/ipython_widget.py
@@ -40,6 +40,11 @@
# 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
@@ -408,8 +413,10 @@ def _edit(self, filename, line=None):
"""
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

0 comments on commit d35e2d2

Please sign in to comment.