Skip to content

Commit

Permalink
✨ Filter are AND and not OR linked.
Browse files Browse the repository at this point in the history
  • Loading branch information
exislow committed May 15, 2024
1 parent b257f48 commit 8fc6298
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tidal_dl_ng/helper/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def filters(self, filters):
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)):
Expand All @@ -189,6 +190,11 @@ def filterAcceptsRow(self, source_row: int, source_parent: QtCore.QModelIndex) -
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)

0 comments on commit 8fc6298

Please sign in to comment.