GtkTreeModelFilter: get_path function returns None



Hi All,

I have been trying to implement a filter function for a GtkTreeStore and
I run into a problem.

In the below code example when I call 'get_path' on the TreeModelFilter
object it returns None. I would have expected to see a TreePath. Am I
missing something?

Thx
~infirit

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

software_list = [("Firefox", 2002,  "C++"),
                 ("Eclipse", 2004, "Java" ),
                 ("Pitivi", 2004, "Python")]

def list_filter_func(model, titer, data):
    return True

model = Gtk.ListStore(str, int, str)
list_filter = model.filter_new()
list_filter.set_visible_func(list_filter_func)

view = Gtk.TreeView.new()
view.set_model(list_filter)

all_iters = []

for software_ref in software_list:
    titer = model.append(list(software_ref))
    all_iters.append(titer)

for i, column_title in enumerate(["Software", "Release Year",
"Programming Language"]):
    renderer = Gtk.CellRendererText()
    column = Gtk.TreeViewColumn(column_title, renderer, text=i)

print("I expect to see a TreePath not None")
print(view.get_model().get_path(all_iters[1]))
print("Only when I go down to the GtkTreeStore it works")
print(view.get_model().get_model().get_path(all_iters[1]))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]