Show More
@@ -108,6 +108,11 b' def softspace(file, newvalue):' | |||||
108 |
|
108 | |||
109 | def no_op(*a, **kw): pass |
|
109 | def no_op(*a, **kw): pass | |
110 |
|
110 | |||
|
111 | class NoOpContext(object): | |||
|
112 | def __enter__(self): pass | |||
|
113 | def __exit__(self, type, value, traceback): pass | |||
|
114 | no_op_context = NoOpContext() | |||
|
115 | ||||
111 | class SpaceInInput(Exception): pass |
|
116 | class SpaceInInput(Exception): pass | |
112 |
|
117 | |||
113 | class Bunch: pass |
|
118 | class Bunch: pass | |
@@ -242,6 +247,15 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||||
242 | default_value=get_default_colors(), config=True, |
|
247 | default_value=get_default_colors(), config=True, | |
243 | help="Set the color scheme (NoColor, Linux, or LightBG)." |
|
248 | help="Set the color scheme (NoColor, Linux, or LightBG)." | |
244 | ) |
|
249 | ) | |
|
250 | colors_force = CBool(False, help= | |||
|
251 | """ | |||
|
252 | Force use of ANSI color codes, regardless of OS and readline | |||
|
253 | availability. | |||
|
254 | """ | |||
|
255 | # FIXME: This is essentially a hack to allow ZMQShell to show colors | |||
|
256 | # without readline on Win32. When the ZMQ formatting system is | |||
|
257 | # refactored, this should be removed. | |||
|
258 | ) | |||
245 | debug = CBool(False, config=True) |
|
259 | debug = CBool(False, config=True) | |
246 | deep_reload = CBool(False, config=True, help= |
|
260 | deep_reload = CBool(False, config=True, help= | |
247 | """ |
|
261 | """ | |
@@ -1636,10 +1650,12 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||||
1636 | self.has_readline = False |
|
1650 | self.has_readline = False | |
1637 | self.readline = None |
|
1651 | self.readline = None | |
1638 | # Set a number of methods that depend on readline to be no-op |
|
1652 | # Set a number of methods that depend on readline to be no-op | |
|
1653 | self.readline_no_record = no_op_context | |||
1639 | self.set_readline_completer = no_op |
|
1654 | self.set_readline_completer = no_op | |
1640 | self.set_custom_completer = no_op |
|
1655 | self.set_custom_completer = no_op | |
1641 | self.set_completer_frame = no_op |
|
1656 | self.set_completer_frame = no_op | |
1642 | warn('Readline services not available or not loaded.') |
|
1657 | if self.readline_use: | |
|
1658 | warn('Readline services not available or not loaded.') | |||
1643 | else: |
|
1659 | else: | |
1644 | self.has_readline = True |
|
1660 | self.has_readline = True | |
1645 | self.readline = readline |
|
1661 | self.readline = readline |
@@ -2496,7 +2496,8 b' Currently the magic system has the following functions:\\n"""' | |||||
2496 |
|
2496 | |||
2497 | import IPython.utils.rlineimpl as readline |
|
2497 | import IPython.utils.rlineimpl as readline | |
2498 |
|
2498 | |||
2499 | if not readline.have_readline and sys.platform == "win32": |
|
2499 | if not shell.colors_force and \ | |
|
2500 | not readline.have_readline and sys.platform == "win32": | |||
2500 | msg = """\ |
|
2501 | msg = """\ | |
2501 | Proper color support under MS Windows requires the pyreadline library. |
|
2502 | Proper color support under MS Windows requires the pyreadline library. | |
2502 | You can find it at: |
|
2503 | You can find it at: | |
@@ -2510,7 +2511,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2510 | warn(msg) |
|
2511 | warn(msg) | |
2511 |
|
2512 | |||
2512 | # readline option is 0 |
|
2513 | # readline option is 0 | |
2513 | if not shell.has_readline: |
|
2514 | if not shell.colors_force and not shell.has_readline: | |
2514 | new_scheme = 'NoColor' |
|
2515 | new_scheme = 'NoColor' | |
2515 |
|
2516 | |||
2516 | # Set prompt colors |
|
2517 | # Set prompt colors |
@@ -84,13 +84,8 b' class ZMQInteractiveShell(InteractiveShell):' | |||||
84 | # Override the traitlet in the parent class, because there's no point using |
|
84 | # Override the traitlet in the parent class, because there's no point using | |
85 | # readline for the kernel. Can be removed when the readline code is moved |
|
85 | # readline for the kernel. Can be removed when the readline code is moved | |
86 | # to the terminal frontend. |
|
86 | # to the terminal frontend. | |
87 |
|
87 | colors_force = CBool(True) | ||
88 | # FIXME. This is disabled for now, even though it may cause problems under |
|
88 | readline_use = CBool(False) | |
89 | # Windows, because it breaks %run in the Qt console. See gh-617 for more |
|
|||
90 | # details. Re-enable once we've fully tested that %run works in the Qt |
|
|||
91 | # console with syntax highlighting in tracebacks. |
|
|||
92 | # readline_use = CBool(False) |
|
|||
93 | # /FIXME |
|
|||
94 |
|
89 | |||
95 | exiter = Instance(ZMQExitAutocall) |
|
90 | exiter = Instance(ZMQExitAutocall) | |
96 | def _exiter_default(self): |
|
91 | def _exiter_default(self): |
General Comments 0
You need to be logged in to leave comments.
Login now