Hello
I using gtk.TreeView. I added in one of many colums gtk.CellRendererCombo.
But i have problem ..
Code works good, but not as i want ..
I rendering gtkCellRendererCombo like this .. It's OK
def make_cell_render(self):
liststore = gtk.ListStore(gobject.TYPE_STRING)
tiekejai = self.db.get_names_from_database() # i am getting from
database(mysql) companies names
for t in tiekejai:
liststore.append((t))
self.cell = gtk.CellRendererCombo()
self.cell.set_property("text-column", 0)
self.cell.set_property('editable', True)
self.cell.set_property('model', liststore)
self.cell.connect('editing-started', self.text_editing_started)
self.cell.connect('edited', self.cell_edited_cb)
return self.cell
I created callback self.cell_edited_cb
Because i want to change combo box value ..
my callback:
def cell_edited_cb(self, cell, path, new_text):
model = self.treeview.get_model()
iter = model.get_iter_from_string(path)
k = self.db.tiekejo_id_by_name(new_text)
model.set(iter, 3, new_text) # 3 it's number of column in treeview
(with CellRenederCombo)
This code changes combo box text .. And there's problem .. I need to track
not just companies names, but companies ID's .. i have company table .. with
name and and ID's and other information ...
I need somehow store additional value (companie id, not just company name)
.. because i don't want to perform search ( by using just company name
value) .. Because there's can be company by the same name, but the address
different ..
Actually i think:
liststore = gtk.ListStore(gobject.TYPE_STRING)
i need to change to liststore = gtk.ListStore(gobject.TYPE_STRING,
gobject.TYPE_STRING) .. and somehow extract 2nd value in callback code ..
But i don't know how ..
Any help will be appropriate ..
kestaz
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/