summaryrefslogtreecommitdiff
path: root/tidal_dl_ng
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2024-05-15 09:02:08 +0200
committerRobert Honz <exislow+github@gmail.com>2024-05-15 09:02:08 +0200
commit8fc6298d2878c2e447e8dbfb15b50cb5a250fdd4 (patch)
tree147d8b80da5fcd2948da36ecae03d352766b23be /tidal_dl_ng
parentb257f48d6a91b341580a940263c6c6f1609f893d (diff)
downloadtidal-dl-ng-8fc6298d2878c2e447e8dbfb15b50cb5a250fdd4.tar.gz
✨ Filter are AND and not OR linked.
Diffstat (limited to 'tidal_dl_ng')
-rw-r--r--tidal_dl_ng/helper/gui.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tidal_dl_ng/helper/gui.py b/tidal_dl_ng/helper/gui.py
index 82a44d8..0506491 100644
--- a/tidal_dl_ng/helper/gui.py
+++ b/tidal_dl_ng/helper/gui.py
@@ -177,6 +177,7 @@ class HumanProxyModel(QtCore.QSortFilterProxyModel):
def filterAcceptsRow(self, source_row: int, source_parent: QtCore.QModelIndex) -> bool:
model = self.sourceModel()
source_index = model.index(source_row, 0, source_parent)
+ result: [bool] = []
# Show top level children
for child_row in range(model.rowCount(source_index)):
@@ -189,6 +190,11 @@ class HumanProxyModel(QtCore.QSortFilterProxyModel):
ix = self.sourceModel().index(source_row, i, source_parent)
data = ix.data()
- return bool(text.lower() in str(data).lower())
+ # Append results to list to enable an AND operator for filtering.
+ result.append(bool(text.lower() in str(data).lower()))
- return True
+ # If no filter set, just set the result to True.
+ if not result:
+ result.append(True)
+
+ return all(result)