def __init__(self, index, preferences):
self.index = index
# Icons corresponding to tags, prevent unnecessary changing.
self.icons_for_tags = preferences.copy()
self.model = gtk.ListStore(str, gtk.gdk.Pixbuf, str, int) # TAG_COL, ICON_COL, ICON_NAME, N_PAGES_COL
SingleClickTreeView.__init__(self, self.model)
cells = (('Tags', self.TAG_COL, True),
('Pages', self.N_PAGES_COL, False))
for name, col_id, expand in (cells):
cell = gtk.CellRendererText()
cell.set_property('ellipsize', pango.ELLIPSIZE_END)
cell.set_property('cell-background', 'white')
col = gtk.TreeViewColumn(name, cell)
col.set_attributes(cell, text = col_id)
col.set_resizable(expand)
col.set_expand(expand)
col.set_sort_column_id(col_id)
self.append_column(col)
cell = gtk.CellRendererPixbuf()
cell.set_property('cell-background', 'white')
col = gtk.TreeViewColumn('Icon', cell)
col.set_attributes(cell, pixbuf = self.ICON_COL)
col.set_resizable(False)
col.set_expand(False)
col.set_sort_column_id(self.ICON_NAME)
self.append_column(col)
self.refill_model()
评论列表
文章目录