Skip to content
Browse files
[processing] When searching in toolbox, ignore order of words
Eg, allows you to search "line merge" and find the "Merge lines"
algorithm. Should make it easier for users who don't know the
exact name to find algorithms.
  • Loading branch information
nyalldawson committed Nov 7, 2016
1 parent 35a29d8 commit 1a4f8f59f1b26fc88e0686b51646723a4243f9ba
Showing 1 changed file with 9 additions and 4 deletions.
@@ -108,7 +108,7 @@ def textChanged(self):
text = self.searchBox.text().strip(' ').lower()
for item in list(self.disabledProviderItems.values()):
self._filterItem(self.algorithmTree.invisibleRootItem(), text)
self._filterItem(self.algorithmTree.invisibleRootItem(), [t for t in text.split(' ') if t])
if text:
self.disabledWithMatchingAlgs = []
@@ -137,10 +137,15 @@ def _filterItem(self, item, text):
item.setHidden(not show)
return show
elif isinstance(item, (TreeAlgorithmItem, TreeActionItem)):
# hide = bool(text) and (text not in item.text(0).lower())
hide = bool(text) and not any(text in t for t in [item.text(0).lower(),, Qt.UserRole).lower()])
# hide if every part of text is not contained somewhere in either the item text or item user role
item_text = [item.text(0).lower(),, Qt.UserRole).lower()]
if isinstance(item, TreeAlgorithmItem):
hide = hide and (text not in item.alg.commandLineName())

hide = bool(text) and not all(
any(part in t for t in item_text)
for part in text)

return not hide

0 comments on commit 1a4f8f5

Please sign in to comment.