Commits

Anonymous committed d984e0a

Added a check so that functions may be used to determine attributes in
CellMapper.

  • Participants
  • Parent commits 5b7960c

Comments (0)

Files changed (1)

pygtkhelpers/ui/objectlist/column.py

     def __init__(self, map_spec):
         self.mappers = []
         for prop, attr in map_spec.items():
-            self.mappers.append(PropertyMapper(prop, attr))
+            # the user may either specify a function to compute the attribute or a fixed attribute.
+            if callable(attr):
+                self.mappers.append(PropertyMapper(prop, format_func=attr))
+            else:
+                self.mappers.append(PropertyMapper(prop, attr))
 
     def __call__(self, cell, obj, renderer):
         for mapper in self.mappers: