Is that code snippet of any help?
def set_foreign_key(self, colnum, SQLObject, colname_1, colname_n):
maps a foreign key to a corresponding attribute in the n-table.
colnum is the position of
the column in the treeview (integer), SQLObject is the SQLObject class
the mapped value is
retrieved from, colname_1 is the column name of the foreign key field,
colname_n is the column
the value is retrieved from.
column = self.get_column(colnum)
cells = column.get_cell_renderers()
cell = cells[0]
column.set_cell_data_func(cell, self.__use_foreign_key_val,
[SQLObject,colname_1,colname_n])
the only problem with this approach is that one col can have various
CellRenderers; this code asserts that only one renderer is assigned to the
cell.
On Wednesday 18 June 2008 09:02:52 Jeremy S wrote:
If you put a float in a treeview, you get a really long decimal, which
is almost always not desired. So, after playing around with it for a
while, I came up with this code to truncate floats at 1 decimal place:
column.set_cell_data_func(renderer,
lambda column, cell, model, iter:
cell.set_property('text', '%.1f' % model.get_value(iter,
column.get_sort_column_id(
The problem with this is that it uses
GtkTreeViewColumn::get_sort_column_id() to get the column number,
which only works if the column is sortable. Can anyone tell me what
to do if I want the formatting to work on any column, not just
sortable columns? Thank you.
___
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
___
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/