Fixed truncation of PDF tables

svn: r268
This commit is contained in:
Don Allingham 2001-07-30 02:34:22 +00:00
parent d33ad3d58e
commit 129bca5dd6
5 changed files with 67 additions and 86 deletions

View File

@ -9,6 +9,10 @@ Version 0.4.0
* Double clicking on a name in the Pedegree view brings up the edit
box for that person
* Support for same sex parent families has been added
* Complete rework of Edit Person dialog
* Added privacy flag and confidence level to events, attributes, etc.
* Automatically detect gzip'ed XML vs. XML
* Added option to write either gzip'ed XML or straight XML
Version 0.3.2
* Fixed Style Editor on WebPage.py, to allow styles to be edited.

View File

@ -520,21 +520,7 @@ def on_name_list_select_row(obj,row,b,c):
epo.alt_last_field.set_text(name.getSurname())
epo.alt_suffix_field.set_text(name.getSuffix())
if name.getNote() != "":
details = "%s" % _("Note")
else:
details = ""
if name.getSourceRef().getBase() != None:
if details == "":
details = _("Source")
else:
details = "%s, %s" % (details,_("Source"))
if name.getPrivacy() == 1:
if details == "":
details = _("Private")
else:
details = "%s, %s" % (details,_("Private"))
epo.name_details_field.set_text(details)
epo.name_details_field.set_text(get_detail_text(name))
#-------------------------------------------------------------------------
#
@ -567,22 +553,7 @@ def on_attr_list_select_row(obj,row,b,c):
epo.attr_type.set_label(const.display_pattr(attr.getType()))
epo.attr_value.set_text(attr.getValue())
if attr.getNote() != "":
details = "%s" % _("Note")
else:
details = ""
if attr.getSourceRef().getBase() != None:
if details == "":
details = _("Source")
else:
details = "%s, %s" % (details,_("Source"))
if attr.getPrivacy() == 1:
if details == "":
details = _("Private")
else:
details = "%s, %s" % (details,_("Private"))
epo.attr_details_field.set_text(details)
epo.attr_details_field.set_text(get_detail_text(attr))
#-------------------------------------------------------------------------
#
@ -595,32 +566,17 @@ def on_address_list_select_row(obj,row,b,c):
obj.set_data(INDEX,row)
epo = obj.get_data(EDITPERSON)
addr = obj.get_row_data(row)
a = obj.get_row_data(row)
epo.address_label.set_label("%s %s %s" % \
(addr.getCity(),addr.getState(),addr.getCountry()))
epo.address_start.set_text(addr.getDate())
epo.address_street.set_text(addr.getStreet())
epo.address_city.set_text(addr.getCity())
epo.address_state.set_text(addr.getState())
epo.address_country.set_text(addr.getCountry())
epo.address_postal.set_text(addr.getPostal())
if addr.getNote() != "":
details = "%s" % _("Note")
else:
details = ""
if addr.getSourceRef().getBase() != None:
if details == "":
details = _("Source")
else:
details = "%s, %s" % (details,_("Source"))
if addr.getPrivacy() == 1:
if details == "":
details = _("Private")
else:
details = "%s, %s" % (details,_("Private"))
epo.addr_details_field.set_text(details)
(a.getCity(),a.getState(),a.getCountry()))
epo.address_start.set_text(a.getDate())
epo.address_street.set_text(a.getStreet())
epo.address_city.set_text(a.getCity())
epo.address_state.set_text(a.getState())
epo.address_country.set_text(a.getCountry())
epo.address_postal.set_text(a.getPostal())
epo.addr_details_field.set_text(get_detail_text(a))
#-------------------------------------------------------------------------
#
@ -856,22 +812,7 @@ def on_event_select_row(obj,row,b,c):
epo.event_place_field.set_text(event.getPlace())
epo.event_name_field.set_label(const.display_pevent(event.getName()))
epo.event_descr_field.set_text(event.getDescription())
if event.getNote() != "":
details = "%s" % _("Note")
else:
details = ""
if event.getSourceRef().getBase() != None:
if details == "":
details = _("Source")
else:
details = "%s, %s" % (details,_("Source"))
if event.getPrivacy() == 1:
if details == "":
details = _("Private")
else:
details = "%s, %s" % (details,_("Private"))
epo.event_details_field.set_text(details)
epo.event_details_field.set_text(get_detail_text(event))
#-------------------------------------------------------------------------
#
@ -2059,3 +2000,25 @@ def get_detail_flags(obj):
if obj.getPrivacy():
detail = detail + "P"
return detail
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def get_detail_text(obj):
if obj.getNote() != "":
details = "%s" % _("Note")
else:
details = ""
if obj.getSourceRef().getBase() != None:
if details == "":
details = _("Source")
else:
details = "%s, %s" % (details,_("Source"))
if obj.getPrivacy() == 1:
if details == "":
details = _("Private")
else:
details = "%s, %s" % (details,_("Private"))
return details

