2003-06-26 Tim Waugh <twaugh@redhat.com>
* src/plugins/Ancestors.py: Cite sources. svn: r1787
This commit is contained in:
parent
ead36bfe38
commit
9d7ad535e3
@ -1,3 +1,6 @@
|
|||||||
|
2003-06-26 Tim Waugh <twaugh@redhat.com>
|
||||||
|
* src/plugins/Ancestors.py: Cite sources.
|
||||||
|
|
||||||
2003-06-26 Don Allingham <dallingham@users.sourceforge.net>
|
2003-06-26 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
* src/plugins/Makefile.am: Added BookReport.py
|
* src/plugins/Makefile.am: Added BookReport.py
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ class AncestorsReport (Report.Report):
|
|||||||
self.max_generations = max
|
self.max_generations = max
|
||||||
self.pgbrk = pgbrk
|
self.pgbrk = pgbrk
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
|
self.sources = []
|
||||||
|
|
||||||
table = TextDoc.TableStyle ()
|
table = TextDoc.TableStyle ()
|
||||||
table.set_column_widths ([15, 85])
|
table.set_column_widths ([15, 85])
|
||||||
@ -98,17 +99,16 @@ class AncestorsReport (Report.Report):
|
|||||||
self.standalone = 0
|
self.standalone = 0
|
||||||
if newpage:
|
if newpage:
|
||||||
self.doc.page_break()
|
self.doc.page_break()
|
||||||
self.sref_map = {}
|
|
||||||
self.sref_index = 1
|
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
|
self.sources = []
|
||||||
name = self.person_name (self.start)
|
name = self.person_name (self.start)
|
||||||
self.doc.start_paragraph("Title")
|
self.doc.start_paragraph("Title")
|
||||||
title = _("Ancestors of %s") % name
|
title = _("Ancestors of %s") % name
|
||||||
self.doc.write_text(title)
|
self.doc.write_text(title)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
self.doc.start_paragraph ("Generation")
|
self.doc.start_paragraph ("Heading")
|
||||||
self.doc.write_text ("Generation 1")
|
self.doc.write_text ("Generation 1")
|
||||||
self.doc.end_paragraph ()
|
self.doc.end_paragraph ()
|
||||||
|
|
||||||
@ -118,6 +118,19 @@ class AncestorsReport (Report.Report):
|
|||||||
if len (families) > 0:
|
if len (families) > 0:
|
||||||
self.generation (self.max_generations, families, [self.start])
|
self.generation (self.max_generations, families, [self.start])
|
||||||
|
|
||||||
|
if len (self.sources) > 0:
|
||||||
|
self.doc.start_paragraph ("Heading")
|
||||||
|
self.doc.write_text ("Sources")
|
||||||
|
self.doc.end_paragraph ()
|
||||||
|
|
||||||
|
self.doc.start_paragraph ("Entry")
|
||||||
|
i = 1
|
||||||
|
for source in self.sources:
|
||||||
|
self.doc.write_text ("[%d] %s\n" % (i, source.getTitle ()))
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
self.doc.end_paragraph ()
|
||||||
|
|
||||||
if self.standalone:
|
if self.standalone:
|
||||||
self.doc.close()
|
self.doc.close()
|
||||||
return
|
return
|
||||||
@ -181,7 +194,7 @@ class AncestorsReport (Report.Report):
|
|||||||
if len (people):
|
if len (people):
|
||||||
if self.pgbrk:
|
if self.pgbrk:
|
||||||
self.doc.page_break()
|
self.doc.page_break()
|
||||||
self.doc.start_paragraph ("Generation")
|
self.doc.start_paragraph ("Heading")
|
||||||
self.doc.write_text ("Generation %d" % thisgen)
|
self.doc.write_text ("Generation %d" % thisgen)
|
||||||
self.doc.end_paragraph ()
|
self.doc.end_paragraph ()
|
||||||
self.write_paragraphs (people)
|
self.write_paragraphs (people)
|
||||||
@ -350,6 +363,7 @@ class AncestorsReport (Report.Report):
|
|||||||
if note:
|
if note:
|
||||||
info += ' (' + note + ')'
|
info += ' (' + note + ')'
|
||||||
|
|
||||||
|
info += self.cite_sources (event.getSourceRefList ())
|
||||||
return info
|
return info
|
||||||
|
|
||||||
def long_born_died (self, person):
|
def long_born_died (self, person):
|
||||||
@ -427,6 +441,19 @@ class AncestorsReport (Report.Report):
|
|||||||
|
|
||||||
return 'Mr.'
|
return 'Mr.'
|
||||||
|
|
||||||
|
def cite_sources (self, sourcereflist):
|
||||||
|
citation = ""
|
||||||
|
for ref in sourcereflist:
|
||||||
|
source = ref.getBase ()
|
||||||
|
if source in self.sources:
|
||||||
|
citation += "[%d]" % (self.sources.index (source) + 1)
|
||||||
|
continue
|
||||||
|
|
||||||
|
self.sources.append (source)
|
||||||
|
citation += "[%d]" % len (self.sources)
|
||||||
|
|
||||||
|
return citation
|
||||||
|
|
||||||
def person_name (self, person):
|
def person_name (self, person):
|
||||||
primary = person.getPrimaryName ()
|
primary = person.getPrimaryName ()
|
||||||
|
|
||||||
@ -456,6 +483,7 @@ class AncestorsReport (Report.Report):
|
|||||||
if type != 'Birth Name':
|
if type != 'Birth Name':
|
||||||
name += ' (%s)' % type
|
name += ' (%s)' % type
|
||||||
|
|
||||||
|
name += self.cite_sources (primary.getSourceRefList ())
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def married_whom (self, person, from_family, listing_children = 0):
|
def married_whom (self, person, from_family, listing_children = 0):
|
||||||
@ -482,6 +510,8 @@ class AncestorsReport (Report.Report):
|
|||||||
count = 1
|
count = 1
|
||||||
for child in childlist:
|
for child in childlist:
|
||||||
children += self.first_name_or_nick (child)
|
children += self.first_name_or_nick (child)
|
||||||
|
children += self.cite_sources (child.getPrimaryName ().
|
||||||
|
getSourceRefList ())
|
||||||
if child_count - count > 1:
|
if child_count - count > 1:
|
||||||
children += ', '
|
children += ', '
|
||||||
elif child_count - count == 1:
|
elif child_count - count == 1:
|
||||||
@ -575,7 +605,7 @@ def _make_default_style(self):
|
|||||||
para.set(pad=0.5)
|
para.set(pad=0.5)
|
||||||
para.set_alignment(TextDoc.PARA_ALIGN_CENTER)
|
para.set_alignment(TextDoc.PARA_ALIGN_CENTER)
|
||||||
para.set_description(_('The style used for the generation header.'))
|
para.set_description(_('The style used for the generation header.'))
|
||||||
self.default_style.add_style("Generation",para)
|
self.default_style.add_style("Heading",para)
|
||||||
|
|
||||||
para = TextDoc.ParagraphStyle()
|
para = TextDoc.ParagraphStyle()
|
||||||
para.set(lmargin=1.0,pad=0.25)
|
para.set(lmargin=1.0,pad=0.25)
|
||||||
|
Loading…
Reference in New Issue
Block a user