Editable lists in pygtk - Editing wrong cell

S

sapo

Hi all, i m trying to make an editable list with a toggle button, it
shows up and i can edit the list.. but its editing the wrong cell!

If i click on the toggle button on the first cell it sets FALSE on the
last cell of that row, if i change the text of the last cell if changes
another cell text... here is my code:

tree = self.principal.get_widget("file_list")
list = gtk.ListStore(str, str)
#Permite selecionar os arquivos
toggle = gtk.CellRendererToggle()
toggle.set_property('activatable', True)
tree.insert_column_with_attributes(-1, "Convert?", toggle)
toggle.connect('toggled', self.Select, tree)
#permite editar a lista
renderer = gtk.CellRendererText()
renderer.set_property( 'editable', True )
renderer.connect('edited', self.Edit, list)
tree.insert_column_with_attributes(-1, "Artist", renderer, text=0)
tree.insert_column_with_attributes(-1, "Song", renderer, text=1)
tree.set_model(list)

def Select(self,cell,path,model):
model[path][1] = not model[path][1]
return
def Edit(self, cell, path, new_text, model):
model[path][0] = new_text

What's wrong with it? i m following this example:
http://pygtk.org/pygtk2tutorial/sec-CellRenderers.html#EditableTextCells

thanx in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top