Hi
I have GUI application with gtk.Treeview component. It's model is set to gtk.Treestore, which I fill with a hierarchical structure. Everything is working fine - the treeview is what I expect it to be.
Now I'd like to filter the leaf nodes to contain only a given string. I tried creating model filter like this:
self.modelfilter = treestore.filter_new()
self.modelfilter.set_visible_func(self.visible_cb, self.txt)
and define filtering function like the one below (self.txt is the text i'm filtering):
def visible_cb(self, model, iter, data):
return self.txt.lower() in model.get_value(iter, 0).lower()
Unfortunately this approach is not a good one because filtering is done on all nodes, and not only leafs.
Is there an elegant solution for this problem in GTK?