Show More
@@ -1,6 +1,8 b'' | |||||
1 | """IPython terminal interface using prompt_toolkit in place of readline""" |
|
1 | """IPython terminal interface using prompt_toolkit in place of readline""" | |
2 | from __future__ import print_function |
|
2 | from __future__ import print_function | |
3 |
|
3 | |||
|
4 | import sys | |||
|
5 | ||||
4 | from IPython.core.interactiveshell import InteractiveShell |
|
6 | from IPython.core.interactiveshell import InteractiveShell | |
5 | from IPython.utils.py3compat import PY3 |
|
7 | from IPython.utils.py3compat import PY3 | |
6 | from traitlets import Bool, Unicode, Dict |
|
8 | from traitlets import Bool, Unicode, Dict | |
@@ -144,6 +146,20 b' class PTInteractiveShell(InteractiveShell):' | |||||
144 | self.pt_cli = CommandLineInterface(app, |
|
146 | self.pt_cli = CommandLineInterface(app, | |
145 | eventloop=create_eventloop(self.inputhook)) |
|
147 | eventloop=create_eventloop(self.inputhook)) | |
146 |
|
148 | |||
|
149 | def init_io(self): | |||
|
150 | if sys.platform not in {'win32', 'cli'}: | |||
|
151 | return | |||
|
152 | ||||
|
153 | import colorama | |||
|
154 | colorama.init() | |||
|
155 | ||||
|
156 | # For some reason we make these wrappers around stdout/stderr. | |||
|
157 | # For now, we need to reset them so all output gets coloured. | |||
|
158 | # https://github.com/ipython/ipython/issues/8669 | |||
|
159 | from IPython.utils import io | |||
|
160 | io.stdout = io.IOStream(sys.stdout) | |||
|
161 | io.stderr = io.IOStream(sys.stderr) | |||
|
162 | ||||
147 | def __init__(self, *args, **kwargs): |
|
163 | def __init__(self, *args, **kwargs): | |
148 | super(PTInteractiveShell, self).__init__(*args, **kwargs) |
|
164 | super(PTInteractiveShell, self).__init__(*args, **kwargs) | |
149 | self.init_prompt_toolkit_cli() |
|
165 | self.init_prompt_toolkit_cli() |
General Comments 0
You need to be logged in to leave comments.
Login now