[pygtk] Error with custom list with pygtk2.8.2

John Finlay finlay at moeraki.com
Sun Nov 27 02:52:12 WST 2005


John Finlay wrote:

> Nemesis wrote:
>
>> On Fri, 25 Nov 2005 15:58:59 -0800
>> John Finlay <finlay at moeraki.com> wrote:
>>
>>  
>>
>>>> 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.
>>>   
>>
>>
>> Yes ... but isn't "on_get_iter" the method wich is called when
>> "get_iter" is used with my custom_list?
>> So if "get_iter" have to raise a ValueError with invalid paths I should
>> raise this ValueError in on_get_iter ... I think.
>>  
>>
> No. If there is a ValueError on_get_iter() will not be called.
>
I realized that my response was incorrect. You can raise an exception if 
you want but it's not necessary since returning None will indicate that 
the path was invalid and the GenericTreeModel code will return False 
which will cause the get_iter() wrapper to raise the ValueError.

John


More information about the pygtk mailing list