Fix marker colours in Family and Note views

svn: r15613
This commit is contained in:
Nick Hall 2010-07-03 15:04:36 +00:00
parent adda80f8fe
commit 5ab9ca2e5a
4 changed files with 22 additions and 15 deletions

View File

@ -86,10 +86,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

View File

@ -74,10 +74,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

View File

@ -145,6 +145,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:
@ -454,12 +460,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.
@ -469,7 +469,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):

View File

@ -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