From e45a7743600767eeeeb344e4441daa5356c46702 2013-07-29 23:02:31 From: Min RK Date: 2013-07-29 23:02:31 Subject: [PATCH] Merge pull request #3814 from minrk/no-complete add `ConsoleWidget.execute_on_complete_input` flag disables input-parsing in the QtConsole, which is inappropriate for non-Python kernels. Disabling execute_on_complete_input requires shift-enter to execute, just like the Notebook. Not sure if we want this for 1.0 or not. It's pretty trivial, but it is technically a new feature. --- diff --git a/IPython/qt/console/console_widget.py b/IPython/qt/console/console_widget.py index 46877ac..be0abc9 100644 --- a/IPython/qt/console/console_widget.py +++ b/IPython/qt/console/console_widget.py @@ -95,13 +95,21 @@ class ConsoleWidget(LoggingConfigurable, QtGui.QWidget): non-positive number disables text truncation (not recommended). """ ) + execute_on_complete_input = Bool(True, config=True, + help="""Whether to automatically execute on syntactically complete input. + + If False, Shift-Enter is required to submit each execution. + Disabling this is mainly useful for non-Python kernels, + where the completion check would be wrong. + """ + ) gui_completion = Enum(['plain', 'droplist', 'ncurses'], config=True, default_value = 'ncurses', help=""" The type of completer to use. Valid values are: - 'plain' : Show the availlable completion as a text list - Below the editting area. + 'plain' : Show the available completion as a text list + Below the editing area. 'droplist': Show the completion in a drop down list navigable by the arrow keys, and from which you can select completion by pressing Return. @@ -615,9 +623,12 @@ class ConsoleWidget(LoggingConfigurable, QtGui.QWidget): self.input_buffer = source # Execute the source or show a continuation prompt if it is incomplete. - complete = self._is_complete(source, interactive) + if self.execute_on_complete_input: + complete = self._is_complete(source, interactive) + else: + complete = not interactive if hidden: - if complete: + if complete or not self.execute_on_complete_input: self._execute(source, hidden) else: error = 'Incomplete noninteractive input: "%s"'