* src/docgen/AbiWord2Doc.py: handle superscript properly

* src/ReportUtils.py: remove name generation from list_person_str
* src/plugins/DetAncestralReport.py: fix child list, use roman numerals


svn: r5281
This commit is contained in:
Don Allingham 2005-10-06 20:03:21 +00:00
parent 2d81701115
commit d4dec7ff60
4 changed files with 64 additions and 70 deletions

View File

@ -1,3 +1,8 @@
2005-10-06 Don Allingham <don@gramps-project.org>
* src/docgen/AbiWord2Doc.py: handle superscript properly
* src/ReportUtils.py: remove name generation from list_person_str
* src/plugins/DetAncestralReport.py: fix child list, use roman numerals
2005-10-06 Alex Roitman <shura@gramps-project.org>
* src/TreeTips.py: Typo.
* src/plugins/ScratchPad.py: Convert to new API.

View File

@ -1716,8 +1716,6 @@ def child_str(person, father_name="", mother_name="", dead=0, person_name=0):
else:
index = 1
print person_name, index
gender = person.get_gender()
if mother_name and father_name:
@ -1728,7 +1726,6 @@ def child_str(person, father_name="", mother_name="", dead=0, person_name=0):
text = child_father[gender][index][dead] % values
if text:
text = text + " "
print text
return text
#-------------------------------------------------------------------------
@ -1993,26 +1990,17 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""):
# list_person_str
#
#-------------------------------------------------------------------------
def list_person_str(database,person,person_name=None,empty_date="",empty_place=""):
def list_person_str(database,person,empty_date="",empty_place=""):
"""
Briefly list person and birth/death events.
"""
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')
bdate,bplace,bdate_full,bdate_mod,ddate,dplace,ddate_full,ddate_mod = \
get_birth_death_strings(database,person)
text = ""
values = {
'name' : person_name,
'birth_date' : bdate,
'birth_place' : bplace,
'death_date' : ddate,
@ -2023,70 +2011,55 @@ def list_person_str(database,person,person_name=None,empty_date="",empty_place="
if bplace:
if ddate:
if dplace:
text = _("%(name)s "
"Born: %(birth_date)s %(birth_place)s "
text = _("Born: %(birth_date)s %(birth_place)s, "
"Died: %(death_date)s %(death_place)s.") % values
else:
text = _("%(name)s "
"Born: %(birth_date)s %(birth_place)s "
text = _("Born: %(birth_date)s %(birth_place)s, "
"Died: %(death_date)s.") % values
else:
if dplace:
text = _("%(name)s "
"Born: %(birth_date)s %(birth_place)s "
text = _("Born: %(birth_date)s %(birth_place)s, "
"Died: %(death_place)s.") % values
else:
text = _("%(name)s "
"Born: %(birth_date)s %(birth_place)s.") % values
text = _("Born: %(birth_date)s %(birth_place)s.") % values
else:
if ddate:
if dplace:
text = _("%(name)s Born: %(birth_date)s "
text = _("Born: %(birth_date)s, "
"Died: %(death_date)s %(death_place)s.") % values
else:
text = _("%(name)s "
"Born: %(birth_date)s Died: %(death_date)s.") % values
text = _("Born: %(birth_date)s, Died: %(death_date)s.") % values
else:
if dplace:
text = _("%(name)s "
"Born: %(birth_date)s Died: %(death_place)s.") % values
text = _("Born: %(birth_date)s, Died: %(death_place)s.") % values
else:
text = _("%(name)s Born: %(birth_date)s.") % values
text = _("Born: %(birth_date)s.") % values
else:
if bplace:
if ddate:
if dplace:
text = _("%(name)s "
"Born: %(birth_place)s "
text = _("Born: %(birth_place)s, "
"Died: %(death_date)s %(death_place)s.") % values
else:
text = _("%(name)s "
"Born: %(birth_place)s "
text = _("Born: %(birth_place)s, "
"Died: %(death_date)s.") % values
else:
if dplace:
text = _("%(name)s "
"Born: %(birth_place)s "
text = _("Born: %(birth_place)s, "
"Died: %(death_place)s.") % values
else:
text = _("%(name)s "
"Born: %(birth_place)s.") % values
text = _("Born: %(birth_place)s.") % values
else:
if ddate:
if dplace:
text = _("%(name)s "
"Died: %(death_date)s %(death_place)s.") % values
text = _("Died: %(death_date)s %(death_place)s.") % values
else:
text = _("%(name)s "
"Died: %(death_date)s.") % values
text = _("Died: %(death_date)s.") % values
else:
if dplace:
text = _("%(name)s Died: %(death_place)s.") % values
text = _("Died: %(death_place)s.") % values
else:
text = _("%(name)s.") % values
if text:
text = "- %s " % text
text = ""
return text

View File

@ -221,10 +221,10 @@ class AbiWordDoc(BaseDoc.BaseDoc):
% (start_p,tag_number,act_height,act_width,end_p))
def start_superscript(self):
self.text = self.text + '<c props="text-position:superscript">'
self.f.write('<c props="text-position:superscript">')
def end_superscript(self):
self.text = self.text + '</c>'
self.f.write('</c>')
def start_paragraph(self,style_name,leader=None):
self.in_paragraph = 1

View File

@ -218,25 +218,35 @@ class DetAncestorReport(Report.Report):
return 1 # Duplicate person
# Check birth record
self.doc.write_text(ReportUtils.born_str(self.database,person,0,
self.EMPTY_DATE,self.EMPTY_PLACE))
birth_handle = person.get_birth_handle()
if birth_handle:
self.endnotes(self.database.get_event_from_handle(birth_handle))
self.doc.write_text(ReportUtils.died_str(self.database,person,0,
self.EMPTY_DATE,self.EMPTY_PLACE))
death_handle = person.get_birth_handle()
if death_handle:
self.endnotes(self.database.get_event_from_handle(death_handle))
first = person.get_primary_name().get_first_name()
text = ReportUtils.born_str(self.database,person,first,
self.EMPTY_DATE,self.EMPTY_PLACE)
if text:
self.doc.write_text(text)
birth_handle = person.get_birth_handle()
if birth_handle:
self.endnotes(self.database.get_event_from_handle(birth_handle))
first = 0
self.doc.write_text(ReportUtils.buried_str(self.database,person,0,
self.EMPTY_DATE,self.EMPTY_PLACE))
text = ReportUtils.died_str(self.database,person,first,
self.EMPTY_DATE,self.EMPTY_PLACE)
if text:
self.doc.write_text(text)
death_handle = person.get_birth_handle()
if death_handle:
self.endnotes(self.database.get_event_from_handle(death_handle))
first = 0
firstName = person.get_primary_name().get_first_name()
self.write_parents(person, firstName)
text = ReportUtils.buried_str(self.database,person,first,
self.EMPTY_DATE,self.EMPTY_PLACE)
if text:
self.doc.write_text(text)
first = person.get_primary_name().get_first_name()
self.write_parents(person, first)
self.write_marriage(person)
self.doc.end_paragraph()
@ -378,22 +388,28 @@ class DetAncestorReport(Report.Report):
father_name = _("unknown")
self.doc.start_paragraph("DAR-ChildTitle")
self.doc.write_text(_("Children of %s and %s are:") %
(mother_name,father_name))
self.doc.write_text(_("Children of %s and %s") %
(mother_name,father_name))
self.doc.end_paragraph()
cnt = 1
for child_handle in family.get_child_handle_list():
self.doc.start_paragraph("DAR-ChildList")
child = self.database.get_person_from_handle(child_handle)
child_name = _nd.display(child)
if self.childRef and self.prev_gen_handles.get(child_handle):
child_name = "[%s] %s" % (
str(self.prev_gen_handles.get(child_handle)),
child_name)
value = str(self.prev_gen_handles.get(child_handle))
child_name += " [%s]" % value
text = ReportUtils.list_person_str(self.database,child,child_name)
self.doc.write_text(text)
self.doc.start_paragraph("DAR-ChildList",ReportUtils.roman(cnt).lower() + ".")
cnt += 1
self.doc.write_text(child_name)
text = ReportUtils.list_person_str(self.database,child)
if text:
self.doc.write_text(" : %s" % text)
else:
self.doc.write_text(".")
self.doc.end_paragraph()
@ -644,7 +660,7 @@ class DetAncestorOptions(ReportOptions.ReportOptions):
font.set(face=BaseDoc.FONT_SANS_SERIF,size=9)
para = BaseDoc.ParagraphStyle()
para.set_font(font)
para.set(first_indent=0.0,lmargin=1.0,pad=0.25)
para.set(first_indent=-0.5,lmargin=1.5,pad=0.25)
para.set_description(_('The style used for the children list.'))
default_style.add_style("DAR-ChildList",para)