summaryrefslogtreecommitdiff
path: root/qutebrowser/mainwindow
diff options
context:
space:
mode:
authorJason Rosenzweig <mail4jasonr@gmail.com>2021-06-03 23:01:58 +0800
committerJason Rosenzweig <mail4jasonr@gmail.com>2021-06-03 23:01:58 +0800
commitc72e53417d4cb7538f92da7a64c93f2975a8aca5 (patch)
treed757e3dd1f4d04bd3c24183c0169a478ef7f12b2 /qutebrowser/mainwindow
parent3c9a1a059c31549ad6c60ef8ecd7e97d2ae82795 (diff)
downloadqutebrowser-c72e53417d4cb7538f92da7a64c93f2975a8aca5.tar.gz
qutebrowser-c72e53417d4cb7538f92da7a64c93f2975a8aca5.zip
Fixed formatting for linter
Diffstat (limited to 'qutebrowser/mainwindow')
-rw-r--r--qutebrowser/mainwindow/prompt.py36
1 files changed, 21 insertions, 15 deletions
diff --git a/qutebrowser/mainwindow/prompt.py b/qutebrowser/mainwindow/prompt.py
index 231a7d009..453c45953 100644
--- a/qutebrowser/mainwindow/prompt.py
+++ b/qutebrowser/mainwindow/prompt.py
@@ -630,6 +630,24 @@ class FilenamePrompt(_BasePrompt):
self._to_complete = ''
+ def _directories_hide_show_model(self, path):
+ """Iterate over all directories in the current root path
+ to see if the input is a substring"""
+ try:
+ for current_dir in os.listdir(path):
+ current_dir = os.path.join(path, current_dir)
+
+ if self._to_complete not in os.path.basename(current_dir):
+ index = self._file_model.index(current_dir)
+ self._file_view.setRowHidden(index.row(), index.parent(), True)
+ else:
+ index = self._file_model.index(current_dir)
+ self._file_view.setRowHidden(index.row(), index.parent(), False)
+ except FileNotFoundError:
+ log.prompt.exception("Directory doesn't exist, can't \
+ hide and unhide file prompt folders")
+
+
@pyqtSlot(str)
def _set_fileview_root(self, path, *, tabbed=False):
"""Set the root path for the file display."""
@@ -663,21 +681,9 @@ class FilenamePrompt(_BasePrompt):
root = self._file_model.setRootPath(path)
self._file_view.setRootIndex(root)
- try:
- # Iterate over all directories in the current root path to see if the input is a substring
- for currentDir in os.listdir(path):
- currentDir = os.path.join(path, currentDir)
-
- if basename not in os.path.basename(currentDir):
- index = self._file_model.index(currentDir)
- self._file_view.setRowHidden(index.row(), index.parent(), True)
- else:
- index = self._file_model.index(currentDir)
- self._file_view.setRowHidden(index.row(), index.parent(), False)
-
- self._file_view.setModel(self._file_model)
- except FileNotFoundError:
- log.prompt.exception("Directory doesn't exist, can't hide and unhide file prompt folders")
+
+ self._directories_hide_show_model(path)
+ self._file_view.setModel(self._file_model)
@pyqtSlot(QModelIndex)
def _insert_path(self, index, *, clicked=True):