##// END OF EJS Templates
Changed the default completion style to text. Text completion now uses the pager.
epatters -
Show More
@@ -58,7 +58,7 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
58 buffer_size = Int(500, config=True)
58 buffer_size = Int(500, config=True)
59
59
60 # Whether to use a list widget or plain text output for tab completion.
60 # Whether to use a list widget or plain text output for tab completion.
61 gui_completion = Bool(True, config=True)
61 gui_completion = Bool(False, config=True)
62
62
63 # The type of underlying text widget to use. Valid values are 'plain', which
63 # The type of underlying text widget to use. Valid values are 'plain', which
64 # specifies a QPlainTextEdit, and 'rich', which specifies a QTextEdit.
64 # specifies a QPlainTextEdit, and 'rich', which specifies a QTextEdit.
@@ -568,8 +568,7 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
568 if self.gui_completion:
568 if self.gui_completion:
569 self._completion_widget.show_items(cursor, items)
569 self._completion_widget.show_items(cursor, items)
570 else:
570 else:
571 text = self._format_as_columns(items)
571 self._page(self._format_as_columns(items))
572 self._append_plain_text_keeping_prompt(text)
573
572
574 def _control_key_down(self, modifiers):
573 def _control_key_down(self, modifiers):
575 """ Given a KeyboardModifiers flags object, return whether the Control
574 """ Given a KeyboardModifiers flags object, return whether the Control
@@ -1160,9 +1159,7 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
1160 """ Displays text using the pager if it exceeds the height of the
1159 """ Displays text using the pager if it exceeds the height of the
1161 visible area.
1160 visible area.
1162 """
1161 """
1163 if self.paging == 'none':
1162 if self.paging != 'none':
1164 self._append_plain_text(text)
1165 else:
1166 line_height = QtGui.QFontMetrics(self.font).height()
1163 line_height = QtGui.QFontMetrics(self.font).height()
1167 minlines = self._control.viewport().height() / line_height
1164 minlines = self._control.viewport().height() / line_height
1168 if re.match("(?:[^\n]*\n){%i}" % minlines, text):
1165 if re.match("(?:[^\n]*\n){%i}" % minlines, text):
@@ -1180,8 +1177,11 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
1180 self._page_control.setFocus()
1177 self._page_control.setFocus()
1181 else:
1178 else:
1182 self.layout().setCurrentWidget(self._page_control)
1179 self.layout().setCurrentWidget(self._page_control)
1183 else:
1180 return
1184 self._append_plain_text(text)
1181 if self._executing:
1182 self._append_plain_text(text)
1183 else:
1184 self._append_plain_text_keeping_prompt(text)
1185
1185
1186 def _prompt_started(self):
1186 def _prompt_started(self):
1187 """ Called immediately after a new prompt is displayed.
1187 """ Called immediately after a new prompt is displayed.
@@ -51,8 +51,8 b' def main():'
51 help='set the paging style [default inside]')
51 help='set the paging style [default inside]')
52 wgroup.add_argument('--rich', action='store_true',
52 wgroup.add_argument('--rich', action='store_true',
53 help='enable rich text support')
53 help='enable rich text support')
54 wgroup.add_argument('--tab-simple', action='store_true',
54 wgroup.add_argument('--gui-completion', action='store_true',
55 help='do tab completion ala a Unix terminal')
55 help='use a GUI widget for tab completion')
56
56
57 args = parser.parse_args()
57 args = parser.parse_args()
58
58
@@ -89,7 +89,7 b' def main():'
89 widget = RichIPythonWidget(paging=args.paging)
89 widget = RichIPythonWidget(paging=args.paging)
90 else:
90 else:
91 widget = IPythonWidget(paging=args.paging)
91 widget = IPythonWidget(paging=args.paging)
92 widget.gui_completion = not args.tab_simple
92 widget.gui_completion = args.gui_completion
93 widget.kernel_manager = kernel_manager
93 widget.kernel_manager = kernel_manager
94 widget.setWindowTitle('Python' if args.pure else 'IPython')
94 widget.setWindowTitle('Python' if args.pure else 'IPython')
95 widget.show()
95 widget.show()
General Comments 0
You need to be logged in to leave comments. Login now