9427: Add inclusive option to IsEnclosedBy rule

This commit is contained in:
Nick Hall 2016-05-23 15:20:37 +01:00
parent df55780880
commit 57a963d0b2
3 changed files with 7 additions and 2 deletions

View File

@ -166,6 +166,9 @@ class FilterParser(handler.ContentHandler):
# HasEvent rule has extra primary role field in v3.4.7 # HasEvent rule has extra primary role field in v3.4.7
if self.r == rules.person.HasEvent and len(self.a) == 5: if self.r == rules.person.HasEvent and len(self.a) == 5:
self.a.append('1') 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')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -45,7 +45,7 @@ class IsEnclosedBy(Rule):
Rule that checks for a place enclosed by another place Rule that checks for a place enclosed by another place
""" """
labels = [_('ID:')] labels = [_('ID:'), _('Inclusive:')]
name = _('Places enclosed by another place') name = _('Places enclosed by another place')
description = _('Matches a place enclosed by a particular place') description = _('Matches a place enclosed by a particular place')
category = _('General filters') category = _('General filters')
@ -59,6 +59,8 @@ class IsEnclosedBy(Rule):
def apply(self, db, place): def apply(self, db, place):
if self.handle is None: if self.handle is None:
return False return False
if self.list[1] == '1' and place.handle == self.handle:
return True
if located_in(db, place.handle, self.handle): if located_in(db, place.handle, self.handle):
return True return True
return False return False

View File

@ -559,7 +559,7 @@ class EditRule(ManagedWindow):
key=lambda s: s.lower()) key=lambda s: s.lower())
t = MySelect(_name2typeclass[v], additional) t = MySelect(_name2typeclass[v], additional)
elif v == _('Inclusive:'): elif v == _('Inclusive:'):
t = MyBoolean(_('Include original person')) t = MyBoolean(_('Include selected Gramps ID'))
elif v == _('Case sensitive:'): elif v == _('Case sensitive:'):
t = MyBoolean(_('Use exact case of letters')) t = MyBoolean(_('Use exact case of letters'))
elif v == _('Regular-Expression matching:'): elif v == _('Regular-Expression matching:'):