3166: Add source notes to DDR/DAR

svn: r13005
This commit is contained in:
Benny Malengier 2009-08-14 11:28:28 +00:00
parent 30d6eebd0b
commit bd48c356cf
3 changed files with 41 additions and 4 deletions

View File

@ -55,6 +55,13 @@ def add_endnote_styles(style_sheet):
para.set_bottom_margin(0.25) para.set_bottom_margin(0.25)
para.set_description(_('The basic style used for the endnotes reference display.')) para.set_description(_('The basic style used for the endnotes reference display.'))
style_sheet.add_paragraph_style("Endnotes-Ref", para) style_sheet.add_paragraph_style("Endnotes-Ref", para)
para = ParagraphStyle()
para.set(lmargin=1.5)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_description(_('The basic style used for the endnotes notes display.'))
style_sheet.add_paragraph_style("Endnotes-Notes", para)
def cite_source(bibliography, obj): def cite_source(bibliography, obj):
""" """
@ -79,7 +86,7 @@ def cite_source(bibliography, obj):
txt += key txt += key
return txt return txt
def write_endnotes(bibliography, database, doc): def write_endnotes(bibliography, database, doc, printnotes=False):
""" """
Write all the entries in the bibliography as endnotes. Write all the entries in the bibliography as endnotes.
@ -89,6 +96,9 @@ def write_endnotes(bibliography, database, doc):
@type database: GrampsDbBase @type database: GrampsDbBase
@param doc: The document to write the endnotes into. @param doc: The document to write the endnotes into.
@type doc: L{docgen.TextDoc} @type doc: L{docgen.TextDoc}
@param printnotes: Indicate if the notes attached to a source must be
written too.
@type printnotes: bool
""" """
if bibliography.get_citation_count() == 0: if bibliography.get_citation_count() == 0:
return return
@ -127,6 +137,19 @@ def write_endnotes(bibliography, database, doc):
rindex += 1 rindex += 1
doc.end_paragraph() doc.end_paragraph()
if printnotes:
note_list = source.get_note_list()
ind = 1
for notehandle in note_list:
note = database.get_note_from_handle(notehandle)
doc.start_paragraph('Endnotes-Notes')
doc.write_text(_('Note %(ind)d - Type: %(type)s') % {
'ind': ind,
'type': str(note.get_type())})
doc.end_paragraph()
doc.write_styled_note(note.get_styledtext(),
note.get_format(),'Endnotes-Notes')
ind += 1
def _format_source_text(source): def _format_source_text(source):
src_txt = "" src_txt = ""

View File

@ -116,6 +116,7 @@ class DetAncestorReport(Report):
self.inc_events = menu.get_option_by_name('incevents').get_value() self.inc_events = menu.get_option_by_name('incevents').get_value()
self.inc_addr = menu.get_option_by_name('incaddresses').get_value() self.inc_addr = menu.get_option_by_name('incaddresses').get_value()
self.inc_sources = menu.get_option_by_name('incsources').get_value() self.inc_sources = menu.get_option_by_name('incsources').get_value()
self.inc_srcnotes = menu.get_option_by_name('incsrcnotes').get_value()
self.inc_attrs = menu.get_option_by_name('incattrs').get_value() self.inc_attrs = menu.get_option_by_name('incattrs').get_value()
pid = menu.get_option_by_name('pid').get_value() pid = menu.get_option_by_name('pid').get_value()
self.center_person = database.get_person_from_gramps_id(pid) self.center_person = database.get_person_from_gramps_id(pid)
@ -196,7 +197,8 @@ class DetAncestorReport(Report):
if self.inc_events: if self.inc_events:
self.write_family_events(family) self.write_family_events(family)
if self.inc_sources: if self.inc_sources:
Endnotes.write_endnotes(self.bibli,self.database,self.doc) Endnotes.write_endnotes(self.bibli, self.database, self.doc,
printnotes=self.inc_srcnotes)
def write_person(self, key): def write_person(self, key):
"""Output birth, death, parentage, marriage and notes information """ """Output birth, death, parentage, marriage and notes information """
@ -790,7 +792,12 @@ class DetAncestorOptions(MenuReportOptions):
incsources = BooleanOption(_("Include sources"),False) incsources = BooleanOption(_("Include sources"),False)
incsources.set_help(_("Whether to include source references.")) incsources.set_help(_("Whether to include source references."))
menu.add_option(category_name,"incsources",incsources) menu.add_option(category_name,"incsources",incsources)
incsrcnotes = BooleanOption(_("Include sources notes"), False)
incsrcnotes.set_help(_("Whether to include source notes in the "
"Endnotes section. Only works if Include sources is selected."))
menu.add_option(category_name, "incsrcnotes", incsrcnotes)
category_name = _("Missing information") category_name = _("Missing information")
repplace = BooleanOption(_("Replace missing places with ______"),False) repplace = BooleanOption(_("Replace missing places with ______"),False)

View File

@ -121,6 +121,7 @@ class DetDescendantReport(Report):
self.inc_events = menu.get_option_by_name('incevents').get_value() self.inc_events = menu.get_option_by_name('incevents').get_value()
self.inc_addr = menu.get_option_by_name('incaddresses').get_value() self.inc_addr = menu.get_option_by_name('incaddresses').get_value()
self.inc_sources = menu.get_option_by_name('incsources').get_value() self.inc_sources = menu.get_option_by_name('incsources').get_value()
self.inc_srcnotes = menu.get_option_by_name('incsrcnotes').get_value()
self.inc_mates = menu.get_option_by_name('incmates').get_value() self.inc_mates = menu.get_option_by_name('incmates').get_value()
self.inc_attrs = menu.get_option_by_name('incattrs').get_value() self.inc_attrs = menu.get_option_by_name('incattrs').get_value()
self.inc_paths = menu.get_option_by_name('incpaths').get_value() self.inc_paths = menu.get_option_by_name('incpaths').get_value()
@ -235,7 +236,8 @@ class DetDescendantReport(Report):
self.write_person(key) self.write_person(key)
if self.inc_sources: if self.inc_sources:
Endnotes.write_endnotes(self.bibli, self.database, self.doc) Endnotes.write_endnotes(self.bibli, self.database, self.doc,
printnotes=self.inc_srcnotes)
def write_path(self, person): def write_path(self, person):
path = [] path = []
@ -819,6 +821,11 @@ class DetDescendantOptions(MenuReportOptions):
incsources = BooleanOption(_("Include sources"), False) incsources = BooleanOption(_("Include sources"), False)
incsources.set_help(_("Whether to include source references.")) incsources.set_help(_("Whether to include source references."))
menu.add_option(category_name, "incsources", incsources) menu.add_option(category_name, "incsources", incsources)
incsrcnotes = BooleanOption(_("Include sources notes"), False)
incsrcnotes.set_help(_("Whether to include source notes in the "
"Endnotes section. Only works if Include sources is selected."))
menu.add_option(category_name, "incsrcnotes", incsrcnotes)
incmates = BooleanOption(_("Include spouses"), False) incmates = BooleanOption(_("Include spouses"), False)
incmates.set_help(_("Whether to include detailed spouse information.")) incmates.set_help(_("Whether to include detailed spouse information."))