##// END OF EJS Templates
Fix ConsoleWidget unsetting execution flag when using raw_input.
epatters -
Show More
@@ -65,13 +65,16 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
65 """
65 """
66 )
66 )
67 gui_completion = Bool(False, config=True,
67 gui_completion = Bool(False, config=True,
68 help="Use a list widget instead of plain text output for tab completion."
68 help="""
69 Use a list widget instead of plain text output for tab completion.
70 """
69 )
71 )
70 # NOTE: this value can only be specified during initialization.
72 # NOTE: this value can only be specified during initialization.
71 kind = Enum(['plain', 'rich'], default_value='plain', config=True,
73 kind = Enum(['plain', 'rich'], default_value='plain', config=True,
72 help="""
74 help="""
73 The type of underlying text widget to use. Valid values are 'plain', which
75 The type of underlying text widget to use. Valid values are 'plain',
74 specifies a QPlainTextEdit, and 'rich', which specifies a QTextEdit.
76 which specifies a QPlainTextEdit, and 'rich', which specifies a
77 QTextEdit.
75 """
78 """
76 )
79 )
77 # NOTE: this value can only be specified during initialization.
80 # NOTE: this value can only be specified during initialization.
@@ -84,7 +87,8 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
84 'hsplit' : When paging is requested, the widget is split
87 'hsplit' : When paging is requested, the widget is split
85 horizontally. The top pane contains the console, and the
88 horizontally. The top pane contains the console, and the
86 bottom pane contains the paged text.
89 bottom pane contains the paged text.
87 'vsplit' : Similar to 'hsplit', except that a vertical splitter used.
90 'vsplit' : Similar to 'hsplit', except that a vertical splitter
91 used.
88 'custom' : No action is taken by the widget beyond emitting a
92 'custom' : No action is taken by the widget beyond emitting a
89 'custom_page_requested(str)' signal.
93 'custom_page_requested(str)' signal.
90 'none' : The text is written directly to the console.
94 'none' : The text is written directly to the console.
@@ -508,7 +512,7 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
508 """
512 """
509 self._html_exporter.export()
513 self._html_exporter.export()
510
514
511 def _get_input_buffer(self):
515 def _get_input_buffer(self, force=False):
512 """ The text that the user has entered entered at the current prompt.
516 """ The text that the user has entered entered at the current prompt.
513
517
514 If the console is currently executing, the text that is executing will
518 If the console is currently executing, the text that is executing will
@@ -516,7 +520,7 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
516 """
520 """
517 # If we're executing, the input buffer may not even exist anymore due to
521 # If we're executing, the input buffer may not even exist anymore due to
518 # the limit imposed by 'buffer_size'. Therefore, we store it.
522 # the limit imposed by 'buffer_size'. Therefore, we store it.
519 if self._executing:
523 if self._executing and not force:
520 return self._input_buffer_executing
524 return self._input_buffer_executing
521
525
522 cursor = self._get_end_cursor()
526 cursor = self._get_end_cursor()
@@ -1628,7 +1632,8 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
1628 self._control.setReadOnly(False)
1632 self._control.setReadOnly(False)
1629 self._control.setAttribute(QtCore.Qt.WA_InputMethodEnabled, True)
1633 self._control.setAttribute(QtCore.Qt.WA_InputMethodEnabled, True)
1630
1634
1631 self._executing = False
1635 if not self._reading:
1636 self._executing = False
1632 self._prompt_started_hook()
1637 self._prompt_started_hook()
1633
1638
1634 # If the input buffer has changed while executing, load it.
1639 # If the input buffer has changed while executing, load it.
@@ -1671,11 +1676,11 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
1671 self._reading_callback = None
1676 self._reading_callback = None
1672 while self._reading:
1677 while self._reading:
1673 QtCore.QCoreApplication.processEvents()
1678 QtCore.QCoreApplication.processEvents()
1674 return self.input_buffer.rstrip('\n')
1679 return self._get_input_buffer(force=True).rstrip('\n')
1675
1680
1676 else:
1681 else:
1677 self._reading_callback = lambda: \
1682 self._reading_callback = lambda: \
1678 callback(self.input_buffer.rstrip('\n'))
1683 callback(self._get_input_buffer(force=True).rstrip('\n'))
1679
1684
1680 def _set_continuation_prompt(self, prompt, html=False):
1685 def _set_continuation_prompt(self, prompt, html=False):
1681 """ Sets the continuation prompt.
1686 """ Sets the continuation prompt.
General Comments 0
You need to be logged in to leave comments. Login now