Fixed three errors in ListModel

svn: r15728
This commit is contained in:
Doug Blank 2010-08-13 23:35:53 +00:00
parent 3551fe851a
commit 40820ea6ea

View File

@ -119,6 +119,8 @@ class ListModel(object):
if name[0] and name[3] == TOGGLE: if name[0] and name[3] == TOGGLE:
renderer = gtk.CellRendererToggle() renderer = gtk.CellRendererToggle()
renderer.set_property('activatable', True)
renderer.connect("toggled", self.__toggle, cnum)
column = gtk.TreeViewColumn(name[0], renderer) column = gtk.TreeViewColumn(name[0], renderer)
column.add_attribute(renderer, 'active', cnum) column.add_attribute(renderer, 'active', cnum)
elif name[0] and name[3] == IMAGE: elif name[0] and name[3] == IMAGE:
@ -145,7 +147,8 @@ class ListModel(object):
column.set_clickable(False) column.set_clickable(False)
else: else:
column.set_clickable(True) column.set_clickable(True)
column.set_sort_column_id(name[1]) #column.set_sort_column_id(name[1])
column.set_sort_column_id(cnum)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(name[2]) column.set_fixed_width(name[2])
@ -155,6 +158,9 @@ class ListModel(object):
if name[0] != '': if name[0] != '':
self.tree.append_column(column) self.tree.append_column(column)
def __toggle(self, obj, path, col):
self.tree.get_model()[path][col] = not self.tree.get_model()[path][col]
def __edited_cb(self, cell, path, new_text, col): def __edited_cb(self, cell, path, new_text, col):
""" """
Callback executed when the text of the cell renderer has changed Callback executed when the text of the cell renderer has changed