2006-07-23 Alex Roitman <shura@gramps-project.org>

* src/Filters/Rules/Person/_IsLessThanNthGenerationDescendantOf.py
	(IsLessThanNthGenerationDescendantOf.init_list): Use new API.
	* src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py
	(IsSiblingOfFilterMatch.init_list): Use new API.
	* src/Filters/Rules/Person/_RelationshipPathBetween.py
	(RelationshipPathBetween.desc_list): Use new API.
	* src/Filters/Rules/Person/_HaveChildren.py (HaveChildren.apply):
	Use new API.
	* src/Filters/Rules/Person/_IsMoreThanNthGenerationDescendantOf.py
	(IsMoreThanNthGenerationDescendantOf.init_list): Use new API.
	* src/Filters/Rules/__init__.py: Expose Rule for plugin filters.
	* src/Filters/Rules/Person/_IsDescendantOf.py
	(IsDescendantOf.init_list): Use new API.
	* src/Filters/Rules/Person/_HasRelationship.py
	(HasRelationship.apply): Use new API.



svn: r7060
This commit is contained in:
Alex Roitman 2006-07-23 16:59:33 +00:00
parent b4d6e0ea35
commit 0cbb723ac7
9 changed files with 38 additions and 14 deletions

View File

@ -1,3 +1,20 @@
2006-07-23 Alex Roitman <shura@gramps-project.org>
* src/Filters/Rules/Person/_IsLessThanNthGenerationDescendantOf.py
(IsLessThanNthGenerationDescendantOf.init_list): Use new API.
* src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py
(IsSiblingOfFilterMatch.init_list): Use new API.
* src/Filters/Rules/Person/_RelationshipPathBetween.py
(RelationshipPathBetween.desc_list): Use new API.
* src/Filters/Rules/Person/_HaveChildren.py (HaveChildren.apply):
Use new API.
* src/Filters/Rules/Person/_IsMoreThanNthGenerationDescendantOf.py
(IsMoreThanNthGenerationDescendantOf.init_list): Use new API.
* src/Filters/Rules/__init__.py: Expose Rule for plugin filters.
* src/Filters/Rules/Person/_IsDescendantOf.py
(IsDescendantOf.init_list): Use new API.
* src/Filters/Rules/Person/_HasRelationship.py
(HasRelationship.apply): Use new API.
2006-07-22 Don Allingham <don@gramps-project.org>
* src/Filters/Rules/Person/__init__.py: add register function
* configure.in: bump up version number

View File

@ -57,7 +57,7 @@ class HasRelationship(Rule):
# count children and look for a relationship type match
for f_id in person.get_family_handle_list():
f = db.get_family_from_handle(f_id)
cnt = cnt + len(f.get_child_handle_list())
cnt = cnt + len(f.get_child_ref_list())
if self.list[1] and int(self.list[1]) == f.get_relationship():
rel_type = 1

View File

@ -47,4 +47,4 @@ class HaveChildren(Rule):
def apply(self,db,person):
for family_handle in person.get_family_handle_list():
family = db.get_family_from_handle(family_handle)
return len(family.get_child_handle_list()) > 0
return len(family.get_child_ref_list()) > 0

View File

@ -79,5 +79,6 @@ class IsDescendantOf(Rule):
for fam_id in person.get_family_handle_list():
fam = self.db.get_family_from_handle(fam_id)
if fam:
for child_handle in fam.get_child_handle_list():
self.init_list(self.db.get_person_from_handle(child_handle),0)
for child_ref in fam.get_child_ref_list():
self.init_list(
self.db.get_person_from_handle(child_ref.ref),0)

View File

@ -75,5 +75,6 @@ class IsLessThanNthGenerationDescendantOf(Rule):
for fam_id in person.get_family_handle_list():
fam = self.db.get_family_from_handle(fam_id)
for child_handle in fam.get_child_handle_list():
self.init_list(self.db.get_person_from_handle(child_handle),gen+1)
for child_ref in fam.get_child_ref_list():
self.init_list(
self.db.get_person_from_handle(child_ref.ref),gen+1)

View File

@ -73,5 +73,6 @@ class IsMoreThanNthGenerationDescendantOf(Rule):
for fam_id in person.get_family_handle_list():
fam = self.db.get_family_from_handle(fam_id)
for child_handle in fam.get_child_handle_list():
self.init_list(self.db.get_person_from_handle(child_handle),gen+1)
for child_ref in fam.get_child_ref_list():
self.init_list(
self.db.get_person_from_handle(child_ref.ref),gen+1)

View File

@ -71,6 +71,6 @@ class IsSiblingOfFilterMatch(Rule):
fam_id = person.get_main_parents_family_handle()
fam = self.db.get_family_from_handle(fam_id)
if fam:
for child_handle in fam.get_child_handle_list():
if child_handle != person.handle:
self.map[child_handle] = 1
for child_ref in fam.get_child_ref_list():
if child_ref.ref != person.handle:
self.map[child_ref.ref] = 1

View File

@ -71,9 +71,9 @@ class RelationshipPathBetween(Rule):
for fam_id in p.get_family_handle_list():
fam = self.db.get_family_from_handle(fam_id)
if fam:
for child_handle in fam.get_child_handle_list():
if child_handle:
self.desc_list(child_handle,map,0)
for child_ref in fam.get_child_ref_list():
if child_ref.ref:
self.desc_list(child_ref.ref,map,0)
def apply_filter(self,rank,handle,plist,pmap):
person = self.db.get_person_from_handle(handle)

View File

@ -26,6 +26,10 @@ Package providing filter rules for GRAMPS.
__author__ = "Don Allingham"
# Need to expose this to be available for filter plugins:
# the plugins should say: from Filters.Rules import Rule
from _Rule import Rule
from _Everything import Everything
from _HasGrampsId import HasGrampsId
from _IsPrivate import IsPrivate