* src/ReportUtils.py (rgb_color): Add docs; (child_str): Fixes.
* src/plugins/Ancestors.py: Misc fixes. * src/plugins/DetAncestralReport.py: Properly call child_str. * src/plugins/DetDescendantReport.py: Properly call child_str. * src/plugins/FtmStyleAncestors.py: Properly call child_str. * src/plugins/FtmStyleDescendants.py: Properly call child_str. svn: r4073
This commit is contained in:
parent
bdbbe239aa
commit
bb03994a08
@ -13,6 +13,13 @@
|
||||
* src/ReportUtils.py (rgb_color): Add function.
|
||||
* src/docgen/LPRDoc.py: Use rgb_color from ReportUtils.
|
||||
|
||||
* src/ReportUtils.py (rgb_color): Add docs; (child_str): Fixes.
|
||||
* src/plugins/Ancestors.py: Misc fixes.
|
||||
* src/plugins/DetAncestralReport.py: Properly call child_str.
|
||||
* src/plugins/DetDescendantReport.py: Properly call child_str.
|
||||
* src/plugins/FtmStyleAncestors.py: Properly call child_str.
|
||||
* src/plugins/FtmStyleDescendants.py: Properly call child_str.
|
||||
|
||||
2005-02-20 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||
* src/docgen/LPRDoc.py (draw_path,draw_bar): Set proper linewidth.
|
||||
* doc/gramps-manual/C/usage.xml: Update.
|
||||
|
@ -63,6 +63,14 @@ def cm2pt(cm):
|
||||
return cm*182.88
|
||||
|
||||
def rgb_color(color):
|
||||
"""
|
||||
Converts color value from 0-255 integer range into 0-1 float range.
|
||||
|
||||
@param color: list or tuple of integer values for red, green, and blue
|
||||
@type color: int
|
||||
@returns: (r,g,b) tuple of floating point color values
|
||||
@rtype: 3-tuple
|
||||
"""
|
||||
r = float(color[0])/255.0
|
||||
g = float(color[1])/255.0
|
||||
b = float(color[2])/255.0
|
||||
@ -932,7 +940,7 @@ def married_rel_str(database,person,family,is_first=True):
|
||||
text = text + " "
|
||||
return text
|
||||
|
||||
def child_str(person,person_name=0,father_name="",mother_name="",dead=0):
|
||||
def child_str(person,father_name="",mother_name="",dead=0):
|
||||
"""
|
||||
Composes a string describing person being a child.
|
||||
|
||||
@ -952,14 +960,6 @@ def child_str(person,person_name=0,father_name="",mother_name="",dead=0):
|
||||
@rtype: unicode
|
||||
"""
|
||||
|
||||
if person_name == None:
|
||||
person_name = _nd.display_name(person.get_primary_name())
|
||||
elif person_name == 0:
|
||||
if person.get_gender() == RelLib.Person.MALE:
|
||||
person_name = _('He')
|
||||
else:
|
||||
person_name = _('She')
|
||||
|
||||
text = ""
|
||||
|
||||
if person.get_gender() == RelLib.Person.MALE:
|
||||
|
@ -46,7 +46,9 @@ import BaseDoc
|
||||
import RelLib
|
||||
import PluginMgr
|
||||
import ReportOptions
|
||||
import ReportUtils
|
||||
from DateHandler import displayer as _dd
|
||||
from NameDisplay import displayer as _nd
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -519,7 +521,7 @@ class ComprehensiveAncestorsReport (Report.Report):
|
||||
birth = self.database.get_event_from_handle(birth_handle)
|
||||
date = birth.get_date ()
|
||||
if date:
|
||||
ret += _(" b. %(date)s") % {'date': date}
|
||||
ret += _(" b. %(birth_date)s") % {'birth_date': date}
|
||||
ret += self.cite_sources (birth.get_source_references ())
|
||||
|
||||
death_handle = person.get_death_handle ()
|
||||
@ -527,7 +529,7 @@ class ComprehensiveAncestorsReport (Report.Report):
|
||||
death = self.database.get_event_from_handle(death_handle)
|
||||
date = death.get_date ()
|
||||
if date:
|
||||
ret += _(" d. %(date)s") % {'date': date}
|
||||
ret += _(" d. %(death_date)s") % {'death_date': date}
|
||||
ret += self.cite_sources (death.get_source_references ())
|
||||
|
||||
return ret
|
||||
@ -557,49 +559,27 @@ class ComprehensiveAncestorsReport (Report.Report):
|
||||
return ret
|
||||
|
||||
def parents_of (self, person_handle):
|
||||
|
||||
ret = '. '
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
gender = person.get_gender ()
|
||||
|
||||
family_handle = person.get_main_parents_family_handle ()
|
||||
family_handle = person.get_main_parents_family_handle()
|
||||
if family_handle:
|
||||
family = self.database.get_family_from_handle(family_handle)
|
||||
fathername = mothername = None
|
||||
father_handle = family.get_father_handle ()
|
||||
if father_handle:
|
||||
#father = self.database.get_person_from_handle(father_handle)
|
||||
fathername = self.person_name (father_handle)
|
||||
mother_handle = family.get_mother_handle ()
|
||||
mother_handle = family.get_mother_handle()
|
||||
father_handle = family.get_father_handle()
|
||||
if mother_handle:
|
||||
#mother = self.database.get_person_from_handle(mother_handle)
|
||||
mothername = self.person_name (mother_handle)
|
||||
|
||||
if not mother_handle and not father_handle:
|
||||
pass
|
||||
elif not father_handle:
|
||||
if gender == RelLib.Person.FEMALE:
|
||||
ret += _("She is the daughter of %(mother)s.") % \
|
||||
{'mother': mothername}
|
||||
else:
|
||||
ret += _("He is the son of %(mother)s.") % \
|
||||
{'mother': mothername}
|
||||
elif not mother_handle:
|
||||
if gender == RelLib.Person.FEMALE:
|
||||
ret += _("She is the daughter of %(father)s.") % \
|
||||
{'father': fathername}
|
||||
else:
|
||||
ret += _("He is the son of %(father)s.") % \
|
||||
{'father': fathername}
|
||||
mother = self.database.get_person_from_handle(mother_handle)
|
||||
mother_name = _nd.display_name(mother.get_primary_name())
|
||||
else:
|
||||
if gender == RelLib.Person.FEMALE:
|
||||
ret += \
|
||||
_("She is the daughter of %(father)s and %(mother)s.")%\
|
||||
{'father': fathername,
|
||||
'mother': mothername}
|
||||
else:
|
||||
ret +=_("He is the son of %(father)s and %(mother)s.") % \
|
||||
{'father': fathername,
|
||||
'mother': mothername}
|
||||
mother_name = ""
|
||||
if father_handle:
|
||||
father = self.database.get_person_from_handle(father_handle)
|
||||
father_name = _nd.display_name(father.get_primary_name())
|
||||
else:
|
||||
father_name = ""
|
||||
|
||||
ret += ReportUtils.child_str(person,father_name,mother_name,
|
||||
bool(person.get_death_handle()))
|
||||
|
||||
return ret
|
||||
|
||||
@ -646,13 +626,7 @@ class ComprehensiveAncestorsReport (Report.Report):
|
||||
citation += "[%d" % ind
|
||||
comments = ref.get_comments ()
|
||||
if comments and comments.find ('\n') == -1:
|
||||
# Work around rstrip('.') which is not working
|
||||
# with python2.2.1 and earlier
|
||||
#citation += " - %s" % comments.rstrip ('.')
|
||||
comments = comments.rstrip()
|
||||
if comments[-1] == '.':
|
||||
comments = comments[:-1]
|
||||
citation += " - %s" % comments
|
||||
citation += " - %s" % comments.rstrip ('.')
|
||||
|
||||
citation += "]"
|
||||
|
||||
@ -676,15 +650,9 @@ class ComprehensiveAncestorsReport (Report.Report):
|
||||
|
||||
nick = person.get_nick_name ()
|
||||
if nick:
|
||||
#nick = nick.strip ('"')
|
||||
# Work around strip('"') which is not working
|
||||
# with python2.2.1 and earlier
|
||||
nick = nick.strip ('"')
|
||||
nick = nick.strip()
|
||||
if nick[0] == '"':
|
||||
nick = nick[1:]
|
||||
if nick[-1] == '"':
|
||||
nick = nick[:-1]
|
||||
name += ' ("%s")' % nick
|
||||
name += ' ("%s")' % nick
|
||||
|
||||
spfx = primary.get_surname_prefix ()
|
||||
if spfx:
|
||||
@ -716,9 +684,9 @@ class ComprehensiveAncestorsReport (Report.Report):
|
||||
mother_handle = family.get_mother_handle ()
|
||||
mother = self.database.get_person_from_handle(mother_handle)
|
||||
for spouse_handle in [family.get_father_handle (), mother_handle]:
|
||||
spouse = self.database.get_person_from_handle(spouse_handle)
|
||||
if spouse_handle == person.get_handle() or not spouse_handle:
|
||||
continue
|
||||
spouse = self.database.get_person_from_handle(spouse_handle)
|
||||
|
||||
children = ''
|
||||
childlist = family.get_child_handle_list ()
|
||||
|
@ -137,7 +137,7 @@ class DetAncestorReport(Report.Report):
|
||||
def write_report(self):
|
||||
self.apply_filter(self.start_person.get_handle(),1)
|
||||
|
||||
name = self.start_person.get_primary_name().get_regular_name()
|
||||
name = _nd.display_name(self.start_person.get_primary_name())
|
||||
self.doc.start_paragraph("DAR-Title")
|
||||
title = _("Detailed Ancestral Report for %s") % name
|
||||
self.doc.write_text(title)
|
||||
@ -255,16 +255,16 @@ class DetAncestorReport(Report.Report):
|
||||
father_handle = family.get_father_handle()
|
||||
if mother_handle:
|
||||
mother = self.database.get_person_from_handle(mother_handle)
|
||||
mother_name = mother.get_primary_name().get_regular_name()
|
||||
mother_name = _nd.display_name(mother.get_primary_name())
|
||||
else:
|
||||
mother_name = ""
|
||||
if father_handle:
|
||||
father = self.database.get_person_from_handle(father_handle)
|
||||
father_name = father.get_primary_name().get_regular_name()
|
||||
father_name = _nd.display_name(father.get_primary_name())
|
||||
else:
|
||||
father_name = ""
|
||||
|
||||
text = ReportUtils.child_str(person,firstName,
|
||||
text = ReportUtils.child_str(person,
|
||||
father_name,mother_name,
|
||||
bool(person.get_death_handle()))
|
||||
if text:
|
||||
|
@ -146,7 +146,7 @@ class DetDescendantReport(Report.Report):
|
||||
def write_report(self):
|
||||
self.apply_filter(self.start_person.get_handle(),1)
|
||||
|
||||
name = self.start_person.get_primary_name().get_regular_name()
|
||||
name = _nd.display_name(self.start_person.get_primary_name())
|
||||
|
||||
spouseName = ""
|
||||
for family_handle in self.start_person.get_family_handle_list():
|
||||
@ -278,16 +278,16 @@ class DetDescendantReport(Report.Report):
|
||||
father_handle = family.get_father_handle()
|
||||
if mother_handle:
|
||||
mother = self.database.get_person_from_handle(mother_handle)
|
||||
mother_name = mother.get_primary_name().get_regular_name()
|
||||
mother_name = _nd.display_name(mother.get_primary_name())
|
||||
else:
|
||||
mother_name = ""
|
||||
if father_handle:
|
||||
father = self.database.get_person_from_handle(father_handle)
|
||||
father_name = father.get_primary_name().get_regular_name()
|
||||
father_name = _nd.display_name(father.get_primary_name())
|
||||
else:
|
||||
father_name = ""
|
||||
|
||||
text = ReportUtils.child_str(person,firstName,
|
||||
text = ReportUtils.child_str(person,
|
||||
father_name,mother_name,
|
||||
bool(person.get_death_handle()))
|
||||
if text:
|
||||
|
@ -336,7 +336,7 @@ class FtmAncestorReport(Report.Report):
|
||||
else:
|
||||
father_name = ""
|
||||
|
||||
text = ReportUtils.child_str(person,0,
|
||||
text = ReportUtils.child_str(person,
|
||||
father_name,mother_name,dead)
|
||||
if text:
|
||||
self.doc.write_text(text)
|
||||
|
@ -482,7 +482,7 @@ class FtmDescendantReport(Report.Report):
|
||||
else:
|
||||
father_name = ""
|
||||
|
||||
text = ReportUtils.child_str(person,0,
|
||||
text = ReportUtils.child_str(person,
|
||||
father_name,mother_name,dead)
|
||||
if text:
|
||||
self.doc.write_text(text)
|
||||
|
Loading…
Reference in New Issue
Block a user