Thanks so much, that is exactly what I was looking for.  However I am
having trouble connecting to the cell renderer's "toggled" signal

Below is the code I am using to connect, I have tried connecting to
'toggled' and 'toggle_cursor_row' but they both return an error 
"TypeError: unknown signal name"

am I just not connecting to the signal correctly?

self.keyListModel = gtk.ListStore(gobject.TYPE_STRING, 
gobject.TYPE_STRING, gobject.TYPE_BOOLEAN)
.....
self.keyListModel.set_value(iter,0,eachKey)
self.keyListModel.set_value(iter,1,self.keys.get(eachKey))
self.keyListModel.set_value(iter,2,False)
.....
self.col = gtk.TreeViewColumn("key id",gtk.CellRendererText(),text=0)
self.col1 = gtk.TreeViewColumn("name",gtk.CellRendererText(),text=1)
self.col2 = gtk.TreeViewColumn("allow",gtk.CellRendererToggle(),active=2)
self.col2.connect('toggled',self.toggle)
.....
def toggle(cell, path_string, model):
        print "toggled"


Thanks again.

> You want to use a gtk.CellRendererToggle() instead of a 
> CellRendererText().  You want to map active=2 to make the toggle display 
> the state of the 3rd column.  If you want the toggle to update the state 
> of the tree, you will need to connect to the cell renderer's "toggled" 
> signal.  Your callback might look something like this:
>    def cell_toggled(cell, path_string, model):
>        path = tuple([int(i) for i in path_string.split(':')])
>        row = model[path]
>        row[2] = not row[2]
>        model.row_changed(path, row.iter)
> 
> (I haven't tested the above, but it is approximately what it should look 
> like).
> 
> James.
> 
> -- 
> Email: [EMAIL PROTECTED]
> WWW:   http://www.daa.com.au/~james/
> 
> 
> 
> _______________________________________________
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

-- 

Jay Graves 
[EMAIL PROTECTED]
jay.skabber.com

       O__
      _/`.\
          `=( '

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to