Using TreeModelFilter with a "modify" function



Hi,

I'm trying to use the Gtk.TreeModelFilter and its "modify" function and
I'm struggling trying to make a simple example. (using PyGObject 3.10.2)

I've got something along this at the moment:


    def modify_func(model, iter, value, column, user_data):
        print(model, iter, value, column, user_data)

    store = Gtk.ListStore(SomeObject)
    model = Gtk.TreeModelFilter(child_model=store)
    model.set_modify_func((int, str, str), modify_func)

I made on top of this and here is what I got printed when the view tries
to access the model:

    (<TreeModelFilter object at 0xb5db5e3c (GtkTreeModelFilter at 0xa53e470)>, <GtkTreeIter at 0xa62ba60>, 0, 
0, None)
    (<TreeModelFilter object at 0xb5db5e3c (GtkTreeModelFilter at 0xa53e470)>, <GtkTreeIter at 0xa62c180>, 
None, 1, None)
    etc...

I suspected "value" wasn't needed, but Gtk complains otherwise. So I
though it would be a GValue which I would have to set, but it's actually
a plain Python integer. Returning something from this function doesn't
help either (ie. it doesn't do anything).

So, how am I supposed to work with set_modify_func()?

Thanks,

 Jonathan


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