2003-09-01 Tim Waugh <twaugh@redhat.com>

* src/plugins/Ancestors.py: Separate paternal and maternal ancestors
        for easier reading.


svn: r2073
This commit is contained in:
Tim Waugh 2003-09-01 20:57:51 +00:00
parent aafd981d8d
commit 07543dbdde
2 changed files with 49 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2003-09-01 Tim Waugh <twaugh@redhat.com>
* src/plugins/Ancestors.py: Separate paternal and maternal ancestors
for easier reading.
* src/Makefile.am: Ship BaseDoc.py.
2003-09-01 Don Allingham <dallingham@users.sourceforge.net> 2003-09-01 Don Allingham <dallingham@users.sourceforge.net>
* src/RelLib.py: make Witness inherit from Persistant * src/RelLib.py: make Witness inherit from Persistant

View File

@ -126,7 +126,7 @@ class ComprehensiveAncestorsReport (Report.Report):
needs_name = 1)) needs_name = 1))
families = [self.start.getMainParents ()] families = [self.start.getMainParents ()]
if len (families) > 0: if len (families) > 0:
self.generation (self.max_generations, families, [self.start]) self.generation (self.max_generations, families, [], [self.start])
if len (self.sources) > 0: if len (self.sources) > 0:
self.doc.start_paragraph ("AR-Heading") self.doc.start_paragraph ("AR-Heading")
@ -211,48 +211,77 @@ class ComprehensiveAncestorsReport (Report.Report):
return ret return ret
def generation (self, generations, families, already_described, def generation (self, generations, pfamilies, mfamilies,
thisgen = 2): already_described, thisgen = 2):
if generations > 1 and len (families): if generations > 1 and (len (pfamilies) + len (mfamilies)):
people = [] people = []
for family in families: for family in pfamilies:
people.extend (self.family (family, already_described))
if thisgen > 2 and len (mfamilies):
for self.gp in [mfamilies[0].getFather (),
mfamilies[0].getMother ()]:
if self.gp:
break
relstring = Relationship.get_grandparents_string (self.start,
self.gp)[0]
heading = _("%(name)s's maternal %(grandparents)s") % \
{ 'name': self.first_name_or_nick (self.start),
'grandparents': relstring }
people.append ((self.doc.start_paragraph, ['AR-Heading']))
people.append ((self.doc.write_text, [heading]))
people.append ((self.doc.end_paragraph, []))
for family in mfamilies:
people.extend (self.family (family, already_described)) people.extend (self.family (family, already_described))
if len (people): if len (people):
if self.pgbrk: if self.pgbrk:
self.doc.page_break() self.doc.page_break()
self.doc.start_paragraph ("AR-Heading") self.doc.start_paragraph ("AR-Heading")
families = pfamilies
families.extend (mfamilies)
for self.gp in [families[0].getFather (), for self.gp in [families[0].getFather (),
families[0].getMother ()]: families[0].getMother ()]:
if self.gp: if self.gp:
break break
heading = _("%(name)s's %(grandparents)s") % \
relstring = Relationship.get_grandparents_string (self.start,
self.gp)[0]
if thisgen == 2:
heading = _("%(name)s's %(parents)s") % \
{ 'name': self.first_name_or_nick (self.start), { 'name': self.first_name_or_nick (self.start),
'grandparents': 'parents': relstring }
Relationship.get_grandparents_string (self.start, else:
self.gp)[0]} heading = _("%(name)s's paternal %(grandparents)s") % \
{ 'name': self.first_name_or_nick (self.start),
'grandparents': relstring }
self.doc.write_text (heading) self.doc.write_text (heading)
self.doc.end_paragraph () self.doc.end_paragraph ()
self.write_paragraphs (people) self.write_paragraphs (people)
next_families = [] next_pfamilies = []
next_mfamilies = []
for family in families: for family in families:
father = family.getFather () father = family.getFather ()
if father: if father:
already_described.append (father) already_described.append (father)
father_family = father.getMainParents () father_family = father.getMainParents ()
if father_family: if father_family:
next_families.append (father_family) next_pfamilies.append (father_family)
mother = family.getMother () mother = family.getMother ()
if mother: if mother:
already_described.append (mother) already_described.append (mother)
mother_family = mother.getMainParents () mother_family = mother.getMainParents ()
if mother_family: if mother_family:
next_families.append (mother_family) next_mfamilies.append (mother_family)
self.generation (generations - 1, next_families, self.generation (generations - 1, next_pfamilies,
already_described, thisgen + 1) next_mfamilies, already_described,
thisgen + 1)
def person (self, person, def person (self, person,
suppress_children = 0, suppress_children = 0,