Remove relationships and places from EOL report.

svn: r8798
This commit is contained in:
Brian Matherly 2007-08-03 04:00:28 +00:00
parent 6480123e0f
commit d478c1a42d
2 changed files with 23 additions and 116 deletions

View File

@ -1,3 +1,6 @@
2007-08-02 Brian Matherly <brian@gramps-project.org>
* src/plugins/EndOfLineReport.py: Remove relationships and places
2007-08-01 Brian Matherly <brian@gramps-project.org> 2007-08-01 Brian Matherly <brian@gramps-project.org>
* src/plugins/IndivComplete.py: Reset bibliography between people. * src/plugins/IndivComplete.py: Reset bibliography between people.

View File

@ -34,11 +34,10 @@ from gettext import gettext as _
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from PluginUtils import register_report, relationship_class from PluginUtils import register_report
from ReportBase import Report, ReportUtils, ReportOptions, \ from ReportBase import Report, ReportUtils, ReportOptions, \
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
import BaseDoc import BaseDoc
from Filters import GenericFilterFactory, Rules
from BasicUtils import name_displayer from BasicUtils import name_displayer
import DateHandler import DateHandler
@ -66,16 +65,6 @@ class EndOfLineReport(Report):
Report.__init__(self,database,person,options_class) Report.__init__(self,database,person,options_class)
self.person = person self.person = person
plist = self.database.get_person_handles(sort_handles=False)
FilterClass = GenericFilterFactory('Person')
filter = FilterClass()
gid = person.get_gramps_id()
filter.add_rule(Rules.Person.IsAncestorOf([gid,1]))
filter.add_rule(Rules.Person.MissingParent([]))
self.ind_list = filter.apply(self.database,plist)
self.relationship = relationship_class(self.database)
# eol_map is a map whose: # eol_map is a map whose:
# keys are the generations of the people # keys are the generations of the people
@ -148,50 +137,21 @@ class EndOfLineReport(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.start_table('EolTable','EOL-Table') self.doc.start_table('EolTable','EOL-Table')
# self.write_collumn_header()
for generation in self.eol_map.keys(): for generation in self.eol_map.keys():
self.write_generation_row(generation) self.write_generation_row(generation)
for person_handle in self.eol_map[generation].keys(): for person_handle in self.eol_map[generation].keys():
self.write_person_row(person_handle) self.write_person_row(person_handle)
self.write_relationship_row(person_handle)
for pedigree in self.eol_map[generation][person_handle]: for pedigree in self.eol_map[generation][person_handle]:
self.write_pedigree_row(pedigree) self.write_pedigree_row(pedigree)
self.doc.end_table() self.doc.end_table()
def write_collumn_header(self):
"""
Write out a row in the table with the collumn headings.
"""
self.doc.start_row()
self.doc.start_cell('EOL-TableCell')
self.doc.start_paragraph('EOL-Normal-Bold')
self.doc.write_text(_("Name"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('EOL-TableCell')
self.doc.start_paragraph('EOL-Normal-Bold')
self.doc.write_text(_("Birth"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('EOL-TableCell')
self.doc.start_paragraph('EOL-Normal-Bold')
self.doc.write_text(_("Death"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.end_row()
def write_generation_row(self,generation): def write_generation_row(self,generation):
""" """
Write out a row in the table showing the generation. Write out a row in the table showing the generation.
""" """
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('EOL_GenerationCell',4) self.doc.start_cell('EOL_GenerationCell',2)
self.doc.start_paragraph('EOL-Generation') self.doc.start_paragraph('EOL-Generation')
self.doc.write_text( _("Generation %d") % generation ) self.doc.write_text( _("Generation %d") % generation )
self.doc.end_paragraph() self.doc.end_paragraph()
@ -204,80 +164,35 @@ class EndOfLineReport(Report):
""" """
person = self.database.get_person_from_handle(person_handle) person = self.database.get_person_from_handle(person_handle)
self.doc.start_row()
name = name_displayer.display(person) name = name_displayer.display(person)
mark = ReportUtils.get_person_mark(self.database, person) mark = ReportUtils.get_person_mark(self.database, person)
self.doc.start_cell('EOL-TableCell') birth_date = ""
self.doc.start_paragraph('EOL-Normal')
self.doc.write_text(name,mark)
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('EOL-TableCell')
self.doc.start_paragraph('EOL-Normal')
birth_ref = person.get_birth_ref() birth_ref = person.get_birth_ref()
if birth_ref: if birth_ref:
event = self.database.get_event_from_handle(birth_ref.ref) event = self.database.get_event_from_handle(birth_ref.ref)
text = DateHandler.get_date( event ) birth_date = DateHandler.get_date( event )
place_handle = event.get_place_handle()
place = ReportUtils.place_name(self.database,place_handle)
if place:
if text:
text += "\n"
text += place
self.doc.write_text(text)
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('EOL-TableCell') death_date = ""
self.doc.start_paragraph('EOL-Normal')
death_ref = person.get_death_ref() death_ref = person.get_death_ref()
if death_ref: if death_ref:
event = self.database.get_event_from_handle(death_ref.ref) event = self.database.get_event_from_handle(death_ref.ref)
text = DateHandler.get_date( event ) death_date = DateHandler.get_date( event )
dates = _(" (%(birth_date)s - %(death_date)s)") % {
place_handle = event.get_place_handle() 'birth_date' : birth_date,
place = ReportUtils.place_name(self.database,place_handle) 'death_date' : death_date }
if place:
if text:
text += "\n"
text += place
self.doc.write_text(text)
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.end_row()
def write_relationship_row(self,person_handle):
"""
Write a row in the table with with the person's relationship.
"""
ancestor = self.database.get_person_from_handle(person_handle)
(rel_string,common) = self.relationship.get_relationship(
self.person,ancestor)
text = _("%(person)s is the %(relationship)s of %(active_person)s.") % {
'person' : name_displayer.display(ancestor),
'relationship' : rel_string,
'active_person' : name_displayer.display(self.person) }
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('EOL-TableCell') self.doc.start_cell('EOL-TableCell',2)
self.doc.end_cell() self.doc.start_paragraph('EOL-Normal')
self.doc.start_cell('EOL-TableCell',3) self.doc.write_text(name,mark)
self.doc.start_paragraph('EOL-Pedigree') self.doc.write_text(dates)
self.doc.write_text(text)
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.end_row() self.doc.end_row()
def write_pedigree_row(self,pedigree): def write_pedigree_row(self,pedigree):
""" """
Write a row in the table with with the person's relationship. Write a row in the table with with the person's family line.
pedigree is an array containing the names of the people in the pedigree pedigree is an array containing the names of the people in the pedigree
""" """
@ -285,7 +200,7 @@ class EndOfLineReport(Report):
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('EOL-TableCell') self.doc.start_cell('EOL-TableCell')
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('EOL-TableCell',3) self.doc.start_cell('EOL-TableCell')
self.doc.start_paragraph('EOL-Pedigree') self.doc.start_paragraph('EOL-Pedigree')
self.doc.write_text(text) self.doc.write_text(text)
self.doc.end_paragraph() self.doc.end_paragraph()
@ -339,26 +254,16 @@ class EndOfLineOptions(ReportOptions):
font.set_italic(True) font.set_italic(True)
p = BaseDoc.ParagraphStyle() p = BaseDoc.ParagraphStyle()
p.set_font(font) p.set_font(font)
p.set_top_margin(ReportUtils.pt2cm(3)) p.set_top_margin(ReportUtils.pt2cm(6))
p.set_description(_('The basic style used for generation headings.')) p.set_description(_('The basic style used for generation headings.'))
default_style.add_paragraph_style("EOL-Generation",p) default_style.add_paragraph_style("EOL-Generation",p)
font = BaseDoc.FontStyle()
font.set_size(12)
font.set_bold(True)
p = BaseDoc.ParagraphStyle()
p.set_font(font)
p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3))
p.set_description(_('The basic style used for table headings.'))
default_style.add_paragraph_style("EOL-Normal-Bold",p)
font = BaseDoc.FontStyle() font = BaseDoc.FontStyle()
font.set_size(8) font.set_size(8)
p = BaseDoc.ParagraphStyle() p = BaseDoc.ParagraphStyle()
p.set_font(font) p.set_font(font)
p.set_top_margin(0) p.set_top_margin(0)
p.set_bottom_margin(ReportUtils.pt2cm(3)) p.set_bottom_margin(ReportUtils.pt2cm(6))
p.set_description(_('The basic style used for the text display.')) p.set_description(_('The basic style used for the text display.'))
default_style.add_paragraph_style("EOL-Pedigree",p) default_style.add_paragraph_style("EOL-Pedigree",p)
@ -372,10 +277,9 @@ class EndOfLineOptions(ReportOptions):
table = BaseDoc.TableStyle() table = BaseDoc.TableStyle()
table.set_width(100) table.set_width(100)
table.set_columns(3) table.set_columns(2)
table.set_column_width(0,26) table.set_column_width(0,10)
table.set_column_width(1,37) table.set_column_width(1,90)
table.set_column_width(2,37)
default_style.add_table_style('EOL-Table',table) default_style.add_table_style('EOL-Table',table)
#------------------------------------------------------------------------ #------------------------------------------------------------------------