Skip to content

Commit

Permalink
Merge from 5.x: PR #16184
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Aug 9, 2021
2 parents e9cb034 + 20ef981 commit 20b596c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
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

0 comments on commit 20b596c

Please sign in to comment.