Comment 7 for bug 829032

Revision history for this message
Jo-Erlend Schinstad (joerlend.schinstad-deactivatedaccount) wrote :

import gtk
from quickly.widgets.dictionary_grid import DictionaryGrid

win = gtk.Window()
win.set_title("This is a bug")
vbox = gtk.VBox()
hbox = gtk.HBox()
add_button = gtk.Button("Add row")
print_button = gtk.Button("Print dictionaries")
hbox.pack_start(add_button, True, True)
hbox.pack_start(print_button, True, True)

keys = ["first_name", "last_name"]
dg = DictionaryGrid(keys=keys)
dg.editable = True
vbox.pack_start(dg, True, True)
vbox.pack_start(hbox, False, False)
win.add(vbox)
win.show_all()

def print_dicts(widget):
    print(dg.get_dictionaries_copy())

def add_row(widget):
    dg.append_row({})

print_button.connect("clicked", print_dicts)
add_button.connect("clicked", add_row)
win.connect("delete-event", gtk.main_quit)
gtk.main()

Add some rows and print it out. You'll see that it returns just an empty list.