Skip to content

Commit

Permalink
Apply code formatting suggestions from review
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Cordoba <[email protected]>
  • Loading branch information
rear1019 and ccordoba12 committed Jun 16, 2023
1 parent 004dd60 commit 44be806
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions spyder/app/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,6 @@ def main_window(request, tmpdir, qtbot):
# Set exclamation mark to True
CONF.set('ipython_console', 'pdb_use_exclamation_mark', True)

CONF.set('editor', 'show_class_func_dropdown', True)

# Check if we need to use introspection in a given test
# (it's faster and less memory consuming not to use it!)
use_introspection = request.node.get_closest_marker('use_introspection')
Expand Down Expand Up @@ -330,8 +328,10 @@ def main_window(request, tmpdir, qtbot):
preload_complex_project = request.node.get_closest_marker(
'preload_complex_project')
if preload_complex_project:
CONF.set('editor', 'show_class_func_dropdown', True)
create_complex_project(tmpdir)
else:
CONF.set('editor', 'show_class_func_dropdown', False)
if not preload_project:
CONF.set('project_explorer', 'current_project_path', None)

Expand Down
15 changes: 9 additions & 6 deletions spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4237,10 +4237,13 @@ def editors_with_info(treewidget):
# one function + two methods + "<None>" entry
assert editor_2.classfuncdropdown.method_cb.count() == 4
assert editor_1.classfuncdropdown._data == editor_2.classfuncdropdown._data

def get_cb_list(cb):
return [cb.itemText(i) for i in range(cb.count())]
assert get_cb_list(editor_1.classfuncdropdown.class_cb) == get_cb_list(editor_2.classfuncdropdown.class_cb)
assert get_cb_list(editor_1.classfuncdropdown.method_cb) == get_cb_list(editor_2.classfuncdropdown.method_cb)
assert get_cb_list(editor_1.classfuncdropdown.class_cb) == \
get_cb_list(editor_2.classfuncdropdown.class_cb)
assert get_cb_list(editor_1.classfuncdropdown.method_cb) == \
get_cb_list(editor_2.classfuncdropdown.method_cb)

# Check that class/function selector of cloned editor is updated
with qtbot.waitSignal(editor_2.oe_proxy.sig_outline_explorer_data_changed,
Expand All @@ -4252,10 +4255,10 @@ def get_cb_list(cb):
# one function + "<None>" entry
assert editor_2.classfuncdropdown.method_cb.count() == 2
assert editor_1.classfuncdropdown._data == editor_2.classfuncdropdown._data
def get_cb_list(cb):
return [cb.itemText(i) for i in range(cb.count())]
assert get_cb_list(editor_1.classfuncdropdown.class_cb) == get_cb_list(editor_2.classfuncdropdown.class_cb)
assert get_cb_list(editor_1.classfuncdropdown.method_cb) == get_cb_list(editor_2.classfuncdropdown.method_cb)
assert get_cb_list(editor_1.classfuncdropdown.class_cb) == \
get_cb_list(editor_2.classfuncdropdown.class_cb)
assert get_cb_list(editor_1.classfuncdropdown.method_cb) == \
get_cb_list(editor_2.classfuncdropdown.method_cb)

# Hide outline from view
outline_explorer.toggle_view_action.setChecked(False)
Expand Down
6 changes: 3 additions & 3 deletions spyder/plugins/editor/widgets/codeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,8 @@ def setup_editor(self,

self.set_strip_mode(strip_mode)

def update_classfuncdropdown(self, symbols):
def _update_classfuncdropdown(self, symbols):
"""Update class/function dropdown."""
symbols = [] if symbols is None else symbols

if self.classfuncdropdown.isVisible():
Expand Down Expand Up @@ -1236,8 +1237,7 @@ def process_symbols(self, params):
"""Handle symbols response."""
try:
symbols = params['params']

self.update_classfuncdropdown(symbols)
self._update_classfuncdropdown(symbols)

if self.oe_proxy is not None:
self.oe_proxy.update_outline_info(symbols)
Expand Down
2 changes: 1 addition & 1 deletion spyder/plugins/editor/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2674,7 +2674,7 @@ def perform_completion_request(lang, method, params):
cloned_from.oe_proxy.sig_outline_explorer_data_changed.connect(
editor.oe_proxy.update_outline_info)
cloned_from.oe_proxy.sig_outline_explorer_data_changed.connect(
editor.update_classfuncdropdown)
editor._update_classfuncdropdown)
cloned_from.oe_proxy.sig_start_outline_spinner.connect(
editor.oe_proxy.emit_request_in_progress)

Expand Down

0 comments on commit 44be806

Please sign in to comment.