6519: Add primary role option to event filter
This commit is contained in:
parent
b34391ec2f
commit
aedc453452
@ -167,6 +167,9 @@ class FilterParser(handler.ContentHandler):
|
|||||||
and len(self.a) == 3):
|
and len(self.a) == 3):
|
||||||
self.use_regex = self.a[2] == '1'
|
self.use_regex = self.a[2] == '1'
|
||||||
self.a = self.a[:2]
|
self.a = self.a[:2]
|
||||||
|
# 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')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -51,7 +51,8 @@ class HasEventBase(Rule):
|
|||||||
'Date:',
|
'Date:',
|
||||||
'Place:',
|
'Place:',
|
||||||
'Description:',
|
'Description:',
|
||||||
'Main Participants' ]
|
'Main Participants:',
|
||||||
|
'Primary Role:' ]
|
||||||
name = 'Events matching parameters'
|
name = 'Events matching parameters'
|
||||||
description = "Matches events with particular parameters"
|
description = "Matches events with particular parameters"
|
||||||
category = _('Event filters')
|
category = _('Event filters')
|
||||||
|
@ -51,7 +51,8 @@ class HasEvent(HasEventBase):
|
|||||||
_('Date:'),
|
_('Date:'),
|
||||||
_('Place:'),
|
_('Place:'),
|
||||||
_('Description:'),
|
_('Description:'),
|
||||||
_('Main Participants') ]
|
_('Main Participants:'),
|
||||||
|
_('Primary Role:') ]
|
||||||
name = _('People with the personal <event>')
|
name = _('People with the personal <event>')
|
||||||
description = _("Matches people with a personal event of a particular "
|
description = _("Matches people with a personal event of a particular "
|
||||||
"value")
|
"value")
|
||||||
@ -60,7 +61,7 @@ class HasEvent(HasEventBase):
|
|||||||
for event_ref in person.get_event_ref_list():
|
for event_ref in person.get_event_ref_list():
|
||||||
if not event_ref:
|
if not event_ref:
|
||||||
continue
|
continue
|
||||||
if event_ref.role != EventRoleType.PRIMARY:
|
if int(self.list[5]) and event_ref.role != EventRoleType.PRIMARY:
|
||||||
# Only match primaries, no witnesses
|
# Only match primaries, no witnesses
|
||||||
continue
|
continue
|
||||||
event = dbase.get_event_from_handle(event_ref.ref)
|
event = dbase.get_event_from_handle(event_ref.ref)
|
||||||
|
@ -572,6 +572,8 @@ class EditRule(ManagedWindow):
|
|||||||
elif v == _('Include Family events:'):
|
elif v == _('Include Family events:'):
|
||||||
t = MyBoolean(_('Also family events where person is '
|
t = MyBoolean(_('Also family events where person is '
|
||||||
'wife/husband'))
|
'wife/husband'))
|
||||||
|
elif v == _('Primary Role:'):
|
||||||
|
t = MyBoolean(_('Only include primary participants'))
|
||||||
elif v == _('Tag:'):
|
elif v == _('Tag:'):
|
||||||
taglist = ['']
|
taglist = ['']
|
||||||
taglist = taglist + [tag.get_name() for tag in dbstate.db.iter_tags()]
|
taglist = taglist + [tag.get_name() for tag in dbstate.db.iter_tags()]
|
||||||
|
Loading…
Reference in New Issue
Block a user