* src/plugins/DetAncestralReport.py: Add family Events

* src/plugins/DetDescendantReport.py: Add family Events

svn: r7625
This commit is contained in:
Brian Matherly 2006-11-14 04:39:55 +00:00
parent 06ee27beb3
commit 8330e8dad0
3 changed files with 157 additions and 75 deletions

View File

@ -1,3 +1,7 @@
2006-11-13 Brian Matherly <brian@gramps-project.org>
* src/plugins/DetAncestralReport.py: Add family Events
* src/plugins/DetDescendantReport.py: Add family Events
2006-11-13 Don Allingham <don@gramps-project.org> 2006-11-13 Don Allingham <don@gramps-project.org>
* src/Editors/_EditFamily.py: fix FAM_WIDTH * src/Editors/_EditFamily.py: fix FAM_WIDTH

View File

@ -177,14 +177,16 @@ class DetAncestorReport(Report):
self.gen_handles[person_handle] = key self.gen_handles[person_handle] = key
dupPerson = self.write_person(key) dupPerson = self.write_person(key)
if dupPerson == 0: # Is this a duplicate ind record if dupPerson == 0: # Is this a duplicate ind record
if self.listChildren: if self.listChildren or self.includeEvents:
for family_handle in person.get_family_handle_list(): for family_handle in person.get_family_handle_list():
family = self.database.get_family_from_handle(family_handle) family = self.database.get_family_from_handle(family_handle)
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
if mother_handle == None or \ if mother_handle == None or \
person.get_gender() == RelLib.Person.FEMALE: person.get_gender() == RelLib.Person.FEMALE:
self.write_children(family) if self.listChildren:
self.write_children(family)
if self.includeEvents:
self.write_family_events(family)
if self.includeSources: if self.includeSources:
self.write_endnotes() self.write_endnotes()
@ -298,13 +300,6 @@ class DetAncestorReport(Report):
for event_ref in person.get_event_ref_list(): for event_ref in person.get_event_ref_list():
if event_ref == birth_ref or event_ref == death_ref: if event_ref == birth_ref or event_ref == death_ref:
continue continue
event = self.database.get_event_from_handle(event_ref.ref)
date = DateHandler.get_date(event)
ph = event.get_place_handle()
if ph:
place = self.database.get_place_from_handle(ph).get_title()
else:
place = u''
if first: if first:
self.doc.start_paragraph('DAR-MoreHeader') self.doc.start_paragraph('DAR-MoreHeader')
@ -313,37 +308,47 @@ class DetAncestorReport(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
first = 0 first = 0
self.write_event(event_ref)
self.doc.start_paragraph('DAR-MoreDetails')
evtName = str( event.get_type() )
if date and place:
self.doc.write_text(
_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
'event_name' : _(evtName),
'date' : date,
'endnotes' : self.endnotes(event),
'place' : place })
elif date:
self.doc.write_text(
_('%(event_name)s: %(date)s%(endnotes)s. ') % {
'event_name' : _(evtName),
'endnotes' : self.endnotes(event),
'date' : date})
elif place:
self.doc.write_text(
_('%(event_name)s: %(place)s%(endnotes)s. ') % {
'event_name' : _(evtName),
'endnotes' : self.endnotes(event),
'place' : place })
else:
self.doc.write_text(_('%(event_name)s: ') % {
'event_name' : _(evtName)})
if event.get_description():
self.doc.write_text(event.get_description())
self.doc.end_paragraph()
return 0 # Not duplicate person return 0 # Not duplicate person
def write_event(self, event_ref):
event = self.database.get_event_from_handle(event_ref.ref)
date = DateHandler.get_date(event)
ph = event.get_place_handle()
if ph:
place = self.database.get_place_from_handle(ph).get_title()
else:
place = u''
self.doc.start_paragraph('DAR-MoreDetails')
evtName = str( event.get_type() )
if date and place:
self.doc.write_text(
_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
'event_name' : _(evtName),
'date' : date,
'endnotes' : self.endnotes(event),
'place' : place })
elif date:
self.doc.write_text(
_('%(event_name)s: %(date)s%(endnotes)s. ') % {
'event_name' : _(evtName),
'endnotes' : self.endnotes(event),
'date' : date})
elif place:
self.doc.write_text(
_('%(event_name)s: %(place)s%(endnotes)s. ') % {
'event_name' : _(evtName),
'endnotes' : self.endnotes(event),
'place' : place })
else:
self.doc.write_text(_('%(event_name)s: ') % {
'event_name' : _(evtName)})
if event.get_description():
self.doc.write_text(event.get_description())
self.doc.end_paragraph()
def write_parents(self, person, firstName): def write_parents(self, person, firstName):
family_handle = person.get_main_parents_family_handle() family_handle = person.get_main_parents_family_handle()
if family_handle: if family_handle:
@ -447,6 +452,37 @@ class DetAncestorReport(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
def write_family_events(self,family):
if not family.get_event_ref_list():
return
mother_handle = family.get_mother_handle()
if mother_handle:
mother = self.database.get_person_from_handle(mother_handle)
mother_name = _nd.display(mother)
else:
mother_name = _("unknown")
father_handle = family.get_father_handle()
if father_handle:
father = self.database.get_person_from_handle(father_handle)
father_name = _nd.display(father)
else:
father_name = _("unknown")
first = 1
for event_ref in family.get_event_ref_list():
if first:
self.doc.start_paragraph('DAR-MoreHeader')
self.doc.write_text(
_('More about %(mother_name)s and %(father_name)s:') % {
'mother_name' : mother_name,
'father_name' : father_name })
self.doc.end_paragraph()
first = 0
self.write_event(event_ref)
def write_mate(self, mate): def write_mate(self, mate):
"""Output birth, death, parentage, marriage and notes information """ """Output birth, death, parentage, marriage and notes information """
@ -516,9 +552,11 @@ class DetAncestorReport(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
if person_name: if person_name and mate.get_gender()==RelLib.Person.MALE:
if self.listChildren and mate.get_gender()==RelLib.Person.MALE: if self.listChildren:
self.write_children(family) self.write_children(family)
if self.includeEvents:
self.write_family_events(family)
def calc_age(self,ind): def calc_age(self,ind):
""" """

View File

@ -208,10 +208,13 @@ class DetDescendantReport(Report):
self.gen_handles[person_handle] = key self.gen_handles[person_handle] = key
dupPerson = self.write_person(key) dupPerson = self.write_person(key)
if dupPerson == 0: # Is this a duplicate ind record if dupPerson == 0: # Is this a duplicate ind record
if self.listChildren: if self.listChildren or self.includeEvents:
for family_handle in person.get_family_handle_list(): for family_handle in person.get_family_handle_list():
family = self.database.get_family_from_handle(family_handle) family = self.database.get_family_from_handle(family_handle)
self.write_children(family) if self.listChildren:
self.write_children(family)
if self.includeEvents:
self.write_family_events(family)
if self.includeSources: if self.includeSources:
self.write_endnotes() self.write_endnotes()
@ -326,14 +329,6 @@ class DetDescendantReport(Report):
for event_ref in person.get_event_ref_list(): for event_ref in person.get_event_ref_list():
if event_ref == birth_ref or event_ref == death_ref: if event_ref == birth_ref or event_ref == death_ref:
continue continue
event = self.database.get_event_from_handle(event_ref.ref)
date = DateHandler.get_date(event)
ename = str( event.get_type() )
place_handle = event.get_place_handle()
if place_handle:
place = self.database.get_place_from_handle(place_handle).get_title()
else:
place = u''
if first: if first:
self.doc.start_paragraph('DDR-MoreHeader') self.doc.start_paragraph('DDR-MoreHeader')
@ -342,33 +337,47 @@ class DetDescendantReport(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
first = 0 first = 0
self.write_event(event_ref)
self.doc.start_paragraph('DDR-MoreDetails')
if date and place:
self.doc.write_text(_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
'event_name' : ename,
'date' : date,
'endnotes' : self.endnotes(event),
'place' : place })
elif date:
self.doc.write_text(_('%(event_name)s: %(date)s%(endnotes)s. ') % {
'event_name' : ename,
'endnotes' : self.endnotes(event),
'date' : date})
elif place:
self.doc.write_text(_('%(event_name)s: %(place)s%(endnotes)s. ') % {
'event_name' : ename,
'endnotes' : self.endnotes(event),
'place' : place })
else:
self.doc.write_text(_('%(event_name)s: ') % {
'event_name' : ename})
if event.get_description():
self.doc.write_text(event.get_description())
self.doc.end_paragraph()
return 0 # Not duplicate person return 0 # Not duplicate person
def write_event(self, event_ref):
event = self.database.get_event_from_handle(event_ref.ref)
date = DateHandler.get_date(event)
ph = event.get_place_handle()
if ph:
place = self.database.get_place_from_handle(ph).get_title()
else:
place = u''
self.doc.start_paragraph('DDR-MoreDetails')
evtName = str( event.get_type() )
if date and place:
self.doc.write_text(
_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
'event_name' : _(evtName),
'date' : date,
'endnotes' : self.endnotes(event),
'place' : place })
elif date:
self.doc.write_text(
_('%(event_name)s: %(date)s%(endnotes)s. ') % {
'event_name' : _(evtName),
'endnotes' : self.endnotes(event),
'date' : date})
elif place:
self.doc.write_text(
_('%(event_name)s: %(place)s%(endnotes)s. ') % {
'event_name' : _(evtName),
'endnotes' : self.endnotes(event),
'place' : place })
else:
self.doc.write_text(_('%(event_name)s: ') % {
'event_name' : _(evtName)})
if event.get_description():
self.doc.write_text(event.get_description())
self.doc.end_paragraph()
def write_parents(self, person, firstName): def write_parents(self, person, firstName):
family_handle = person.get_main_parents_family_handle() family_handle = person.get_main_parents_family_handle()
if family_handle: if family_handle:
@ -478,6 +487,37 @@ class DetDescendantReport(Report):
self.database, child, 0, self.EMPTY_DATE, self.EMPTY_PLACE)) self.database, child, 0, self.EMPTY_DATE, self.EMPTY_PLACE))
self.doc.end_paragraph() self.doc.end_paragraph()
def write_family_events(self,family):
if not family.get_event_ref_list():
return
mother_handle = family.get_mother_handle()
if mother_handle:
mother = self.database.get_person_from_handle(mother_handle)
mother_name = _nd.display(mother)
else:
mother_name = _("unknown")
father_handle = family.get_father_handle()
if father_handle:
father = self.database.get_person_from_handle(father_handle)
father_name = _nd.display(father)
else:
father_name = _("unknown")
first = 1
for event_ref in family.get_event_ref_list():
if first:
self.doc.start_paragraph('DDR-MoreHeader')
self.doc.write_text(
_('More about %(mother_name)s and %(father_name)s:') % {
'mother_name' : mother_name,
'father_name' : father_name })
self.doc.end_paragraph()
first = 0
self.write_event(event_ref)
def write_mate(self, mate): def write_mate(self, mate):
"""Output birth, death, parentage, marriage and notes information """ """Output birth, death, parentage, marriage and notes information """
for family_handle in mate.get_family_handle_list(): for family_handle in mate.get_family_handle_list():