Modifications so that GenericFilters can be applied to a PeopleModel.
svn: r9665
This commit is contained in:
parent
cfbcdce095
commit
e90e15c4af
@ -1,3 +1,9 @@
|
||||
2007-12-31 Brian Matherly <brian@gramps-project.org>
|
||||
* src/Editors/EditFamily.py:
|
||||
* src/DisplayModels/_PeopleModel.py:
|
||||
* src/Filters/_GenericFilter.py:
|
||||
Modifications so that GenericFilters can be applied to a PeopleModel.
|
||||
|
||||
2007-12-31 Gary Burton <gary.burton@zen.co.uk>
|
||||
* src/gen/db/base.py: added missing key for reference_key in mapbase and
|
||||
_SIGBASE. Was preventing deleted notes being undone. Bug #1507.
|
||||
|
@ -334,7 +334,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
while node:
|
||||
self.total += 1
|
||||
handle, d = node
|
||||
if not (handle in skip or (dfilter and not dfilter.match(handle))):
|
||||
if not (handle in skip or (dfilter and not dfilter.match(handle,self.db))):
|
||||
name_data = d[PeopleModel._NAME_COL]
|
||||
|
||||
group_name = ngn(self.db, name_data)
|
||||
|
@ -364,7 +364,7 @@ class FastMaleFilter:
|
||||
def __init__(self,db):
|
||||
self.db = db
|
||||
|
||||
def match(self, handle):
|
||||
def match(self, handle,db):
|
||||
value = self.db.get_raw_person_data(handle)
|
||||
return value[2] == gen.lib.Person.MALE
|
||||
|
||||
@ -373,7 +373,7 @@ class FastFemaleFilter:
|
||||
def __init__(self,db):
|
||||
self.db = db
|
||||
|
||||
def match(self, handle):
|
||||
def match(self, handle,db):
|
||||
value = self.db.get_raw_person_data(handle)
|
||||
return value[2] == gen.lib.Person.FEMALE
|
||||
|
||||
|
@ -51,8 +51,13 @@ class GenericFilter:
|
||||
self.logical_op = 'and'
|
||||
self.invert = False
|
||||
|
||||
def match(self,handle):
|
||||
return True
|
||||
def match(self,handle,db):
|
||||
"""Return True or False depending on whether the handle matches the
|
||||
filter """
|
||||
if self.apply(db,[handle]):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def is_empty(self):
|
||||
return len(self.flist) == 0 or (len(self.flist) == 1 and self.flist[0].is_empty())
|
||||
|
Loading…
Reference in New Issue
Block a user