[pygtk] strange (and orrible) behavior in gtk.CellRendererCombo
using pygtk
_v_tiziano
tiziano.lattisi at gmail.com
Mon Jan 16 21:14:37 WST 2006
Hi folks!
I notice a strange (and orrible) behavior in gtk.CellRendererCombo.
My code work trapping the 'edited' signal to store in a temporary
buffer before the "save all" operation (by clicking a save-button).
The is that gtk.CellRendererCombo (unlike gtk.CellRendererEntry, and
others...) dont emit the 'edited' signal when the user click on a
widget outside the gtk.TreeView, but only clicking on another cell in
same TreeView.
It's possible? There's a good reason?
There's a sample code to thest this (maybe) bug:
import pygtk
pygtk.require("2.0")
import gtk
import gtk.glade
PADDING = 8
class mytest:
"""
"""
def __init__(self):
self.w = gtk.Window()
self.b = gtk.Button('dummy button')
self.e = gtk.Entry()
self.tv = gtk.TreeView()
self.ls = gtk.ListStore(str, str)
cell1 = gtk.CellRendererText()
cell1.set_property('editable', True)
cell1.connect('edited', self.beep)
col1 = gtk.TreeViewColumn('entry')
col1.pack_start(cell1, True)
col1.add_attribute(cell1, 'text', 0)
cell2 = gtk.CellRendererCombo()
cell2.set_property('editable', True)
self.combols = gtk.ListStore(str, str)
cell2.set_property('model', self.combols)
cell2.set_property('text-column', 0)
cell2.connect('edited', self.beep)
col2 = gtk.TreeViewColumn('select')
col2.pack_start(cell2, True)
col2.add_attribute(cell2, 'text', 1)
self.tv.append_column(col1)
self.tv.append_column(col2)
self.tv.set_model(self.ls)
vbox = gtk.VBox()
vbox.pack_start(self.b, False, True, PADDING)
vbox.pack_start(self.e, False, True, PADDING)
vbox.pack_start(self.tv, False, True, PADDING)
self.w.add(vbox)
self.w.show_all()
self.popolate_list_store()
def popolate_list_store(self):
self.combols.append(('1', 'uno'))
self.combols.append(('2', 'due'))
self.ls.append(('qwe', '1'))
self.ls.append(('qwerty', '2'))
def beep(self, widget, t, i):
print "\a"
def main():
gtk.main()
return 0
if __name__ == "__main__":
app = mytest()
main()
Can anyone tell me if it'is a problem for pygtk or a gtk bug?
thak's a lot
tiziano
More information about the pygtk
mailing list