Show More
@@ -33,7 +33,7 b' from IPython.extensions.storemagic import StoreMagics' | |||
|
33 | 33 | from .interactiveshell import TerminalInteractiveShell |
|
34 | 34 | from IPython.paths import get_ipython_dir |
|
35 | 35 | from traitlets import ( |
|
36 | Bool, List, Dict, default, observe, | |
|
36 | Bool, List, Dict, default, observe, Type | |
|
37 | 37 | ) |
|
38 | 38 | |
|
39 | 39 | #----------------------------------------------------------------------------- |
@@ -183,6 +183,13 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):' | |||
|
183 | 183 | flags = Dict(flags) |
|
184 | 184 | aliases = Dict(aliases) |
|
185 | 185 | classes = List() |
|
186 | ||
|
187 | interactive_shell_class = Type( | |
|
188 | klass=object, # use default_value otherwise which only allow subclasses. | |
|
189 | default_value=TerminalInteractiveShell, | |
|
190 | help="Class to use to instantiate the TerminalInteractiveShell object. Useful for custom Frontends" | |
|
191 | ).tag(config=True) | |
|
192 | ||
|
186 | 193 | @default('classes') |
|
187 | 194 | def _classes_default(self): |
|
188 | 195 | """This has to be in a method, for TerminalIPythonApp to be available.""" |
@@ -318,7 +325,7 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):' | |||
|
318 | 325 | # shell.display_banner should always be False for the terminal |
|
319 | 326 | # based app, because we call shell.show_banner() by hand below |
|
320 | 327 | # so the banner shows *before* all extension loading stuff. |
|
321 |
self.shell = |
|
|
328 | self.shell = self.interactive_shell_class.instance(parent=self, | |
|
322 | 329 | profile_dir=self.profile_dir, |
|
323 | 330 | ipython_dir=self.ipython_dir, user_ns=self.user_ns) |
|
324 | 331 | self.shell.configurables.append(self) |
@@ -118,6 +118,15 b' of these as well to improve user experience with better error messages and' | |||
|
118 | 118 | hints. |
|
119 | 119 | |
|
120 | 120 | |
|
121 | Configurable TerminalInteractiveShell | |
|
122 | ------------------------------------- | |
|
123 | ||
|
124 | IPython gained a new ``c.TerminalIPythonApp.interactive_shell_class`` option | |
|
125 | that allow to customize the class used to start the terminal frontend. This | |
|
126 | should allow user to use custom interfaces, like reviving the former readline | |
|
127 | interface which is now a separate package not maintained by the core team. | |
|
128 | ||
|
129 | ||
|
121 | 130 | Miscs improvements |
|
122 | 131 | ------------------ |
|
123 | 132 |
General Comments 0
You need to be logged in to leave comments.
Login now