views:

43

answers:

0

I am trying to fill a treeview with data and checkbuttons. When the treeview is displayed, checkbuttons appear but the text doesn't.

I get the following error:

/home/astrob/programação/pyparty/groups.py:81: GtkWarning: gtk_tree_view_column_cell_layout_add_attribute: assertion `info != NULL' failed
  username_treeviewcolumn.add_attribute(username_cell, 'text', 0)
/home/astrob/programação/pyparty/groups.py:82: GtkWarning: gtk_tree_view_column_cell_layout_add_attribute: assertion `info != NULL' failed
  add_to_group_treeviewcolumn.add_attribute(add_to_group_cell, 'active', 1)

This is my code:

def load_treeview(self):

columns = self.treeview.get_columns()
for column in columns:
    self.treeview.remove_column(column)

treestore = gtk.TreeStore(str, bool)

user = user_commands_wrapper.User()
for group in user.get_all_groups():
    treestore.append(None, [group.gr_name, None])

username_treeviewcolumn = gtk.TreeViewColumn('Group Name')
add_to_group_treeviewcolumn = gtk.TreeViewColumn('Add to Group')

username_cell = gtk.CellRendererText()
add_to_group_cell = gtk.CellRendererToggle()
add_to_group_cell.set_property('activatable', True)
#add_to_group_cell.connect( 'toggled', self.col1_toggled_cb, model )

username_treeviewcolumn.add_attribute(username_cell, 'text', 0)
add_to_group_treeviewcolumn.add_attribute(add_to_group_cell, 'active', 1)

username_treeviewcolumn.pack_start(username_cell, True)
add_to_group_treeviewcolumn.pack_start(add_to_group_cell, True)

self.treeview.append_column(username_treeviewcolumn)
self.treeview.append_column(add_to_group_treeviewcolumn)

self.treeview.set_model(treestore)