B
binaryjesus
hi group i am running into a problem with gtk. i have a treeview that
just displays tabular data (no down arrows or trees etc). it has 5
columns. The tiny problem i am having is that it is just display the
data of the column named `title` in all the colums!
here the pic of the app in action
http://i36.tinypic.com/2djcqqr.png
the related code of the app is as follows:
self.tv = self.glade.get_widget('treeview1') #the treeview object
def show_sync_wind(self,obj, data = None):
t = Template.select(Template.q.synced == '0')
self.synclstore = gtk.ListStore(str,str,str,str,str)
x = 0
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn('#', cr);
col.add_attribute(cr, 'markup', 1)
col.set_expand(True)
col.set_clickable(True)
col.set_resizable(True)
col.set_sort_column_id(0)
self.tv.append_column(col)
self.sno_col = col
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn('Title', cr);
col.add_attribute(cr, 'markup', 1)
col.set_expand(True)
col.set_clickable(True)
col.set_resizable(True)
col.set_sort_column_id(1)
self.tv.append_column(col)
self.title_col = col
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn('Section', cr);
col.add_attribute(cr, 'markup', 1)
col.set_expand(True)
col.set_clickable(True)
col.set_resizable(True)
col.set_sort_column_id(2)
self.tv.append_column(col)
self.section_col = col
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn('Category', cr);
col.add_attribute(cr, 'markup', 1)
col.set_expand(True)
col.set_clickable(True)
col.set_resizable(True)
col.set_sort_column_id(3)
self.tv.append_column(col)
self.category_col = col
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn('Sync', cr);
col.add_attribute(cr, 'markup', 1)
col.set_expand(True)
col.set_clickable(True)
col.set_resizable(True)
col.set_sort_column_id(4)
self.tv.append_column(col)
self.sync_col = col
self.tv.set_model(self.synclstore)
self.tv.set_headers_clickable(True)
#self.tv.set_expander_column(self.title_col)
for y in t:
row =
self.synclstore.append([str(x),y.title,y.section.name,y.category.name,y.synced])
self.synclstore.set(row,0,'0')
self.synclstore.set(row,1,y.title)
self.synclstore.set(row,2,y.section.name)
self.synclstore.set(row,3,y.category.name)
self.synclstore.set(row,4,y.synced)
self.sync_window.show()
just displays tabular data (no down arrows or trees etc). it has 5
columns. The tiny problem i am having is that it is just display the
data of the column named `title` in all the colums!
here the pic of the app in action
http://i36.tinypic.com/2djcqqr.png
the related code of the app is as follows:
self.tv = self.glade.get_widget('treeview1') #the treeview object
def show_sync_wind(self,obj, data = None):
t = Template.select(Template.q.synced == '0')
self.synclstore = gtk.ListStore(str,str,str,str,str)
x = 0
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn('#', cr);
col.add_attribute(cr, 'markup', 1)
col.set_expand(True)
col.set_clickable(True)
col.set_resizable(True)
col.set_sort_column_id(0)
self.tv.append_column(col)
self.sno_col = col
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn('Title', cr);
col.add_attribute(cr, 'markup', 1)
col.set_expand(True)
col.set_clickable(True)
col.set_resizable(True)
col.set_sort_column_id(1)
self.tv.append_column(col)
self.title_col = col
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn('Section', cr);
col.add_attribute(cr, 'markup', 1)
col.set_expand(True)
col.set_clickable(True)
col.set_resizable(True)
col.set_sort_column_id(2)
self.tv.append_column(col)
self.section_col = col
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn('Category', cr);
col.add_attribute(cr, 'markup', 1)
col.set_expand(True)
col.set_clickable(True)
col.set_resizable(True)
col.set_sort_column_id(3)
self.tv.append_column(col)
self.category_col = col
cr = gtk.CellRendererText()
col = gtk.TreeViewColumn('Sync', cr);
col.add_attribute(cr, 'markup', 1)
col.set_expand(True)
col.set_clickable(True)
col.set_resizable(True)
col.set_sort_column_id(4)
self.tv.append_column(col)
self.sync_col = col
self.tv.set_model(self.synclstore)
self.tv.set_headers_clickable(True)
#self.tv.set_expander_column(self.title_col)
for y in t:
row =
self.synclstore.append([str(x),y.title,y.section.name,y.category.name,y.synced])
self.synclstore.set(row,0,'0')
self.synclstore.set(row,1,y.title)
self.synclstore.set(row,2,y.section.name)
self.synclstore.set(row,3,y.category.name)
self.synclstore.set(row,4,y.synced)
self.sync_window.show()