* src/docgen/PdfDoc.py: Port table and image fixes from STABLE.
* src/plugins/Ancestors.py (person_name): Avoid overriding builtin. svn: r3919
This commit is contained in:
parent
639602a2b8
commit
d8a76a4c6d
@ -5,6 +5,9 @@
|
|||||||
* src/ReportOptions.py (OptionHandler.set_options):
|
* src/ReportOptions.py (OptionHandler.set_options):
|
||||||
Ignore unknown options.
|
Ignore unknown options.
|
||||||
|
|
||||||
|
* src/docgen/PdfDoc.py: Port table and image fixes from STABLE.
|
||||||
|
* src/plugins/Ancestors.py (person_name): Avoid overriding builtin.
|
||||||
|
|
||||||
2005-01-15 Don Allingham <dallingham@users.sourceforge.net>
|
2005-01-15 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
* src/EditPerson.py: don't use quote date
|
* src/EditPerson.py: don't use quote date
|
||||||
* src/PeopleModel.py: remove BOLD
|
* src/PeopleModel.py: remove BOLD
|
||||||
|
@ -200,13 +200,12 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
self.text = ''
|
self.text = ''
|
||||||
else:
|
else:
|
||||||
self.text = '<bullet>%s</bullet>' % leader
|
self.text = '<bullet>%s</bullet>' % leader
|
||||||
self.image = 0
|
|
||||||
|
|
||||||
def end_paragraph(self):
|
def end_paragraph(self):
|
||||||
if self.in_table == 0 and self.image == 0:
|
if self.in_table:
|
||||||
self.story.append(Paragraph(enc(self.text),self.current_para))
|
self.cur_cell.append(Paragraph(enc(self.text),self.current_para))
|
||||||
else:
|
else:
|
||||||
self.image = 0
|
self.story.append(Paragraph(enc(self.text),self.current_para))
|
||||||
|
|
||||||
def start_bold(self):
|
def start_bold(self):
|
||||||
self.text = self.text + '<b>'
|
self.text = self.text + '<b>'
|
||||||
@ -230,11 +229,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
self.table_data = []
|
self.table_data = []
|
||||||
|
|
||||||
self.tblstyle = []
|
self.tblstyle = []
|
||||||
self.cur_table_cols = []
|
self.text = ""
|
||||||
width = float(self.cur_table.get_width()/100.0) * self.get_usable_width()
|
|
||||||
for val in range(self.cur_table.get_columns()):
|
|
||||||
percent = float(self.cur_table.get_column_width(val))/100.0
|
|
||||||
self.cur_table_cols.append(int(width * percent * cm))
|
|
||||||
|
|
||||||
def end_table(self):
|
def end_table(self):
|
||||||
ts = reportlab.platypus.tables.TableStyle(self.tblstyle)
|
ts = reportlab.platypus.tables.TableStyle(self.tblstyle)
|
||||||
@ -248,6 +243,11 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
self.row = self.row + 1
|
self.row = self.row + 1
|
||||||
self.col = 0
|
self.col = 0
|
||||||
self.cur_row = []
|
self.cur_row = []
|
||||||
|
self.cur_table_cols = []
|
||||||
|
width = float(self.cur_table.get_width()/100.0) * self.get_usable_width()
|
||||||
|
for val in range(self.cur_table.get_columns()):
|
||||||
|
percent = float(self.cur_table.get_column_width(val))/100.0
|
||||||
|
self.cur_table_cols.append(int(width * percent * cm))
|
||||||
|
|
||||||
def end_row(self):
|
def end_row(self):
|
||||||
self.table_data.append(self.cur_row)
|
self.table_data.append(self.cur_row)
|
||||||
@ -255,15 +255,20 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
def start_cell(self,style_name,span=1):
|
def start_cell(self,style_name,span=1):
|
||||||
self.span = span
|
self.span = span
|
||||||
self.my_table_style = self.cell_styles[style_name]
|
self.my_table_style = self.cell_styles[style_name]
|
||||||
pass
|
self.cur_cell = []
|
||||||
|
|
||||||
def end_cell(self):
|
def end_cell(self):
|
||||||
if self.span == 1:
|
if self.cur_cell:
|
||||||
self.cur_row.append(Paragraph(self.text,self.current_para))
|
self.cur_row.append(self.cur_cell)
|
||||||
else:
|
else:
|
||||||
self.cur_row.append(self.text)
|
self.cur_row.append("")
|
||||||
|
|
||||||
|
the_width = self.cur_table_cols[self.col]
|
||||||
for val in range(1,self.span):
|
for val in range(1,self.span):
|
||||||
self.cur_row.append("")
|
self.cur_row.append("")
|
||||||
|
the_width += self.cur_table_cols[self.col+val]
|
||||||
|
self.cur_table_cols[self.col+val] = 0
|
||||||
|
self.cur_table_cols[self.col] = the_width
|
||||||
|
|
||||||
p = self.my_para
|
p = self.my_para
|
||||||
f = p.get_font()
|
f = p.get_font()
|
||||||
@ -302,6 +307,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
self.tblstyle.append(('VALIGN', loc, loc, 'TOP'))
|
self.tblstyle.append(('VALIGN', loc, loc, 'TOP'))
|
||||||
|
|
||||||
self.col = self.col + self.span
|
self.col = self.col + self.span
|
||||||
|
self.text = ""
|
||||||
|
|
||||||
def add_media_object(self,name,pos,x_cm,y_cm):
|
def add_media_object(self,name,pos,x_cm,y_cm):
|
||||||
try:
|
try:
|
||||||
@ -320,16 +326,25 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
act_height = y_cm
|
act_height = y_cm
|
||||||
act_width = x_cm/ratio
|
act_width = x_cm/ratio
|
||||||
|
|
||||||
self.story.append(Spacer(1,0.5*cm))
|
im = Image(enc(name),act_width*cm,act_height*cm)
|
||||||
self.story.append(Image(enc(name),act_width*cm,act_height*cm))
|
if pos in ['left','right','center']:
|
||||||
self.story.append(Spacer(1,0.5*cm))
|
im.hAlign = pos.upper()
|
||||||
self.image = 1
|
else:
|
||||||
|
im.hAlign = 'LEFT'
|
||||||
|
|
||||||
|
if self.in_table:
|
||||||
|
self.cur_cell.append(Spacer(1,0.5*cm))
|
||||||
|
self.cur_cell.append(im)
|
||||||
|
self.cur_cell.append(Spacer(1,0.5*cm))
|
||||||
|
else:
|
||||||
|
self.story.append(Spacer(1,0.5*cm))
|
||||||
|
self.story.append(im)
|
||||||
|
self.story.append(Spacer(1,0.5*cm))
|
||||||
|
|
||||||
def write_note(self,text,format,style_name):
|
def write_note(self,text,format,style_name):
|
||||||
current_para = self.pdfstyles[style_name]
|
current_para = self.pdfstyles[style_name]
|
||||||
self.my_para = self.style_list[style_name]
|
self.my_para = self.style_list[style_name]
|
||||||
self.super = "<font size=%d><super>" % (self.my_para.get_font().get_size()-2)
|
self.super = "<font size=%d><super>" % (self.my_para.get_font().get_size()-2)
|
||||||
self.image = 0
|
|
||||||
|
|
||||||
text = text.replace('&','&') # Must be first
|
text = text.replace('&','&') # Must be first
|
||||||
text = text.replace('<','<')
|
text = text.replace('<','<')
|
||||||
@ -337,15 +352,18 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
text = text.replace('<super>',self.super)
|
text = text.replace('<super>',self.super)
|
||||||
text = text.replace('</super>','</super></font>')
|
text = text.replace('</super>','</super></font>')
|
||||||
|
|
||||||
if self.in_table == 0:
|
if format == 1:
|
||||||
if format == 1:
|
text = '<para firstLineIndent="0" fontname="Courier">%s</para>' % text.replace('\t',' '*8)
|
||||||
text = '<para firstLineIndent="0" fontname="Courier">%s</para>' % text.replace('\t',' '*8)
|
if self.in_table:
|
||||||
|
self.cur_cell.append(XPreformatted(text,current_para))
|
||||||
|
else:
|
||||||
self.story.append(XPreformatted(text,current_para))
|
self.story.append(XPreformatted(text,current_para))
|
||||||
elif format == 0:
|
elif format == 0:
|
||||||
for line in text.split('\n\n'):
|
for line in text.split('\n\n'):
|
||||||
|
if self.in_table:
|
||||||
|
self.cur_cell.append(Paragraph(line,current_para))
|
||||||
|
else:
|
||||||
self.story.append(Paragraph(line,current_para))
|
self.story.append(Paragraph(line,current_para))
|
||||||
else:
|
|
||||||
self.image = 0
|
|
||||||
|
|
||||||
def write_text(self,text):
|
def write_text(self,text):
|
||||||
text = text.replace('&','&') # Must be first
|
text = text.replace('&','&') # Must be first
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003-2004 Donald N. Allingham
|
# Copyright (C) 2003-2005 Donald N. Allingham
|
||||||
# Copyright (C) 2003 Tim Waugh
|
# Copyright (C) 2003 Tim Waugh
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
@ -700,9 +700,9 @@ class ComprehensiveAncestorsReport (Report.Report):
|
|||||||
if suffix:
|
if suffix:
|
||||||
name += ', ' + suffix
|
name += ', ' + suffix
|
||||||
|
|
||||||
type = primary.get_type ()
|
the_type = primary.get_type ()
|
||||||
if type != 'Birth Name':
|
if the_type != 'Birth Name':
|
||||||
name += ' (%s)' % const.NameTypesMap.find_value (type)
|
name += ' (%s)' % const.NameTypesMap.find_value (the_type)
|
||||||
|
|
||||||
name += self.cite_sources (primary.get_source_references ())
|
name += self.cite_sources (primary.get_source_references ())
|
||||||
return name
|
return name
|
||||||
|
Loading…
Reference in New Issue
Block a user