[pygtk] CList (continued)
Jamey Cribbs
cribbsj at oakwood.org
Fri Sep 17 00:25:00 WST 2004
Thanks for all the responses on my CList question. I thought I would
respond to all of your questions/advice in one email rather than reply
to a bunch of different emails.
Here's a update with where I am currently:
Using the TreeModelSort and Liststore, I have been able to get the speed
of sorting and refreshing (i.e. clearing out the Liststore, grabbing all
data from database, adding records back in to empty liststore,
reapplying current sort criteria) pretty close to what the CList was
doing (at least on a small dataset, approx. 600 records; haven't tried
anything bigger yet).
I think I have almost everything working the way I want, except for one
thing. When I do a refresh (see above for definition), in my refresh
method, after I clear out the liststore and then add back the records, I
call set_cursor on the treeview to make the treeview jump to the record
that was selected before the user clicked the "Refresh" button. This
works fine.
What doesn't work is similar functionality for when the user clicks on a
column header to change the sort. For example, let's say the treeview
is currently sorted on the first column in ascending order, a row has
been selected (i.e. it has the blue background) and it is visible inside
the scrollview. Now, I click on the second column header to sort the
treeview on that column. The treeview sorts on the second column just
fine. The same row stays selected, BUT the treeview does not scroll to
make that selected row visible. That's my problem.
I have tried doing:
self.treemodelsort .connect_after('sort-column-changed',
self.afterSortColChanged)
and in the afterSortColChanged method I do a
self.treeview.set_cursor(self.tms.convert_child_path_to_path(self.store.get_path(focusRowIter)))
where focusRowIter is the iter of the lisstore that was the selected row
before the sort was done. But it doesn't help. Why does it work after
I clear out all the records and re-add them, but doesn't work after the
treeview is sorted? What am I doing wrong?
I feel like I am getting pretty close to duplicating the functionality
that I used with the CList. Thanks again for all of the help.
Jamey
Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure or distribution of this email and any materials contained in any attachments is prohibited. If you receive this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments.
More information about the pygtk
mailing list