summaryrefslogtreecommitdiff
path: root/qutebrowser/mainwindow
diff options
context:
space:
mode:
authorJason Rosenzweig <mail4jasonr@gmail.com>2021-06-05 13:56:21 +0800
committerJason Rosenzweig <mail4jasonr@gmail.com>2021-06-05 13:56:21 +0800
commitd638e14b49b3b193202d5576cd0c4d848e178232 (patch)
tree1616921adfffa268d0c77c78effd1b417437173f /qutebrowser/mainwindow
parentc39cb14c62883dbee43e06b1a6316536dd919cdb (diff)
downloadqutebrowser-d638e14b49b3b193202d5576cd0c4d848e178232.tar.gz
qutebrowser-d638e14b49b3b193202d5576cd0c4d848e178232.zip
Removed redundant if statement
Diffstat (limited to 'qutebrowser/mainwindow')
-rw-r--r--qutebrowser/mainwindow/prompt.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/qutebrowser/mainwindow/prompt.py b/qutebrowser/mainwindow/prompt.py
index b096f2da7..affe53dde 100644
--- a/qutebrowser/mainwindow/prompt.py
+++ b/qutebrowser/mainwindow/prompt.py
@@ -24,8 +24,8 @@ import html
import collections
import functools
import dataclasses
-from typing import Deque, Dict, List, MutableSequence, Optional, cast
+from typing import Deque, MutableSequence, Optional, cast
from PyQt5.QtCore import (pyqtSlot, pyqtSignal, Qt, QTimer, QDir, QModelIndex,
QItemSelectionModel, QObject, QEventLoop)
from PyQt5.QtWidgets import (QWidget, QGridLayout, QVBoxLayout, QLineEdit,
@@ -631,14 +631,13 @@ class FilenamePrompt(_BasePrompt):
self._to_complete = ''
self._root_index = QModelIndex()
- def _directories_hide_show_model(self, path):
+ def _directories_hide_show_model(self):
"""Get rid of non-matching directories."""
num_rows = self._file_model.rowCount(self._root_index)
for row in range(num_rows):
index = self._file_model.index(row, 0, self._root_index)
- hidden = self._to_complete not in index.data()
- if index.data() == '..':
- hidden = False
+ filename = index.data()
+ hidden = self._to_complete not in filename and filename != '..'
self._file_view.setRowHidden(index.row(), index.parent(), hidden)
@pyqtSlot(str)
@@ -675,7 +674,7 @@ class FilenamePrompt(_BasePrompt):
self._root_index = self._file_model.setRootPath(path)
self._file_view.setRootIndex(self._root_index)
- self._directories_hide_show_model(path)
+ self._directories_hide_show_model()
@pyqtSlot(QModelIndex)
def _insert_path(self, index, *, clicked=True):