[pygtk] Howto set the length of GenericTreeModel

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Wed Jan 25 19:03:33 WST 2006


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,

-- 
Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic.



More information about the pygtk mailing list