Add attributes to the detailed ancestral report.

svn: r8811
This commit is contained in:
Brian Matherly 2007-08-12 03:34:28 +00:00
parent c418492d5b
commit d3f3b050ce
2 changed files with 45 additions and 0 deletions

View File

@ -1,3 +1,6 @@
2007-08-11 Brian Matherly <brian@gramps-project.org>
* src/plugins/DetAncestralReport.py: Add attributes
2007-08-11 Brian Matherly <brian@gramps-project.org>
* src/plugins/NarrativeWeb.py: Add event attributes

View File

@ -88,6 +88,7 @@ class DetAncestorReport(Report):
fullDate - Whether to use full dates instead of just year.
listChildren - Whether to list children.
includeNotes - Whether to include notes.
includeAttrs - Whether to include attributes
blankPlace - Whether to replace missing Places with ___________.
blankDate - Whether to replace missing Dates with ___________.
calcAgeFlag - Whether to compute age.
@ -115,6 +116,7 @@ class DetAncestorReport(Report):
self.includeEvents = options_class.handler.options_dict['incevents']
self.includeAddr = options_class.handler.options_dict['incaddresses']
self.includeSources= options_class.handler.options_dict['incsources']
self.includeAttrs = options_class.handler.options_dict['incattrs']
self.gen_handles = {}
self.prev_gen_handles= {}
@ -331,6 +333,24 @@ class DetAncestorReport(Report):
self.doc.write_text( self.endnotes(addr) )
self.doc.end_paragraph()
if self.includeAttrs:
attrs = person.get_attribute_list()
if first and attrs:
self.doc.start_paragraph('DAR-MoreHeader')
self.doc.write_text(_('More about %(person_name)s:') % {
'person_name' : name })
self.doc.end_paragraph()
first = False
for attr in attrs:
self.doc.start_paragraph('DAR-MoreDetails')
text = _("%(type)s: %(value)s%(endnotes)s") % {
'type' : attr.get_type(),
'value' : attr.get_value(),
'endnotes' : self.endnotes(attr) }
self.doc.write_text( text )
self.doc.end_paragraph()
return 0 # Not duplicate person
def write_event(self, event_ref):
@ -370,6 +390,18 @@ class DetAncestorReport(Report):
text += _('%(endnotes)s.') % { 'endnotes' : self.endnotes(event) }
self.doc.write_text(text)
if self.includeAttrs:
text = ""
for attr in event.get_attribute_list():
if text:
text += "; "
text += _("%(type)s: %(value)s%(endnotes)s") % {
'type' : attr.get_type(),
'value' : attr.get_value(),
'endnotes' : self.endnotes(attr) }
self.doc.write_text(text)
self.doc.end_paragraph()
def write_parents(self, person, firstName):
@ -628,6 +660,7 @@ class DetAncestorOptions(ReportOptions):
'fulldates' : 1,
'listc' : 1,
'incnotes' : 1,
'incattrs' : 0,
'usecall' : 1,
'repplace' : 0,
'repdate' : 0,
@ -656,6 +689,9 @@ class DetAncestorOptions(ReportOptions):
'incnotes' : ("=0/1","Whether to include notes.",
["Do not include notes","Include notes"],
True),
'incattrs' : ("=0/1","Whether to include attributes.",
["Do not include attributes","Include attributes"],
True),
'usecall' : ("=0/1","Whether to use the call name as the first name.",
["Do not use call name","Use call name"],
True),
@ -802,6 +838,10 @@ class DetAncestorOptions(ReportOptions):
self.include_notes_option = gtk.CheckButton(_("Include notes"))
self.include_notes_option.set_active(self.options_dict['incnotes'])
# Print attributes
self.include_attributes_option = gtk.CheckButton(_("Include attributes"))
self.include_attributes_option.set_active(self.options_dict['incattrs'])
# Print callname
self.usecall = gtk.CheckButton(_("Use callname for common name"))
self.usecall.set_active(self.options_dict['usecall'])
@ -859,6 +899,7 @@ class DetAncestorOptions(ReportOptions):
dialog.add_frame_option(_('Content'),'',self.childRef_option)
dialog.add_frame_option(_('Include'),'',self.image_option)
dialog.add_frame_option(_('Include'),'',self.include_notes_option)
dialog.add_frame_option(_('Include'),'',self.include_attributes_option)
dialog.add_frame_option(_('Include'),'',self.include_names_option)
dialog.add_frame_option(_('Include'),'',self.include_events_option)
dialog.add_frame_option(_('Include'),'',self.include_addresses_option)
@ -875,6 +916,7 @@ class DetAncestorOptions(ReportOptions):
self.options_dict['fulldates'] = int(self.full_date_option.get_active())
self.options_dict['listc'] = int(self.list_children_option.get_active())
self.options_dict['incnotes'] = int(self.include_notes_option.get_active())
self.options_dict['incattrs'] = int(self.include_attributes_option.get_active())
self.options_dict['usecall'] = int(self.usecall.get_active())
self.options_dict['repplace'] = int(self.place_option.get_active())
self.options_dict['repdate'] = int(self.date_option.get_active())