Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed the IPython completion option from a checkbox to a combobox #2237

Merged
merged 3 commits into from
May 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions spyderlib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def is_ubuntu():
'font/italic': False,
'font/bold': False,
'show_banner': True,
'use_gui_completion': True,
'completion_type': 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that you're removing an option, you need to bump CONF_VERSION below.

See the comment above it to learn how to that :-)

'use_pager': False,
'show_calltips': True,
'ask_before_closing': True,
Expand Down Expand Up @@ -715,7 +715,7 @@ def is_ubuntu():
# 2. If you want to *remove* options that are no longer needed in our codebase,
# you need to do a MAJOR update in version, e.g. from 3.0.0 to 4.0.0
# 3. You don't need to touch this value if you're just adding a new option
CONF_VERSION = '16.1.0'
CONF_VERSION = '17.0.0'

# XXX: Previously we had load=(not DEV) here but DEV was set to *False*.
# Check if it *really* needs to be updated or not
Expand Down
20 changes: 13 additions & 7 deletions spyderlib/plugins/ipythonconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ def setup_page(self):
banner_box = newcb(_("Display initial banner"), 'show_banner',
tip=_("This option lets you hide the message shown at\n"
"the top of the console when it's opened."))
gui_comp_box = newcb(_("Use a completion widget"),
'use_gui_completion',
tip=_("Use a widget instead of plain text "
"output for tab completion"))
pager_box = newcb(_("Use a pager to display additional text inside "
"the console"), 'use_pager',
tip=_("Useful if you don't want to fill the "
Expand All @@ -177,12 +173,22 @@ def setup_page(self):

interface_layout = QVBoxLayout()
interface_layout.addWidget(banner_box)
interface_layout.addWidget(gui_comp_box)
interface_layout.addWidget(pager_box)
interface_layout.addWidget(calltips_box)
interface_layout.addWidget(ask_box)
interface_group.setLayout(interface_layout)

comp_group = QGroupBox(_("Completion Type"))
comp_label = QLabel(_("Decide what type of completion to use"))
comp_label.setWordWrap(True)
completers = [("Graphical", 0), ("Terminal", 1), ("Plain", 2)]
comp_box = self.create_combobox(_("Completion:")+" ", completers,
'completion_type', default=0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the default value. This is deprecated and it's going to be removed in 3.0.

Sorry I forgot to tell you before :-)

comp_layout = QVBoxLayout()
comp_layout.addWidget(comp_label)
comp_layout.addWidget(comp_box)
comp_group.setLayout(comp_layout)

# Background Color Group
bg_group = QGroupBox(_("Background color"))
light_radio = self.create_radiobutton(_("Light background"),
Expand Down Expand Up @@ -435,8 +441,8 @@ def setup_page(self):

# --- Tabs organization ---
tabs = QTabWidget()
tabs.addTab(self.create_tab(font_group, interface_group, bg_group,
source_code_group), _("Display"))
tabs.addTab(self.create_tab(font_group, interface_group, comp_group,
bg_group, source_code_group), _("Display"))
tabs.addTab(self.create_tab(pylab_group, backend_group, inline_group),
_("Graphics"))
tabs.addTab(self.create_tab(run_lines_group, run_file_group),
Expand Down
6 changes: 3 additions & 3 deletions spyderlib/widgets/ipython.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,9 @@ def shellwidget_config(self):
spy_cfg.IPythonWidget.kind = 'rich'

# Gui completion widget
gui_comp_o = self.get_option('use_gui_completion')
completions = {True: 'droplist', False: 'ncurses'}
spy_cfg.IPythonWidget.gui_completion = completions[gui_comp_o]
completion_type_o = CONF.get('ipython_console', 'completion_type')
completions = {0: "droplist", 1: "ncurses", 2: "plain"}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that these values remain the same as IPython ends up validating them against an Enum traitlet so the renaming only happens at the spyder/combobox level.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's no problem here because this is done internally. The problem is in the GUI, that's why I added my comment above :-)

spy_cfg.IPythonWidget.gui_completion = completions[completion_type_o]

# Pager
pager_o = self.get_option('use_pager')
Expand Down