3166: Add source notes to DDR/DAR
svn: r13005
This commit is contained in:
parent
30d6eebd0b
commit
bd48c356cf
@ -56,6 +56,13 @@ def add_endnote_styles(style_sheet):
|
||||
para.set_description(_('The basic style used for the endnotes reference display.'))
|
||||
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):
|
||||
"""
|
||||
Cite any sources for the object and add them to the bibliography.
|
||||
@ -79,7 +86,7 @@ def cite_source(bibliography, obj):
|
||||
txt += key
|
||||
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.
|
||||
|
||||
@ -89,6 +96,9 @@ def write_endnotes(bibliography, database, doc):
|
||||
@type database: GrampsDbBase
|
||||
@param doc: The document to write the endnotes into.
|
||||
@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:
|
||||
return
|
||||
@ -127,6 +137,19 @@ def write_endnotes(bibliography, database, doc):
|
||||
|
||||
rindex += 1
|
||||
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):
|
||||
src_txt = ""
|
||||
|
@ -116,6 +116,7 @@ class DetAncestorReport(Report):
|
||||
self.inc_events = menu.get_option_by_name('incevents').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_srcnotes = menu.get_option_by_name('incsrcnotes').get_value()
|
||||
self.inc_attrs = menu.get_option_by_name('incattrs').get_value()
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
self.center_person = database.get_person_from_gramps_id(pid)
|
||||
@ -196,7 +197,8 @@ class DetAncestorReport(Report):
|
||||
if self.inc_events:
|
||||
self.write_family_events(family)
|
||||
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):
|
||||
"""Output birth, death, parentage, marriage and notes information """
|
||||
@ -791,6 +793,11 @@ class DetAncestorOptions(MenuReportOptions):
|
||||
incsources.set_help(_("Whether to include source references."))
|
||||
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")
|
||||
|
||||
repplace = BooleanOption(_("Replace missing places with ______"),False)
|
||||
|
@ -121,6 +121,7 @@ class DetDescendantReport(Report):
|
||||
self.inc_events = menu.get_option_by_name('incevents').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_srcnotes = menu.get_option_by_name('incsrcnotes').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_paths = menu.get_option_by_name('incpaths').get_value()
|
||||
@ -235,7 +236,8 @@ class DetDescendantReport(Report):
|
||||
self.write_person(key)
|
||||
|
||||
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):
|
||||
path = []
|
||||
@ -820,6 +822,11 @@ class DetDescendantOptions(MenuReportOptions):
|
||||
incsources.set_help(_("Whether to include source references."))
|
||||
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.set_help(_("Whether to include detailed spouse information."))
|
||||
menu.add_option(category_name, "incmates", incmates)
|
||||
|
Loading…
Reference in New Issue
Block a user