pygtk: invalid treeview iter

250 views Asked by At

I have a somewhat complicated set-up for a treeview. This is how the view is set up:

        self.hsModel = gtk.TreeStore(*[c[0] for c in columns])
        self.hsModelFilter = self.hsModel.filter_new()
        self.hsModelSort = gtk.TreeModelSort(self.hsModelFilter)
        self.hsSelect = gtk.TreeView(self.hsModelSort)

That is, I have a model, then I filter it, then I sort it, then the view displays the sorted model. In a function, I append something to the base model:

iter = self.hsModel.append(None, row)

Then I attempt to select what I just added from the tree view (hsSelect):

            fiter = self.hsModelFilter.convert_child_iter_to_iter(iter)
            siter = self.hsModelSort.convert_child_iter_to_iter(None, fiter)
            self.hsSelect.get_selection().select_iter(siter)

However, this sometimes gives an error. I can't reproduce it now, but it says the iter's stamp doesn't match the tree model's stamp. Any idea what I'm doing incorrectly?

0

There are 0 answers