[pygtk] Howto set the length of GenericTreeModel

Don Allingham dallingham at users.sourceforge.net
Wed Jan 25 20:58:33 WST 2006


Is there at least a way the on_get_value() call can know if the row and
column passed are visible? If so, we can avoid a database access and
return an empty string for rows that are not visible.

Don

On Wed, 2006-01-25 at 11:03 +0000, Gustavo J. A. M. Carneiro wrote:
> On Wed, 2006-01-25 at 09:47 +0000, Richard Taylor wrote:
> > Never mind. I read the source to gtktreeview.c and I now see that there is 
> > nothing I can do about the calls to on_iter_next(iter). I looks like the 
> > treeview is determined to know which rows have children even before it has to 
> > display the row. 
> 
>   I think you should open a bug report, against gtk+.  It seems to me
> GtkTreeView could use some optimisation to use iter_n_children to
> determine the number of rows:
>   
>   gint         (* iter_n_children) (GtkTreeModel *tree_model,
> 				    GtkTreeIter  *iter);
> 
>   In conjunction with gtk.CellRendererText.set_fixed_height_from_font
> and set_fixed_width (like you mentioned), GtkTreeView ought to be able
> to call iter_n_children once and then just iter over the rows that are
> visible.  If it doesn't, it "should".
> 
>   Regards,

-- 
Don Allingham
GRAMPS - Open Source Genealogy
http://www.gramps-project.org



More information about the pygtk mailing list