Nemesis wrote:
On Thu, 24 Nov 2005 09:58:44 -0800
John Finlay <[EMAIL PROTECTED]> wrote:
on_get_iter() must return None if there is no valid TreeIter for the
given path. With an empty list there can be no valid TreeIter.
Possible fix is below.
[...]
def on_get_iter(self, path):
try:
self.list[path[0]]
return path[0]
except IndexError:
return None
I changed the code that way and now it works with the first
"on_iter_nth_child" I wrote. I still have a little doubt, the
references says that the methode on_get_iter should raise a ValueError
exception if the path is not valid. Should I add a "raise ValueError"
before the "return None" line?
You have confused on_get_iter() with TreeModel.get_iter() - two
different things.
def on_get_path(self, rowref):
return tuple(rowref)
I also modified this method in that way:
def on_get_path(self, rowref):
return tuple([rowref])
cause rowref should be a list index, but "tuple" requires an iterable
item.
I suppose you could just return rowref since it's just a list index.
And I left this method unchanged
def on_iter_nth_child(self, parent, n):
if parent:
return None
try:
self.list[n]
except IndexError:
return None
else:
return n
Do you think the code is correct now?
Until you find the next bug. :-)
John
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/