[pygtk] Selecting a treeView row
Peter Morgan
pm at daffodil.uk.com
Fri Dec 15 23:52:39 WST 2006
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)
More information about the pygtk
mailing list