commit 706d605f91fc108d2007fb84950bab41417c56b9
parent 9d54afa04f4b247a0f700ad750d78d1cb5445014
Author: ThomasV <thomasv@gitorious>
Date: Thu, 23 Apr 2015 15:24:12 +0200
recursive generator for tree leaves
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gui/qt/util.py b/gui/qt/util.py
@@ -330,11 +330,17 @@ class MyTreeWidget(QTreeWidget):
self.parent.update_history_tab()
self.parent.update_completions()
- def filter(self, p, column):
- root = self.invisibleRootItem()
+ def get_leaves(self, root):
child_count = root.childCount()
+ if child_count == 0:
+ yield root
for i in range(child_count):
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)