ocarina/src/extra/guiGTK/list.py

33 lines
749 B
Python

#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Jan 15, 2010 12:02:08 AM$"
import gtk
class List(gtk.ScrolledWindow):
def __init__(self, list, cols):
gtk.ScrolledWindow.__init__(self)
self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
self.show()
self.list = list
self.tree = gtk.TreeView(list)
self.add(self.tree)
self.tree.show()
self.addcols(cols)
def addcols(self,cols):
cell = gtk.CellRendererText()
for index,column in enumerate(cols):
col = gtk.TreeViewColumn(column,cell)
col.add_attribute(cell,'text',index)
self.tree.append_column(col)
def insert(self,items):
self.list.insert(len(self.list), items)