##// END OF EJS Templates
support term_title in pt shell...
Min RK -
Show More
@@ -5,6 +5,8 b' import sys'
5 5
6 6 from IPython.core.interactiveshell import InteractiveShell
7 7 from IPython.utils.py3compat import PY3, cast_unicode_py2, input
8 from IPython.utils.terminal import toggle_set_term_title, set_term_title
9 from IPython.utils.process import abbrev_cwd
8 10 from traitlets import Bool, Unicode, Dict
9 11
10 12 from prompt_toolkit.completion import Completer, Completion
@@ -28,6 +30,7 b' from .pt_inputhooks import get_inputhook_func'
28 30 from .interactiveshell import get_default_editor
29 31
30 32
33
31 34 class IPythonPTCompleter(Completer):
32 35 """Adaptor to provide IPython completions to prompt_toolkit"""
33 36 def __init__(self, ipy_completer):
@@ -69,6 +72,20 b' class TerminalInteractiveShell(InteractiveShell):'
69 72 editor = Unicode(get_default_editor(), config=True,
70 73 help="Set the editor used by IPython (default to $EDITOR/vi/notepad)."
71 74 )
75
76 term_title = Bool(True, config=True,
77 help="Automatically set the terminal title"
78 )
79 def _term_title_changed(self, name, new_value):
80 self.init_term_title()
81
82 def init_term_title(self):
83 # Enable or disable the terminal title.
84 if self.term_title:
85 toggle_set_term_title(True)
86 set_term_title('IPython: ' + abbrev_cwd())
87 else:
88 toggle_set_term_title(False)
72 89
73 90 def get_prompt_tokens(self, cli):
74 91 return [
@@ -187,6 +204,7 b' class TerminalInteractiveShell(InteractiveShell):'
187 204 def __init__(self, *args, **kwargs):
188 205 super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
189 206 self.init_prompt_toolkit_cli()
207 self.init_term_title()
190 208 self.keep_running = True
191 209
192 210 def ask_exit(self):
General Comments 0
You need to be logged in to leave comments. Login now