tor 2003-03-13 klockan 06.29 skrev Eric S. Raymond:
> Code:
> 
>     def load_record(self, parent, value):
>         "Load a record with a specified value."
>         # This conditional works around an apparent bug.
>         # iter_children doesn't accept None as a synonym for the root.
>         sibling = None
>         if parent != None:
>             print "Looking at: ", parent
>             sibling = self.gtk_model.iter_children(parent)
>             while sibling:
>                 if cmp(self.gtk_model.get_value(sibling, OakumGUI.payload_column), 
> value) > 0:
>                     break
>                 sibling = self.gtk_model.iter_next(sibling)
>         recordlevel = self.gtk_model.insert_before(parent, sibling)
> 
> 
> Error trace:
> 
> Looking at:  <GtkTreeIter at 0x83afbe8>
> Traceback (most recent call last):
>   File "./oakum.py", line 1047, in on_data_field_accept
>     self.add_item_post(here)
>   File "./oakum.py", line 980, in add_item_post
>     newrow = self.load_name(zc,text,dnsrecord)
>   File "./oakum.py", line 781, in load_name
>     namelevel = self.load_record(zone_cursor, dns_name)
>   File "./oakum.py", line 767, in load_record
>     sibling = self.gtk_model.iter_children(parent)
> TypeError: parent should be a GtkTreeIter

Is parent really a GtkTreeIter, are you sure it's not invalidated?
http://doc/gtk/gtk/2.0/gtktreemodel.html#GTK-TREE-MODEL-ITER-CHILDREN

If you're using a GtkTreeStore model, there should only be one way of
getting iters invalidated (According to GtkTreeView hacker kris):

<kris> there the iter only gets invalidated when it's poiting to the
last row being removed

> I had previously noted that iter_children doesn't accept a None
> argument as an iter object meaning the model root.

This could easily be added, so if None is specified the iter is fetch by
calling get_iter_root()

> 
> Are there any known bugs in iter_children?  Are there diagnostics I
> could run to understand this problem better?

I don't think so. But I might be wrong.

What version of Gtk+ are you using? (2.x, 2.2.x?)


-- 
Johan Dahlin <[EMAIL PROTECTED]>
Async Open Source

_______________________________________________
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