[pygtk] Treeview/model: Problems with Expanding and Selecting Rows

John Finlay finlay at moeraki.com
Tue Jan 27 17:42:28 WST 2009


darethehair wrote:
> Hello Folks!
>
> The PyGTK tutorial example named 'basictreeview.py' works fine for me.
> When I click on the 'expander' arrow for a row, it instantly expands to
> show the child rows under it.
>
> In my case, I am using a 'lazy treeview' to only populate the child rows
> as I need to do so -- mostly because of time, but also because I want to
> allow unlimited 'nesting'.  My problem is two-fold:
>
> 1) When I use a 'row-expanded' signal detector, I have to click two or
> three times on the 'expander' arrow in order for the child rows to
> actually show up.  In fact, out of desperation I have even added the
> following to my routine to 'force' the issue:
>
>                 self.treeview.expand_to_path(path)
>                 self.treeview.expand_row(path, True)
>
> 2) When I add a selection 'changed' signal, it works, but it 'gets in
> the way' of my 'row-expanded' detector i.e. even if I am very careful to
> click just the 'expand arrow' on a row, it triggers my 'changed'
> selection routine the first time I touch a row.
>
> I would appreciate any tips to produce the desired behavior! :)
>   
Connect to the "test-expand-row" signal and add the rows in the 
callback. You have to put a dummy child row to get the expander to show 
and replace it with the real children in the callback.

John


More information about the pygtk mailing list