* src/Filters/Rules/Person/_HasBirth.py,
* src/Filters/Rules/Person/_HasDeath.py, * src/Filters/Rules/Person/_HasEvent.py: Only match filter if event role = primary * src/RelLib/_Person.py (_remove_handle_references): Correct removing of person handle reference; (get_sourcref_child_list) Add self.person_ref_list because they link to persons and sources * src/DataViews/_PersonView.py (delete_person_response): Remove person from other persons as well because of PersonRef. svn: r7607
This commit is contained in:
parent
fdc47b78cc
commit
11f51cec0f
@ -4,6 +4,16 @@
|
|||||||
* src/DataViews/_RelationView.py,
|
* src/DataViews/_RelationView.py,
|
||||||
* src/DisplayModels/_PeopleModel.py: Only show fallbacks for birth
|
* src/DisplayModels/_PeopleModel.py: Only show fallbacks for birth
|
||||||
and death if role=primary
|
and death if role=primary
|
||||||
|
* src/Filters/Rules/Person/_HasBirth.py,
|
||||||
|
* src/Filters/Rules/Person/_HasDeath.py,
|
||||||
|
* src/Filters/Rules/Person/_HasEvent.py: Only match filter if
|
||||||
|
event role = primary
|
||||||
|
* src/RelLib/_Person.py (_remove_handle_references): Correct removing
|
||||||
|
of person handle reference; (get_sourcref_child_list) Add
|
||||||
|
self.person_ref_list because they link to persons and sources
|
||||||
|
* src/DataViews/_PersonView.py (delete_person_response): Remove
|
||||||
|
person from other persons as well because of PersonRef.
|
||||||
|
|
||||||
|
|
||||||
2006-11-09 Alex Roitman <shura@gramps-project.org>
|
2006-11-09 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/Filters/Rules/Person/_HasDeath.py (apply): Match any of the
|
* src/Filters/Rules/Person/_HasDeath.py (apply): Match any of the
|
||||||
|
@ -588,6 +588,15 @@ class PersonView(PageView.PersonNavView):
|
|||||||
|
|
||||||
handle = self.active_person.get_handle()
|
handle = self.active_person.get_handle()
|
||||||
|
|
||||||
|
person_list = [ phandle for phandle in self.dbstate.db.get_person_handles(False)
|
||||||
|
if self.dbstate.db.get_person_from_handle(phandle).has_handle_reference('Person',handle) ]
|
||||||
|
print "_PersonView.delete_person_response"
|
||||||
|
print person_list
|
||||||
|
for phandle in person_list:
|
||||||
|
person = self.dbstate.db.get_person_from_handle(phandle)
|
||||||
|
person.remove_handle_references('Person',handle)
|
||||||
|
self.dbstate.db.commit_person(person,trans)
|
||||||
|
|
||||||
person = self.active_person
|
person = self.active_person
|
||||||
self.remove_from_person_list(person)
|
self.remove_from_person_list(person)
|
||||||
self.dbstate.db.remove_person(handle, trans)
|
self.dbstate.db.remove_person(handle, trans)
|
||||||
|
@ -33,7 +33,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import DateHandler
|
import DateHandler
|
||||||
from RelLib import EventType
|
from RelLib import EventType,EventRoleType
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules._Rule import Rule
|
||||||
from Filters.Rules._RuleUtils import loose_date_cmp
|
from Filters.Rules._RuleUtils import loose_date_cmp
|
||||||
|
|
||||||
@ -59,6 +59,9 @@ class HasBirth(Rule):
|
|||||||
|
|
||||||
def apply(self,db,person):
|
def apply(self,db,person):
|
||||||
for event_ref in person.get_event_ref_list():
|
for event_ref in person.get_event_ref_list():
|
||||||
|
if event_ref.role != EventRoleType.PRIMARY:
|
||||||
|
# Only match primaries, no witnesses
|
||||||
|
continue
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
if event.get_type() != EventType.BIRTH:
|
if event.get_type() != EventType.BIRTH:
|
||||||
# No match: wrong type
|
# No match: wrong type
|
||||||
|
@ -33,7 +33,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import DateHandler
|
import DateHandler
|
||||||
from RelLib import EventType
|
from RelLib import EventType,EventRoleType
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules._Rule import Rule
|
||||||
from Filters.Rules._RuleUtils import loose_date_cmp
|
from Filters.Rules._RuleUtils import loose_date_cmp
|
||||||
|
|
||||||
@ -59,6 +59,9 @@ class HasDeath(Rule):
|
|||||||
|
|
||||||
def apply(self,db,person):
|
def apply(self,db,person):
|
||||||
for event_ref in person.get_event_ref_list():
|
for event_ref in person.get_event_ref_list():
|
||||||
|
if event_ref.role != EventRoleType.PRIMARY:
|
||||||
|
# Only match primaries, no witnesses
|
||||||
|
continue
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
if event.get_type() != EventType.DEATH:
|
if event.get_type() != EventType.DEATH:
|
||||||
# No match: wrong type
|
# No match: wrong type
|
||||||
|
@ -32,6 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
from RelLib import EventRoleType
|
||||||
from Filters.Rules._HasEventBase import HasEventBase
|
from Filters.Rules._HasEventBase import HasEventBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -53,6 +54,9 @@ 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:
|
||||||
|
# Only match primaries, no witnesses
|
||||||
|
continue
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
if HasEventBase.apply(self,db,event):
|
if HasEventBase.apply(self,db,event):
|
||||||
return True
|
return True
|
||||||
|
@ -233,7 +233,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
|||||||
self.event_ref_list = new_list
|
self.event_ref_list = new_list
|
||||||
elif classname == 'Person':
|
elif classname == 'Person':
|
||||||
new_list = [ref for ref in self.person_ref_list
|
new_list = [ref for ref in self.person_ref_list
|
||||||
if ref not in handle_list]
|
if ref.ref not in handle_list]
|
||||||
self.person_ref_list = new_list
|
self.person_ref_list = new_list
|
||||||
elif classname == 'Family':
|
elif classname == 'Family':
|
||||||
new_list = [ handle for handle in self.family_list
|
new_list = [ handle for handle in self.family_list
|
||||||
@ -308,7 +308,8 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
|||||||
"""
|
"""
|
||||||
return [self.primary_name] + self.media_list + \
|
return [self.primary_name] + self.media_list + \
|
||||||
self.alternate_names + self.address_list + \
|
self.alternate_names + self.address_list + \
|
||||||
self.attribute_list + self.lds_ord_list
|
self.attribute_list + self.lds_ord_list + \
|
||||||
|
self.person_ref_list
|
||||||
|
|
||||||
def get_referenced_handles(self):
|
def get_referenced_handles(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user