Re: Displaying domain objects with GtkTreeView



On 12/02/2011 04:01 PM, David NeÄas wrote:
On Fri, Dec 02, 2011 at 03:55:51PM +0100, RafaÅ KrupiÅski wrote:
I rather meant to use my object as a model for a whole, multi-column
row, somehow binding fields or properties to columns.
It makes no sense (to me anyway) to imagine one object as multiple
*model* columns.

Might be that what you look for, Rafal, is  model.set_modify_func () -
it allows him
to synthesize model columns on the fly, from e.g. objects in the real
model column.

The modify func then can look st. like this:

def modify_func (model, iter, col_num, attrs):
    obj = model.get_value (iter, 0)
    col = attrs[col_num]

    try:
        return getattr (obj, col)
    except:
        return ''

For some performance penalty.

Cheers,
Edheldil





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]