Christian Robottom Reis <[EMAIL PROTECTED]> writes:

> On Tue, Jul 20, 2004 at 01:47:11PM -0500, Doug Quale wrote:
> > Of course this is an issue that really needs better support at the
> > gtk+ level.  Tree views actually have quite a bit of state that we
> > would like to persist: expanded/collapsed node state, visible columns,
> > column order, sorting order and column widths.  I think this will
> > require gtk+ API additions because I don't think there's any way to
> > reset column widths to saved values.
> 
> Doesn't Treeview have the equivalent of CList's set_column_width? I'm
> seeing here a TreeViewColumn.set_fixed_width() method that seems to do
> what would be necessary. And there's set_min_width, which is perhaps
> less radical.

I think I was wrong about this.  The set_min_width() method doesn't
really help since the treeview will still grow the column based on
model data, but set_fixed_width() will work if you make the treeview
column sizing TREE_VIEW_COLUMN_FIXED.  The user can still resize the
column and you can set the initial column width yourself.

> I think all the API is in-place; what seems to be necessary is a
> cross-platform (cross-language?) mechanism to persist user preferences.
> Maybe PyGTK should just go ahead and grow one <wink>.

Pygtk provides a great opportunity to experiment with an interface.
Probably what we want is a function to serialize the treeview state to
an XML string to be saved and another function to load the saved state
string and set the treeview properties.  Some flags would be required
to tell what parts of the state are wanted.  In many applications
expanded/collapsed node state could be quite large and not
interesting.

Since my column sizing concerns seem to be a non-issue, now I think
getting the sort info is hard.  It might require connecting to column
header 'clicked' signals and tracking the state by hand.  Of course I hope I'm wrong 
about this too.

Maybe someone has already worked on this and has some code to share?
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to