[pygtk] Why sorting of TreeView ignores the first line?

Neil Muller drnlmuller+gtk at gmail.com
Tue Jan 5 19:17:20 WST 2010


On Sun, Jan 3, 2010 at 6:49 PM, Jiri Bajer <sarimak at seznam.cz> wrote:
>
> What am I doing wrong?

<rest of example snipped>

>        def _compare_data(self,  model, iter1, iter2, column):
>                data1 = model[model.get_path(iter1)][0][column]
>                data2 = model[model.get_path(iter2)][0][column]
>                print data1, data2, cmp(data1, data2)
>                return cmp(data1, data2)

You're assuming that the relationship between paths and iters won't
change until sorting is completed, which is wrong. You should be using
the iter's to access the data here - model.get_value(iter, 0)[column]
should do it.

-- 
Neil Muller
drnlmuller at gmail.com

I've got a gmail account. Why haven't I become cool?


More information about the pygtk mailing list