On Fri, 2006-15-12 at 14:52 +, Peter Morgan wrote:
Am going round the houses with this problem (and a pygtk newbie)
I've got the function below load_data() and wish to keep the current col
sort (which works) and the selected row. The number of rows does not change
When I enter the load_data function the iter is there from the first
line. However the last line fails with
GtkWarning: gtk_list_store_get_path: assertion `iter-stamp ==
GTK_LIST_STORE (tree_model)-stamp' failed
Can anyone shed some light on the problem please..
tia
Pete
def load_data(self):
model, iter = self.selection.get_selected()
## This lines shows the 2 objects
print model, iter
prev_col = self.usersListStore.get_sort_column_id()
self.usersListStore.clear()
req = urllib2.Request( self.config['url'] )
response = urllib2.urlopen(req)
page_contents = response.read()
lines = page_contents.splitlines()
for line in lines:
self.usersListStore.append(line.split('\t'))
if prev_col[0] == None:
colo = 1
else:
colo = prev_col[0]
if prev_col[1] == None:
dir = gtk.SORT_ASCENDING
else:
dir = prev_col[1]
self.usersListStore.set_sort_column_id(colo,dir)
self.enable_radio_controls(False)
if iter:
### ERROR GtkWarning: gtk_list_store_get_path: assertion
`iter-stamp == GTK_LIST_STORE (tree_model)-stamp' failed
self.selection.select_iter(iter)
If I'm not mistaken. The iter becomes dead when the model is changed by
an append, etc.. I don't have time to check my facts right now. But It
might shed light on it for you.
I know in our treeview use when we rebuild our data model we look for
the row data that was prevoiusly selected, then after the data is
reloaded we then select that row.
--
Brian [EMAIL PROTECTED]
___
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/