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

PR: Fix double clicks when single-click mode is active #16184

Merged
merged 2 commits into from
Aug 9, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions spyder/plugins/explorer/widgets/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,10 @@ def keyPressEvent(self, event):
QTreeView.keyPressEvent(self, event)

def mouseDoubleClickEvent(self, event):
"""Handle single clicks."""
"""Handle double clicks."""
super().mouseDoubleClickEvent(event)
self.clicked(index=self.indexAt(event.pos()))
if not self.get_conf('single_click_to_open'):
self.clicked(index=self.indexAt(event.pos()))

def mousePressEvent(self, event):
"""
Expand Down
20 changes: 17 additions & 3 deletions spyder/plugins/projects/widgets/projectexplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,26 @@
class ProxyModel(QSortFilterProxyModel):
"""Proxy model to filter tree view."""

DEFAULTS_PATHS_TO_HIDE = [
PATHS_TO_HIDE = [
# Useful paths
'.spyproject',
'__pycache__',
'.ipynb_checkpoints',
# VCS paths
'.git',
'.hg',
'.svn',
# Others
'.pytest_cache',
'.DS_Store',
'Thumbs.db',
'.directory'
]

PATHS_TO_SHOW = [
'.github'
]

def __init__(self, parent):
"""Initialize the proxy model."""
super(ProxyModel, self).__init__(parent)
Expand Down Expand Up @@ -80,8 +91,11 @@ def filterAcceptsRow(self, row, parent_index):
else:
for p in [osp.normcase(p) for p in self.path_list]:
if path == p or path.startswith(p + os.sep):
if any([d in path for d in self.DEFAULTS_PATHS_TO_HIDE]):
return False
if not any([d in path for d in self.PATHS_TO_SHOW]):
if any([d in path for d in self.PATHS_TO_HIDE]):
return False
else:
return True
else:
return True
else:
Expand Down