mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 17:55:20 +00:00
recursive generator for tree leaves
This commit is contained in:
parent
9d54afa04f
commit
706d605f91
1 changed files with 8 additions and 2 deletions
|
@ -330,11 +330,17 @@ class MyTreeWidget(QTreeWidget):
|
||||||
self.parent.update_history_tab()
|
self.parent.update_history_tab()
|
||||||
self.parent.update_completions()
|
self.parent.update_completions()
|
||||||
|
|
||||||
def filter(self, p, column):
|
def get_leaves(self, root):
|
||||||
root = self.invisibleRootItem()
|
|
||||||
child_count = root.childCount()
|
child_count = root.childCount()
|
||||||
|
if child_count == 0:
|
||||||
|
yield root
|
||||||
for i in range(child_count):
|
for i in range(child_count):
|
||||||
item = root.child(i)
|
item = root.child(i)
|
||||||
|
for x in self.get_leaves(item):
|
||||||
|
yield x
|
||||||
|
|
||||||
|
def filter(self, p, column):
|
||||||
|
for item in self.get_leaves(self.invisibleRootItem()):
|
||||||
item.setHidden(unicode(item.text(column)).lower().find(p) == -1)
|
item.setHidden(unicode(item.text(column)).lower().find(p) == -1)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue