From 0cbb723ac7f6d48e88a3dd4645f34fee5fe2d953 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sun, 23 Jul 2006 16:59:33 +0000 Subject: [PATCH] 2006-07-23 Alex Roitman * 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 --- gramps2/ChangeLog | 17 +++++++++++++++++ .../Filters/Rules/Person/_HasRelationship.py | 2 +- .../src/Filters/Rules/Person/_HaveChildren.py | 2 +- .../src/Filters/Rules/Person/_IsDescendantOf.py | 5 +++-- .../_IsLessThanNthGenerationDescendantOf.py | 5 +++-- .../_IsMoreThanNthGenerationDescendantOf.py | 5 +++-- .../Rules/Person/_IsSiblingOfFilterMatch.py | 6 +++--- .../Rules/Person/_RelationshipPathBetween.py | 6 +++--- gramps2/src/Filters/Rules/__init__.py | 4 ++++ 9 files changed, 38 insertions(+), 14 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 936759b86..7bbec5850 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,20 @@ +2006-07-23 Alex Roitman + * 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 * src/Filters/Rules/Person/__init__.py: add register function * configure.in: bump up version number diff --git a/gramps2/src/Filters/Rules/Person/_HasRelationship.py b/gramps2/src/Filters/Rules/Person/_HasRelationship.py index f7fb3f7ed..2b8e78fc3 100644 --- a/gramps2/src/Filters/Rules/Person/_HasRelationship.py +++ b/gramps2/src/Filters/Rules/Person/_HasRelationship.py @@ -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 diff --git a/gramps2/src/Filters/Rules/Person/_HaveChildren.py b/gramps2/src/Filters/Rules/Person/_HaveChildren.py index eb78d7e97..1a84fbb37 100644 --- a/gramps2/src/Filters/Rules/Person/_HaveChildren.py +++ b/gramps2/src/Filters/Rules/Person/_HaveChildren.py @@ -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 diff --git a/gramps2/src/Filters/Rules/Person/_IsDescendantOf.py b/gramps2/src/Filters/Rules/Person/_IsDescendantOf.py index 9d27452ec..3655f0219 100644 --- a/gramps2/src/Filters/Rules/Person/_IsDescendantOf.py +++ b/gramps2/src/Filters/Rules/Person/_IsDescendantOf.py @@ -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) diff --git a/gramps2/src/Filters/Rules/Person/_IsLessThanNthGenerationDescendantOf.py b/gramps2/src/Filters/Rules/Person/_IsLessThanNthGenerationDescendantOf.py index edce996fd..790128be5 100644 --- a/gramps2/src/Filters/Rules/Person/_IsLessThanNthGenerationDescendantOf.py +++ b/gramps2/src/Filters/Rules/Person/_IsLessThanNthGenerationDescendantOf.py @@ -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) diff --git a/gramps2/src/Filters/Rules/Person/_IsMoreThanNthGenerationDescendantOf.py b/gramps2/src/Filters/Rules/Person/_IsMoreThanNthGenerationDescendantOf.py index 999a4fd70..5b855ae0e 100644 --- a/gramps2/src/Filters/Rules/Person/_IsMoreThanNthGenerationDescendantOf.py +++ b/gramps2/src/Filters/Rules/Person/_IsMoreThanNthGenerationDescendantOf.py @@ -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) diff --git a/gramps2/src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py b/gramps2/src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py index 921ab8cfe..2f4decbc8 100644 --- a/gramps2/src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py +++ b/gramps2/src/Filters/Rules/Person/_IsSiblingOfFilterMatch.py @@ -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 diff --git a/gramps2/src/Filters/Rules/Person/_RelationshipPathBetween.py b/gramps2/src/Filters/Rules/Person/_RelationshipPathBetween.py index 755d5bcc5..663b824f2 100644 --- a/gramps2/src/Filters/Rules/Person/_RelationshipPathBetween.py +++ b/gramps2/src/Filters/Rules/Person/_RelationshipPathBetween.py @@ -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) diff --git a/gramps2/src/Filters/Rules/__init__.py b/gramps2/src/Filters/Rules/__init__.py index 05150121e..b32b44c2a 100644 --- a/gramps2/src/Filters/Rules/__init__.py +++ b/gramps2/src/Filters/Rules/__init__.py @@ -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