Permalink
Browse files

expand default_editor message to include configurable

Also set the default editor to notepad on Windows.
  • Loading branch information...
1 parent 424da74 commit 0efe944fcd395c7354170302c95085b47a1a6064 @minrk committed Jun 1, 2011
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
@@ -406,8 +411,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 0efe944

Please sign in to comment.