Re: GtkTreeModelFilter and GtkTreeSortable



On Sat, Sep 29, 2007 at 01:14:56PM -0300, Mat??as Alejandro Torres wrote:
Thank you both for your reply.

I'm working on python, and I can't find functions to add the sortable 
functions to an instance of a GtkTreeModel.

/* This one receives the model and update the GUI */
def set_model (self, model):
        if model:
            self.filter = model.filter_new ()
            self.filter.set_visible_func (self.patient_filter_callback)
            self.patientsBox.tree_view.set_model (self.filter)
            self.unblock_signals ()
            self.patient_selected_callback ()
            self.patientsBox.set_sensitive (True)

You want to wrap the GtkTreeModelFilter you create here in a
GtkTreeModelSort.  See the API documentation here:

  http://pygtk.org/docs/pygtk/class-gtktreemodelsort.html

To the constructor of gtk.TreeModelSort you want to pass in self.filter
as child model.  Then set the resulting "sort model" as model to show in
the tree view.


regards,

-kris.



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