Re: [pygtk] TreeView (liststore) sorting.
I have now something like that: view['listmodel'].set_sort_column_id(5,gtk.SORT_DESCENDING) view['listmodel'].set_sort_func(5,compare_data, 5) view['listmodel'].set_sort_func(0,compare_data, 0) ... def compare_data(model, iter1, iter2, column): data1 = model.get_value(iter1,column) data2 = model.get_value(iter2,column) print data1, data2, cmp(data1, data2) return cmp(data1, data2) but it sorts only by column 5. tried also view['listmodel'].set_sort_func(5,compare_data, 0) but it doesn't work... ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] TreeView (liststore) sorting.
> > > > http://www.pygtk.org/docs/pygtk/class-gtktreesortable.html#method-gtktreesortable--set-sort-func > > I strongly suggest using devhelp and taking a look at the page of the > classes you happen to use: even by a fast glance, you can learn many > things. And I'm always doing it but this time... i have no idea how too use it. An example would be great ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] TreeView (liststore) sorting.
Il giorno mar, 02/02/2010 alle 22.59 +0100, middleofdre...@gmail.com ha scritto: > I was looking for this in net but still i have no idea how to set > priority of sorting. For example i'm doing: > somelistmodel.set_sort_column_id(0,gtk.SORT_ASCENDING) and it sort it > right. But when elements in column 0 are the same, a want to sort by > column 1. > How to? > I've tried > somelistmodel.set_sort_column_id(1,gtk.SORT_ASCENDING) > somelistmodel.set_sort_column_id(0,gtk.SORT_ASCENDING), but that > doesn't work. > http://www.pygtk.org/docs/pygtk/class-gtktreesortable.html#method-gtktreesortable--set-sort-func I strongly suggest using devhelp and taking a look at the page of the classes you happen to use: even by a fast glance, you can learn many things. Pietro ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
[pygtk] TreeView (liststore) sorting.
I was looking for this in net but still i have no idea how to set priority of sorting. For example i'm doing: somelistmodel.set_sort_column_id(0,gtk.SORT_ASCENDING) and it sort it right. But when elements in column 0 are the same, a want to sort by column 1. How to? I've tried somelistmodel.set_sort_column_id(1,gtk.SORT_ASCENDING) somelistmodel.set_sort_column_id(0,gtk.SORT_ASCENDING), but that doesn't work. I hope i'm clear enough ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/