From 23a0a492d4892de6143c0da6b3b5e94d1a5edd90 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Mon, 23 May 2016 15:20:37 +0100 Subject: [PATCH] 9427: Add inclusive option to IsEnclosedBy rule --- gramps/gen/filters/_filterparser.py | 3 +++ gramps/gen/filters/rules/place/_isenclosedby.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gramps/gen/filters/_filterparser.py b/gramps/gen/filters/_filterparser.py index 42cdd4212..a59b55cf8 100644 --- a/gramps/gen/filters/_filterparser.py +++ b/gramps/gen/filters/_filterparser.py @@ -166,6 +166,9 @@ class FilterParser(handler.ContentHandler): # HasEvent rule has extra primary role field in v3.4.7 if self.r == rules.person.HasEvent and len(self.a) == 5: self.a.append('1') + # IsEnclosedBy rule has extra inclusive field in v4.2.4 + if self.r == rules.place.IsEnclosedBy and len(self.a) == 1: + self.a.append('0') #------------------------------------------------------------------------- # diff --git a/gramps/gen/filters/rules/place/_isenclosedby.py b/gramps/gen/filters/rules/place/_isenclosedby.py index 6c445ebf0..c6408b1ed 100644 --- a/gramps/gen/filters/rules/place/_isenclosedby.py +++ b/gramps/gen/filters/rules/place/_isenclosedby.py @@ -45,7 +45,7 @@ class IsEnclosedBy(Rule): Rule that checks for a place enclosed by another place """ - labels = [_('ID:')] + labels = [_('ID:'), _('Inclusive:')] name = _('Places enclosed by another place') description = _('Matches a place enclosed by a particular place') category = _('General filters') @@ -59,6 +59,8 @@ class IsEnclosedBy(Rule): def apply(self, db, place): if self.handle is None: return False + if self.list[1] == '1' and place.handle == self.handle: + return True if located_in(db, place.handle, self.handle): return True return False