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?

> >    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.

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?

-- 
 
 |\ |       |HomePage   : http://nem01.altervista.org
 | \|emesis |XPN (my nr): http://xpn.altervista.org
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to