diff --git a/src/gui/views/treemodels/familymodel.py b/src/gui/views/treemodels/familymodel.py index 3c5f1f310..df62d927d 100644 --- a/src/gui/views/treemodels/familymodel.py +++ b/src/gui/views/treemodels/familymodel.py @@ -87,10 +87,15 @@ class FamilyModel(FlatBaseModel): self.column_marker_text, self.column_marker_color, ] - self.marker_color_column = 9 FlatBaseModel.__init__(self, db, scol, order, tooltip_column=6, search=search, skip=skip, sort_map=sort_map) + def marker_column(self): + """ + Return the column for marker colour. + """ + return 9 + def on_get_n_columns(self): return len(self.fmap)+1 diff --git a/src/gui/views/treemodels/notemodel.py b/src/gui/views/treemodels/notemodel.py index 648158157..e72b88d52 100644 --- a/src/gui/views/treemodels/notemodel.py +++ b/src/gui/views/treemodels/notemodel.py @@ -75,10 +75,15 @@ class NoteModel(FlatBaseModel): self.column_handle, self.column_marker_color ] - self.marker_color_column = 6 FlatBaseModel.__init__(self, db, scol, order, search=search, skip=skip, sort_map=sort_map) + def marker_column(self): + """ + Return the column for marker colour. + """ + return 6 + def on_get_n_columns(self): """Return the column number of the Note tab.""" return len(self.fmap) + 1 diff --git a/src/gui/views/treemodels/peoplemodel.py b/src/gui/views/treemodels/peoplemodel.py index 65a907a52..58bea4ce9 100644 --- a/src/gui/views/treemodels/peoplemodel.py +++ b/src/gui/views/treemodels/peoplemodel.py @@ -146,6 +146,12 @@ class PeopleBaseModel(object): self.lru_bdate = LRU(PeopleBaseModel._CACHE_SIZE) self.lru_ddate = LRU(PeopleBaseModel._CACHE_SIZE) + def marker_column(self): + """ + Return the column for marker colour. + """ + return 11 + def clear_local_cache(self, handle=None): """ Clear the LRU cache """ if handle: @@ -458,12 +464,6 @@ class PersonListModel(PeopleBaseModel, FlatBaseModel): """ Clear the LRU cache """ PeopleBaseModel.clear_local_cache(self, handle) - def marker_column(self): - """ - Return the column for marker colour. - """ - return 11 - class PersonTreeModel(PeopleBaseModel, TreeBaseModel): """ Hierarchical people model. @@ -473,7 +473,6 @@ class PersonTreeModel(PeopleBaseModel, TreeBaseModel): PeopleBaseModel.__init__(self, db) TreeBaseModel.__init__(self, db, 12, search=search, skip=skip, - marker_column=11, scol=scol, order=order, sort_map=sort_map) def _set_base_data(self): diff --git a/src/gui/views/treemodels/treebasemodel.py b/src/gui/views/treemodels/treebasemodel.py index ce823eb71..c077cb1e3 100644 --- a/src/gui/views/treemodels/treebasemodel.py +++ b/src/gui/views/treemodels/treebasemodel.py @@ -3,7 +3,7 @@ # # Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2009 Gary Burton -# Copyright (C) 2009 Nick Hall +# Copyright (C) 2009-2010 Nick Hall # Copyright (C) 2009 Benny Malengier # # This program is free software; you can redistribute it and/or modify @@ -238,7 +238,6 @@ class TreeBaseModel(gtk.GenericTreeModel): Creation: db : the database tooltip_column : column number of tooltip - marker_column : column number of marker search : the search that must be shown skip : values not to show scol : column on which to sort @@ -258,7 +257,7 @@ class TreeBaseModel(gtk.GenericTreeModel): # LRU cache size _CACHE_SIZE = 250 - def __init__(self, db, tooltip_column, marker_column=None, + def __init__(self, db, tooltip_column, search=None, skip=set(), scol=0, order=gtk.SORT_ASCENDING, sort_map=None, nrgroups = 1, @@ -312,7 +311,6 @@ class TreeBaseModel(gtk.GenericTreeModel): self.custom_color = config.get('preferences.custom-marker-color') self._tooltip_column = tooltip_column - self._marker_column = marker_column self.__total = 0 self.__displayed = 0 @@ -384,7 +382,7 @@ class TreeBaseModel(gtk.GenericTreeModel): """ Return the marker color column. """ - return self._marker_column + return None def clear_cache(self, handle=None): """ @@ -772,7 +770,7 @@ class TreeBaseModel(gtk.GenericTreeModel): node = self.nodemap.node(nodeid) if node.handle is None: # Header rows dont get the foreground color set - if col == self._marker_column: + if col == self.marker_column(): return None # Look for header fuction for column and call it