4921: Want a "Main Participants" entry in sidebar eventfilter; cleanup
svn: r17549
This commit is contained in:
parent
521b8fa98d
commit
c07c19dfe3
@ -20,6 +20,9 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Filter rule to match families with a particular event.
|
||||||
|
"""
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Standard Python modules
|
# Standard Python modules
|
||||||
@ -45,15 +48,16 @@ class HasEvent(HasEventBase):
|
|||||||
labels = [ _('Family event:'),
|
labels = [ _('Family event:'),
|
||||||
_('Date:'),
|
_('Date:'),
|
||||||
_('Place:'),
|
_('Place:'),
|
||||||
_('Description:') ]
|
_('Description:'),
|
||||||
|
_('Main Participants') ]
|
||||||
name = _('Families with the <event>')
|
name = _('Families with the <event>')
|
||||||
description = _("Matches families with an event of a particular value")
|
description = _("Matches families with an event of a particular value")
|
||||||
|
|
||||||
def apply(self,db,family):
|
def apply(self, dbase, family):
|
||||||
for event_ref in family.get_event_ref_list():
|
for event_ref in family.get_event_ref_list():
|
||||||
if not event_ref:
|
if not event_ref:
|
||||||
continue
|
continue
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = dbase.get_event_from_handle(event_ref.ref)
|
||||||
if HasEventBase.apply(self,db,event):
|
if HasEventBase.apply(self, dbase, event):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -37,7 +37,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# HasEvent
|
# HasMedia
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasMedia(Rule):
|
class HasMedia(Rule):
|
||||||
|
@ -37,7 +37,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# HasEvent
|
# HasNote
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasNote(Rule):
|
class HasNote(Rule):
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Filter rule to match persons with a particular event.
|
||||||
|
"""
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Standard Python modules
|
# Standard Python modules
|
||||||
@ -46,18 +49,20 @@ class HasEvent(HasEventBase):
|
|||||||
labels = [ _('Personal event:'),
|
labels = [ _('Personal event:'),
|
||||||
_('Date:'),
|
_('Date:'),
|
||||||
_('Place:'),
|
_('Place:'),
|
||||||
_('Description:') ]
|
_('Description:'),
|
||||||
|
_('Main Participants') ]
|
||||||
name = _('People with the personal <event>')
|
name = _('People with the personal <event>')
|
||||||
description = _("Matches people with a personal event of a particular value")
|
description = _("Matches people with a personal event of a particular "
|
||||||
|
"value")
|
||||||
|
|
||||||
def apply(self,db,person):
|
def apply(self, dbase, person):
|
||||||
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 event_ref.role != EventRoleType.PRIMARY:
|
||||||
# Only match primaries, no witnesses
|
# Only match primaries, no witnesses
|
||||||
continue
|
continue
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = dbase.get_event_from_handle(event_ref.ref)
|
||||||
if HasEventBase.apply(self,db,event):
|
if HasEventBase.apply(self, dbase, event):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -38,7 +38,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# HasEvent
|
# HasPlace
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasPlace(Rule):
|
class HasPlace(Rule):
|
||||||
|
@ -37,7 +37,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# HasEvent
|
# HasRepo
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasRepo(Rule):
|
class HasRepo(Rule):
|
||||||
|
@ -36,7 +36,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# HasEvent
|
# HasSource
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasSource(Rule):
|
class HasSource(Rule):
|
||||||
|
@ -39,7 +39,7 @@ from Utils import get_participant_from_event
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# HasEvent
|
# HasEventBase
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasEventBase(Rule):
|
class HasEventBase(Rule):
|
||||||
|
@ -177,7 +177,7 @@ class FamilySidebarFilter(SidebarFilter):
|
|||||||
generic_filter.add_rule(rule)
|
generic_filter.add_rule(rule)
|
||||||
|
|
||||||
if etype:
|
if etype:
|
||||||
rule = HasEvent([etype, u'', u'', u''])
|
rule = HasEvent([etype, u'', u'', u'', u''])
|
||||||
generic_filter.add_rule(rule)
|
generic_filter.add_rule(rule)
|
||||||
|
|
||||||
if rtype:
|
if rtype:
|
||||||
|
@ -206,7 +206,7 @@ class PersonSidebarFilter(SidebarFilter):
|
|||||||
|
|
||||||
# Build an event filter if needed
|
# Build an event filter if needed
|
||||||
if etype:
|
if etype:
|
||||||
rule = HasEvent([etype, u'', u'', u''])
|
rule = HasEvent([etype, u'', u'', u'', u''])
|
||||||
generic_filter.add_rule(rule)
|
generic_filter.add_rule(rule)
|
||||||
|
|
||||||
# Build birth event filter if needed
|
# Build birth event filter if needed
|
||||||
|
Loading…
Reference in New Issue
Block a user