From 54d8eecc4f7e33729999b7781e41abac7e6c1710 2013-03-31 09:03:55 From: Thomas Kluyver Date: 2013-03-31 09:03:55 Subject: [PATCH] Fix for starting the Qt console --- diff --git a/IPython/core/inputsplitter.py b/IPython/core/inputsplitter.py index dc57840..5b316a9 100644 --- a/IPython/core/inputsplitter.py +++ b/IPython/core/inputsplitter.py @@ -516,23 +516,31 @@ class IPythonInputSplitter(InputSplitter): self._buffer_raw = [] self._validate = True - self.physical_line_transforms = physical_line_transforms or \ - [leading_indent(), - classic_prompt(), - ipy_prompt(), - ] + if physical_line_transforms is not None: + self.physical_line_transforms = physical_line_transforms + else: + self.physical_line_transforms = [leading_indent(), + classic_prompt(), + ipy_prompt(), + ] self.assemble_logical_lines = assemble_logical_lines() - self.logical_line_transforms = logical_line_transforms or \ - [cellmagic(), - help_end(), - escaped_commands(), - assign_from_magic(), - assign_from_system(), - ] + if logical_line_transforms is not None: + self.logical_line_transforms = logical_line_transforms + else: + self.logical_line_transforms = [cellmagic(), + help_end(), + escaped_commands(), + assign_from_magic(), + assign_from_system(), + ] self.assemble_python_lines = assemble_python_lines() - self.python_line_transforms = python_line_transforms or [] + if python_line_transforms is not None: + self.python_line_transforms = python_line_transforms + else: + # We don't use any of these at present + self.python_line_transforms = [] @property def transforms(self): diff --git a/IPython/frontend/qt/console/frontend_widget.py b/IPython/frontend/qt/console/frontend_widget.py index 2d8e65f..3fe0203 100644 --- a/IPython/frontend/qt/console/frontend_widget.py +++ b/IPython/frontend/qt/console/frontend_widget.py @@ -114,7 +114,10 @@ class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin): exit_requested = QtCore.Signal(object) # Protected class variables. - _prompt_transformer = IPythonInputSplitter(transforms=[classic_prompt()]) + _prompt_transformer = IPythonInputSplitter(physical_line_transforms=[classic_prompt()], + logical_line_transforms=[], + python_line_transforms=[], + ) _CallTipRequest = namedtuple('_CallTipRequest', ['id', 'pos']) _CompletionRequest = namedtuple('_CompletionRequest', ['id', 'pos']) _ExecutionRequest = namedtuple('_ExecutionRequest', ['id', 'kind']) diff --git a/IPython/frontend/qt/console/ipython_widget.py b/IPython/frontend/qt/console/ipython_widget.py index cdc83bb..dfacd93 100644 --- a/IPython/frontend/qt/console/ipython_widget.py +++ b/IPython/frontend/qt/console/ipython_widget.py @@ -98,7 +98,10 @@ class IPythonWidget(FrontendWidget): # FrontendWidget protected class variables. _input_splitter_class = IPythonInputSplitter - _prompt_transformer = IPythonInputSplitter(transforms=[ipy_prompt()]) + _prompt_transformer = IPythonInputSplitter(physical_line_transforms=[ipy_prompt()], + logical_line_transforms=[], + python_line_transforms=[], + ) # IPythonWidget protected class variables. _PromptBlock = namedtuple('_PromptBlock', ['block', 'length', 'number'])