Re: [pygtk] Tree/ListStore remove(iter)?

2001-12-06 Thread Robert Nikander

On 2001.12.05 21:09 James Henstridge wrote:

iter = model.get_iter(1, 6)
 


Ah.  I was confused about tuples/paths vs iterators. 
Thanks a ton to both Matt and James for answering all my questions.

How about getting the number of children in the list?

According to GTK docs it is model.iter_n_childen( NULL )
... but how to get a PyObject Iterator that is wrapped around NULL?


I appreciate the help, thanks,

Rob
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] Tree/ListStore remove(iter)?

2001-12-06 Thread Matt Wilson

Apply the attached patch and use None as the iter.

(fixed in CVS)

Cheers,

Matt

On Thu, Dec 06, 2001 at 09:53:55AM -0500, Robert Nikander wrote:
 On 2001.12.05 21:09 James Henstridge wrote:
 
 iter = model.get_iter(1, 6)
  
 
 
 Ah.  I was confused about tuples/paths vs iterators. 
 Thanks a ton to both Matt and James for answering all my questions.
 
 How about getting the number of children in the list?
 
 According to GTK docs it is model.iter_n_childen( NULL )
 ... but how to get a PyObject Iterator that is wrapped around NULL?
 
 
 I appreciate the help, thanks,
 
 Rob
 ___
 pygtk mailing list   [EMAIL PROTECTED]
 http://www.daa.com.au/mailman/listinfo/pygtk


Index: gtk/gtk.defs
===
RCS file: /cvs/gnome/gnome-python/pygtk/gtk/gtk.defs,v
retrieving revision 1.83
diff -u -r1.83 gtk.defs
--- gtk/gtk.defs2001/12/04 07:17:42 1.83
+++ gtk/gtk.defs2001/12/06 17:20:53
@@ -12704,7 +12704,7 @@
   (c-name gtk_tree_model_iter_n_children)
   (return-type gint)
   (parameters
-'(GtkTreeIter* iter)
+'(GtkTreeIter* iter (null-ok))
   )
 )
 
@@ -12714,7 +12714,7 @@
   (return-type gboolean)
   (parameters
 '(GtkTreeIter* iter)
-'(GtkTreeIter* parent)
+'(GtkTreeIter* parent (null-ok))
 '(gint n)
   )
 )



Re: [pygtk] Tree/ListStore remove(iter)?

2001-12-05 Thread James Henstridge

Robert Nikander wrote:

 Hi again,

 I have just about got my app working with the new pygtk... but just a 
 few more questions!

 In short...
 1. Does TreeStore/ListStore remove() work?  I don't see a 'bug' in 
 bugzilla, but then I am having trouble querying the thing. 

Removing rows works fine for me.  Just get an iter for the row you want 
removed, and call model.remove(iter).  You can get an iter for a row 
with the model.get_iter() method.  This takes a variable number of 
arguments giving the path of the iter in the tree.  For example to get 
the 7th child node of the 2nd toplevel node, you would use:
iter = model.get_iter(1, 6)


 2. Can you get data back out of a List/Tree store?  If not, can you 
 avoid duplication of data when using them? 

Yes.  Both GtkTreeStore and GtkListStore implement the GtkTreeModel 
interface.  The GtkTreeModel interface is used to get information out of 
the model (and perform notification when the information changes).  If 
you have an iter for the desired row, you can do:
value_in_first_column = model.get_value(iter, 0)

James

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk