[pygtk] gtk.TreeModel.iter_children() method, how often should it be called?

Gerald Britton gerald.britton at gmail.com
Mon Jun 22 20:54:17 WST 2009


I don't think that makes sense.  For example, it does stop calling
iter_children at some point and display the tree.  In my case, the
first time the tree is build, it makes two calls to iter_children and
then displays the tree and waits for something to happen (I still
think that two is one too many, but I can live with it).  The next
time, it calls iter_children over 2000 times before it displays the
tree.

That can't be right!

So, the question remains, "When does the TreeModel stop calling
iter_children and display the tree?"

It obviously does stop calling iter_children at some point,  I can
show that. But, what are the circumstances?  What is it looking for?

On Mon, Jun 22, 2009 at 6:28 AM, Chris Camacho<chris_camacho at yahoo.com> wrote:
>
> As far as I could tell that's just the way it works *if* you could
> suspend the calls to iter_children it would stop working...
>
> --- On Sat, 20/6/09, Gerald Britton <gerald.britton at gmail.com> wrote:
>
>> From: Gerald Britton <gerald.britton at gmail.com>
>> Subject: Re: [pygtk] gtk.TreeModel.iter_children() method, how often should it  be called?
>> To: "Chris Camacho" <chris_camacho at yahoo.com>
>> Cc: pygtk at daa.com.au
>> Date: Saturday, 20 June, 2009, 11:11 PM
>> I hear you, but I still need a direct
>> answer to the question, "What
>> makes the TreeModel stop calling iter_children?  I
>> can't find a clear
>> explanation and I can't figure it out by looking at the
>> calls that
>> come into my method either.
>>
>> On Thu, Jun 18, 2009 at 11:18 AM, Chris Camacho<chris_camacho at yahoo.com>
>> wrote:
>> >
>> > jeeze not being able to just reply is a pain
>> anyhow....
>> >
>> > I looked into using treemodels connecting to
>> databases
>> >
>> > from what I could tell it seems to initially iterate
>> all items
>> > and either copies them or creates meta data about the
>> items
>> > (I didnt look into the implementation)
>> > Depending on how things were added it would also seem
>> to iterate the whole
>> > set again!
>> > I think the standard treemodel is ok for small numbers
>> (sub 200)
>> > but I had to end up paging 1,000's of items 100 at a
>> time
>> > (interestingly this is what the gnome db widgets
>> do...)
>> >
>> > I've been tempted to weld together my own data grid
>> with a viewport
>> > and moving entry widgets but this would at a guess
>> need C and I haven't
>> > had the time to look into it
>> >
>> >
>> > --- On Thu, 18/6/09, Gerald Britton <gerald.britton at gmail.com>
>> wrote:
>> >
>> >> From: Gerald Britton <gerald.britton at gmail.com>
>> >> Subject: [pygtk] gtk.TreeModel.iter_children()
>> method, how often should it be called?
>> >> To: pygtk at daa.com.au
>> >> Date: Thursday, 18 June, 2009, 2:50 PM
>> >> Hi -- I think I have a problem but
>> >> I'm not sure since I'm relatively
>> >> new to the TreeModel and how it works.  Here's
>> the
>> >> scenario:
>> >>
>> >> I use TreeModel to display rows of data from a
>> >> database.  Upon
>> >> startup, the TreeModel is built and I notice two
>> calls to
>> >> the
>> >> gtk.TreeModel.iter_children() method.  Later, I
>> change
>> >> some data in
>> >> one of the rows.  The next time the TreeModel is
>> >> built,
>> >> gtk.TreeModel.iter_children() is called thousands
>> of times
>> >> before the
>> >> display is refreshed. Oh, the database has less
>> than 50
>> >> rows of data
>> >> in it!
>> >>
>> >> So, two questions:
>> >>
>> >> 1. Is this normal (I hope not!) behavior?
>> >>
>> >> 2. What tells the TreeModel to stop calling
>> >> gtk.TreeModel.iter_children()?  How does the TM
>> know
>> >> that it has done
>> >> everything it needs to do?
>> >>
>> >> --
>> >> Gerald Britton
>> >> _______________________________________________
>> >> pygtk mailing list   pygtk at daa.com.au
>> >> http://www.daa.com.au/mailman/listinfo/pygtk
>> >> Read the PyGTK FAQ: http://faq.pygtk.org/
>> >>
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> Gerald Britton
>>
>
>
>
>



-- 
Gerald Britton


More information about the pygtk mailing list