View File

@ -87,8 +87,10 @@ class PdfDoc(TextDoc):
rightMargin=self.rmargin*cm,
topMargin=self.tmargin*cm,
bottomMargin=self.bmargin*cm)
frameT = Frame(self.doc.leftMargin, self.doc.bottomMargin, \
self.doc.width, self.doc.height, id='normal')
frameT = Frame(0,0,self.width*cm,self.height*cm,
self.lmargin*cm, self.bmargin*cm, \
self.rmargin*cm,self.tmargin*cm,\
id='normal')
ptemp = PageTemplate(frames=frameT,pagesize=self.pagesize)
self.doc.addPageTemplates([ptemp])
@ -192,10 +194,9 @@ class PdfDoc(TextDoc):
self.tblstyle = []
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(width * percent * cm)
self.cur_table_cols.append(int(width * percent * cm))
def end_table(self):
ts = reportlab.platypus.tables.TableStyle(self.tblstyle)

View File

@ -570,6 +570,8 @@ class TextDoc:
self.rmargin = 2.54
self.title = ""
print self.height, self.width
self.font = FontStyle()
self.style_list = styles.get_styles()
self.table_styles = {}

View File

@ -79,6 +79,22 @@ def dump_event(g,event,index=1):
if event:
dump_my_event(g,event.getName(),event,index)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def conf_priv(obj):
if obj.getConfidence() != 2:
cnf = ' conf="%d" ' % obj.getConfidence()
else:
cnf = ''
if obj.getPrivacy() != 0:
priv = ' priv="%d"' % obj.getPrivacy()
else:
priv = ''
return "%s%s" % (cnf,priv)
#-------------------------------------------------------------------------
#
#
@ -96,8 +112,7 @@ def dump_my_event(g,name,event,index=1):
return
sp = " " * index
g.write('%s<event type="%s" conf="%d" priv="%d">\n' % \
(sp,fix(name),event.getConfidence(),event.getPrivacy()))
g.write('%s<event type="%s"%s>\n' % (sp,fix(name),conf_priv(event)))
write_line(g,"date",date,index+1)
write_line(g,"place",place,index+1)
write_line(g,"description",description,index+1)
@ -122,9 +137,9 @@ def dump_source_ref(g,source_ref,index=1):
d = source_ref.getDate().getSaveDate()
g.write(" " * index)
if p == "" and c == "" and t == "" and d == "":
g.write("<sourceref ref=\"%s\"/>\n" % source.getId())
g.write('<sourceref ref="%s"/>\n' % source.getId())
else:
g.write("<sourceref ref=\"%s\">\n" % source.getId())
g.write('<sourceref ref="%s">\n' % source.getId())
write_line(g,"spage",p,index+1)
writeNote(g,"scomments",c,index+1)
writeNote(g,"stext",t,index+1)
@ -188,8 +203,7 @@ def write_force_line(g,label,value,indent=1):
#-------------------------------------------------------------------------
def dump_name(g,label,name,index=1):
sp = " "*index
g.write('%s<%s conf="%s" priv="%s">\n' % \
(sp,label,name.getConfidence(),name.getPrivacy()))
g.write('%s<%s%s>\n' % (sp,label,conf_priv(name)))
write_line(g,"first",name.getFirstName(),index+1)
write_line(g,"last",name.getSurname(),index+1)
write_line(g,"suffix",name.getSuffix(),index+1)
@ -295,8 +309,7 @@ def exportData(database, filename, callback):
if len(person.getAddressList()) > 0:
g.write(" <addresses>\n")
for address in person.getAddressList():
g.write(' <address conf="%d" priv="%d">\n' % \
(address.getConfidence(), address.getPrivacy()))
g.write(' <address%s">\n' % conf_priv(address))
write_line(g,"date",address.getDateObj().getSaveDate(),5)
write_line(g,"street",address.getStreet(),5)
write_line(g,"city",address.getCity(),5)
@ -313,9 +326,7 @@ def exportData(database, filename, callback):
g.write(" <attributes>\n")
for attr in person.getAttributeList():
if attr.getSourceRef() or attr.getNote():
g.write(' <attribute conf="%d" priv="%d">\n' % \
(attr.getConfidence(),attr.getPrivacy()))
g.write(' <attribute%s>\n' % conf_priv(attr))
write_line(g,"attr_type",attr.getType(),5)
write_line(g,"attr_value",attr.getValue(),5)
dump_source_ref(g,attr.getSourceRef(),5)