From d478c1a42d87fbd4e3d0b96aeec589f2591d690a Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Fri, 3 Aug 2007 04:00:28 +0000 Subject: [PATCH] Remove relationships and places from EOL report. svn: r8798 --- ChangeLog | 3 + src/plugins/EndOfLineReport.py | 136 +++++---------------------------- 2 files changed, 23 insertions(+), 116 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8704507a9..a5452df22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-08-02 Brian Matherly + * src/plugins/EndOfLineReport.py: Remove relationships and places + 2007-08-01 Brian Matherly * src/plugins/IndivComplete.py: Reset bibliography between people. diff --git a/src/plugins/EndOfLineReport.py b/src/plugins/EndOfLineReport.py index 93bd65c98..3c6f3ec94 100644 --- a/src/plugins/EndOfLineReport.py +++ b/src/plugins/EndOfLineReport.py @@ -34,11 +34,10 @@ from gettext import gettext as _ # gramps modules # #------------------------------------------------------------------------ -from PluginUtils import register_report, relationship_class +from PluginUtils import register_report from ReportBase import Report, ReportUtils, ReportOptions, \ CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI import BaseDoc -from Filters import GenericFilterFactory, Rules from BasicUtils import name_displayer import DateHandler @@ -66,16 +65,6 @@ class EndOfLineReport(Report): Report.__init__(self,database,person,options_class) 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: # keys are the generations of the people @@ -148,50 +137,21 @@ class EndOfLineReport(Report): self.doc.end_paragraph() self.doc.start_table('EolTable','EOL-Table') - -# self.write_collumn_header() for generation in self.eol_map.keys(): self.write_generation_row(generation) for person_handle in self.eol_map[generation].keys(): self.write_person_row(person_handle) - self.write_relationship_row(person_handle) for pedigree in self.eol_map[generation][person_handle]: self.write_pedigree_row(pedigree) 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): """ Write out a row in the table showing the generation. """ 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.write_text( _("Generation %d") % generation ) self.doc.end_paragraph() @@ -204,80 +164,35 @@ class EndOfLineReport(Report): """ person = self.database.get_person_from_handle(person_handle) - self.doc.start_row() - name = name_displayer.display(person) mark = ReportUtils.get_person_mark(self.database, person) - self.doc.start_cell('EOL-TableCell') - 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_date = "" birth_ref = person.get_birth_ref() if birth_ref: event = self.database.get_event_from_handle(birth_ref.ref) - text = 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() + birth_date = DateHandler.get_date( event ) - self.doc.start_cell('EOL-TableCell') - self.doc.start_paragraph('EOL-Normal') + death_date = "" death_ref = person.get_death_ref() if death_ref: event = self.database.get_event_from_handle(death_ref.ref) - text = 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() + death_date = DateHandler.get_date( event ) + dates = _(" (%(birth_date)s - %(death_date)s)") % { + 'birth_date' : birth_date, + 'death_date' : death_date } - 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_cell('EOL-TableCell') - self.doc.end_cell() - self.doc.start_cell('EOL-TableCell',3) - self.doc.start_paragraph('EOL-Pedigree') - self.doc.write_text(text) + self.doc.start_cell('EOL-TableCell',2) + self.doc.start_paragraph('EOL-Normal') + self.doc.write_text(name,mark) + self.doc.write_text(dates) self.doc.end_paragraph() self.doc.end_cell() self.doc.end_row() 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 """ @@ -285,7 +200,7 @@ class EndOfLineReport(Report): self.doc.start_row() self.doc.start_cell('EOL-TableCell') 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.write_text(text) self.doc.end_paragraph() @@ -339,26 +254,16 @@ class EndOfLineOptions(ReportOptions): font.set_italic(True) p = BaseDoc.ParagraphStyle() 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.')) 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.set_size(8) p = BaseDoc.ParagraphStyle() p.set_font(font) 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.')) default_style.add_paragraph_style("EOL-Pedigree",p) @@ -372,10 +277,9 @@ class EndOfLineOptions(ReportOptions): table = BaseDoc.TableStyle() table.set_width(100) - table.set_columns(3) - table.set_column_width(0,26) - table.set_column_width(1,37) - table.set_column_width(2,37) + table.set_columns(2) + table.set_column_width(0,10) + table.set_column_width(1,90) default_style.add_table_style('EOL-Table',table) #------------------------------------------------------------------------