Added non standard date support, and improved report generation
svn: r13
This commit is contained in:
parent
408b9da2fb
commit
b54ec041e7
@ -34,6 +34,11 @@ _ = intl.gettext
|
||||
class Date:
|
||||
formatCode = 0
|
||||
BadFormat = _("Unknown Format")
|
||||
Error = _("Illegal Date")
|
||||
|
||||
range = 1
|
||||
normal = 0
|
||||
invalid = -1
|
||||
|
||||
from_str = _("(from|between|bet)")
|
||||
to_str = _("(and|to)")
|
||||
@ -45,6 +50,7 @@ class Date:
|
||||
self.start = SingleDate()
|
||||
self.stop = SingleDate()
|
||||
self.range = 0
|
||||
self.text = ""
|
||||
|
||||
def get_start_date(self):
|
||||
return self.start
|
||||
@ -59,14 +65,18 @@ class Date:
|
||||
#--------------------------------------------------------------------
|
||||
def set(self,text):
|
||||
match = Date.fmt.match(text)
|
||||
if match:
|
||||
matches = match.groups()
|
||||
self.start.set(matches[1])
|
||||
self.stop.set(matches[3])
|
||||
self.range = 1
|
||||
else:
|
||||
self.start.set(text)
|
||||
self.range = 0
|
||||
try:
|
||||
if match:
|
||||
matches = match.groups()
|
||||
self.start.set(matches[1])
|
||||
self.stop.set(matches[3])
|
||||
self.range = 1
|
||||
else:
|
||||
self.start.set(text)
|
||||
self.range = 0
|
||||
except:
|
||||
self.range = -1
|
||||
self.text = text
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -76,9 +86,27 @@ class Date:
|
||||
def getDate(self):
|
||||
function = SingleDate.fmtFunc[Date.formatCode]
|
||||
|
||||
if self.range:
|
||||
if self.range == 1:
|
||||
return _("from") + " " + function(self.start) + " " + \
|
||||
_("to") + " " + function(self.stop)
|
||||
elif self.range == -1:
|
||||
return self.text
|
||||
else:
|
||||
return function(self.start)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def getQuoteDate(self):
|
||||
function = SingleDate.fmtFunc[Date.formatCode]
|
||||
|
||||
if self.range == 1:
|
||||
return _("from") + " " + function(self.start) + " " + \
|
||||
_("to") + " " + function(self.stop)
|
||||
elif self.range == -1 and self.text:
|
||||
return '"' + self.text + '"'
|
||||
else:
|
||||
return function(self.start)
|
||||
|
||||
@ -88,8 +116,10 @@ class Date:
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def getSaveDate(self):
|
||||
if self.range:
|
||||
if self.range == 1:
|
||||
return "FROM " + self.start.getFmt3() + " TO " + self.stop.getFmt3()
|
||||
elif self.range == -1:
|
||||
return self.text
|
||||
else:
|
||||
return self.start.getFmt3()
|
||||
|
||||
@ -99,15 +129,27 @@ class Date:
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def quick_set(self,text):
|
||||
match = Date.fmt.match(text)
|
||||
if match:
|
||||
matches = match.groups()
|
||||
self.start.set(matches[1])
|
||||
self.stop.set(matches[3])
|
||||
self.range = 1
|
||||
else:
|
||||
self.start.quick_set(text)
|
||||
self.range = 0
|
||||
try:
|
||||
if text[0:2] == "FR":
|
||||
match = Date.fmt.match(text)
|
||||
if match:
|
||||
matches = match.groups()
|
||||
self.start.set(matches[1])
|
||||
self.stop.set(matches[3])
|
||||
self.range = 1
|
||||
else:
|
||||
self.range = -1
|
||||
self.text = text
|
||||
else:
|
||||
try:
|
||||
self.start.quick_set(text)
|
||||
self.range = 0
|
||||
except:
|
||||
self.start.set(text)
|
||||
self.range = 0
|
||||
except:
|
||||
self.range = -1
|
||||
self.text = text
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -159,7 +201,7 @@ class SingleDate:
|
||||
re.IGNORECASE)
|
||||
fmt2 = re.compile(start + "(\d+)\s+(\S+)(\s+\d+)?\s*$",
|
||||
re.IGNORECASE)
|
||||
quick= re.compile(start + "(\d+)\s(\S\S\S)\s(\d+)",
|
||||
quick= re.compile(start + "(\d+)?\s(\S\S\S)?\s(\d+)?",
|
||||
re.IGNORECASE)
|
||||
fmt3 = re.compile(start + "(\d+)\s*[./-]\s*(\d+)\s*[./-]\s*(\d+)\s*$",
|
||||
re.IGNORECASE)
|
||||
@ -604,6 +646,15 @@ class SingleDate:
|
||||
else:
|
||||
self.setYear(-1)
|
||||
return 1
|
||||
|
||||
match = SingleDate.fmt5.match(text)
|
||||
if match != None:
|
||||
matches = match.groups()
|
||||
self.getMode(matches[0])
|
||||
self.setMonth(-1)
|
||||
self.setDay(-1)
|
||||
self.setYear(string.atoi(matches[1]))
|
||||
return 1
|
||||
|
||||
match = SingleDate.fmt1.match(text)
|
||||
if match != None:
|
||||
@ -645,15 +696,6 @@ class SingleDate:
|
||||
self.setYear(-1)
|
||||
return 1
|
||||
|
||||
match = SingleDate.fmt5.match(text)
|
||||
if match != None:
|
||||
matches = match.groups()
|
||||
self.getMode(matches[0])
|
||||
self.setMonth(-1)
|
||||
self.setDay(-1)
|
||||
self.setYear(string.atoi(matches[1]))
|
||||
return 1
|
||||
|
||||
match = SingleDate.fmt4.match(text)
|
||||
if match != None:
|
||||
matches = match.groups()
|
||||
@ -677,7 +719,7 @@ class SingleDate:
|
||||
self.setYear(-1)
|
||||
return 1
|
||||
|
||||
raise Date.BadFormat,text
|
||||
raise Date.Error,text
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -699,7 +741,12 @@ class SingleDate:
|
||||
self.setYear(string.atoi(val))
|
||||
else:
|
||||
self.setYear(-1)
|
||||
|
||||
else:
|
||||
self.setYear(-1)
|
||||
self.setMonth(-1)
|
||||
self.setDay(-1)
|
||||
raise Date.Error,text
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
|
138
gramps/src/DrawDoc.py
Normal file
138
gramps/src/DrawDoc.py
Normal file
@ -0,0 +1,138 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
from TextDoc import *
|
||||
|
||||
|
||||
class GraphicsStyle:
|
||||
def __init__(self,obj=None):
|
||||
if obj:
|
||||
self.height = obj.height
|
||||
self.width = obj.width
|
||||
self.para_name = obj.para_name
|
||||
self.shadow = obj.shadow
|
||||
self.color = obj.color
|
||||
else:
|
||||
self.height = 0
|
||||
self.width = 0
|
||||
self.para_name = ""
|
||||
self.shadow = 0
|
||||
self.color = (255,255,255)
|
||||
|
||||
def set_height(self,val):
|
||||
self.height = val
|
||||
|
||||
def set_width(self,val):
|
||||
self.width = val
|
||||
|
||||
def set_paragraph_style(self,val):
|
||||
self.para_name = val
|
||||
|
||||
def set_shadow(self,val):
|
||||
self.shadow = val
|
||||
|
||||
def set_color(self,val):
|
||||
self.color = val
|
||||
|
||||
def get_height(self):
|
||||
return self.height
|
||||
|
||||
def get_width(self):
|
||||
return self.width
|
||||
|
||||
def get_paragraph_style(self):
|
||||
return self.para_name
|
||||
|
||||
def get_shadow(self):
|
||||
return self.shadow
|
||||
|
||||
def get_color(self):
|
||||
return self.color
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class DrawDoc:
|
||||
def __init__(self,type,orientation=PAPER_PORTRAIT):
|
||||
self.orientation = orientation
|
||||
if orientation == PAPER_PORTRAIT:
|
||||
self.width = type.get_width()
|
||||
self.height = type.get_height()
|
||||
else:
|
||||
self.width = type.get_height()
|
||||
self.height = type.get_width()
|
||||
self.tmargin = 2.54
|
||||
self.bmargin = 2.54
|
||||
self.lmargin = 2.54
|
||||
self.rmargin = 2.54
|
||||
|
||||
self.font = FontStyle()
|
||||
self.actfont = self.font
|
||||
self.paragraph_styles = {}
|
||||
self.draw_styles = {}
|
||||
self.name = ""
|
||||
|
||||
def get_usable_width(self):
|
||||
return self.width - (self.rmargin + self.lmargin)
|
||||
|
||||
def get_usable_height(self):
|
||||
return self.height - (self.tmargin + self.bmargin)
|
||||
|
||||
def get_right_margin(self):
|
||||
return self.rmargin
|
||||
|
||||
def get_left_margin(self):
|
||||
return self.lmargin
|
||||
|
||||
def get_top_margin(self):
|
||||
return self.tmargin
|
||||
|
||||
def get_bottom_margin(self):
|
||||
return self.bmargin
|
||||
|
||||
def creator(self,name):
|
||||
self.name = name
|
||||
|
||||
def add_paragraph_style(self,name,style):
|
||||
self.paragraph_styles[name] = ParagraphStyle(style)
|
||||
|
||||
def add_draw_style(self,name,style):
|
||||
self.draw_styles[name] = GraphicsStyle(style)
|
||||
|
||||
def open(self,filename):
|
||||
pass
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
|
||||
def start_page(self,orientation=None):
|
||||
pass
|
||||
|
||||
def end_page(self):
|
||||
pass
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
pass
|
||||
|
||||
def draw_line(self,style,x1,y1,x2,y2):
|
||||
pass
|
||||
|
@ -353,7 +353,7 @@ class EditPerson:
|
||||
|
||||
self.event_index = 0
|
||||
for event in self.person.getEventList():
|
||||
self.event_list.append([event.getName(),event.getDate(),\
|
||||
self.event_list.append([event.getName(),event.getQuoteDate(),\
|
||||
event.getPlace()])
|
||||
self.event_list.set_row_data(self.event_index,event)
|
||||
self.event_index = self.event_index + 1
|
||||
@ -898,12 +898,7 @@ def update_event(event,name,date,place,desc):
|
||||
utils.modified()
|
||||
|
||||
if event.getDate() != date:
|
||||
try:
|
||||
event.setDate(date)
|
||||
except Date.BadFormat,msg:
|
||||
msg1 = _(" is not a valid date format, and has been\n")
|
||||
msg2 = _("ignored as the date of the event.")
|
||||
GnomeWarningDialog(str(msg) + msg1 + msg2)
|
||||
event.setDate(date)
|
||||
utils.modified()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -989,12 +984,7 @@ def on_apply_person_clicked(obj):
|
||||
dplace = edit_person_obj.dplace.get_text()
|
||||
|
||||
newBirth = Event()
|
||||
try:
|
||||
newBirth.set("Birth",bdate,bplace,"")
|
||||
except Date.BadFormat,msg:
|
||||
msg1 = _(" is not a valid date format, and has been\n")
|
||||
msg2 = _("ignored as the date of the event.")
|
||||
GnomeWarningDialog(str(msg) + msg1 + msg2)
|
||||
newBirth.set("Birth",bdate,bplace,"")
|
||||
|
||||
if newBirth.compare(birth):
|
||||
person.setBirth(newBirth)
|
||||
@ -1002,12 +992,7 @@ def on_apply_person_clicked(obj):
|
||||
|
||||
newDeath = Event()
|
||||
|
||||
try:
|
||||
newDeath.set("Death",ddate,dplace,"")
|
||||
except Date.BadFormat,msg:
|
||||
msg1 = _(" is not a valid date format, and has been\n")
|
||||
msg2 = _("ignored as the date of the event.")
|
||||
GnomeWarningDialog(str(msg) + msg1 + msg2)
|
||||
newDeath.set("Death",ddate,dplace,"")
|
||||
|
||||
if newDeath.compare(death):
|
||||
person.setDeath(newDeath)
|
||||
|
229
gramps/src/HtmlDoc.py
Normal file
229
gramps/src/HtmlDoc.py
Normal file
@ -0,0 +1,229 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
import string
|
||||
import re
|
||||
|
||||
from TextDoc import *
|
||||
from latin_utf8 import latin_to_utf8
|
||||
import const
|
||||
|
||||
_top = [
|
||||
'<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n',
|
||||
'<HTML>\n',
|
||||
'<HEAD>\n',
|
||||
'<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n',
|
||||
'<TITLE>\n',
|
||||
'</TITLE>\n',
|
||||
'<STYLE type="text/css">\n',
|
||||
'<!--\n',
|
||||
'BODY { background-color: #ffffff }\n',
|
||||
'.parent_name { font-family: Arial; font-style: bold }\n',
|
||||
'.child_name { font-family: Arial; font-style: bold }\n',
|
||||
'-->\n',
|
||||
'</STYLE>\n',
|
||||
'</HEAD>\n',
|
||||
'<BODY>\n',
|
||||
'<!-- START -->\n'
|
||||
]
|
||||
|
||||
_bottom = [
|
||||
'<!-- STOP -->\n',
|
||||
'</BODY>\n',
|
||||
'</HTML>\n'
|
||||
]
|
||||
|
||||
class HtmlDoc(TextDoc):
|
||||
|
||||
def __init__(self,template):
|
||||
TextDoc.__init__(self,PaperStyle("",0,0),None)
|
||||
self.f = None
|
||||
self.filename = None
|
||||
self.template = template
|
||||
self.top = []
|
||||
self.bottom = []
|
||||
|
||||
def open(self,filename):
|
||||
|
||||
start = re.compile(r"<!--\s*START\s*-->")
|
||||
stop = re.compile(r"<!--\s*STOP\s*-->")
|
||||
|
||||
top_add = 1
|
||||
bottom_add = 0
|
||||
|
||||
if self.template != "":
|
||||
try:
|
||||
templateFile = open(self.template,"r")
|
||||
for line in templateFile.readlines():
|
||||
if top_add == 1:
|
||||
self.top.append(line)
|
||||
match = start.search(line)
|
||||
if match != None:
|
||||
top_add = 0
|
||||
elif bottom_add == 0:
|
||||
match = stop.search(line)
|
||||
if match != None:
|
||||
bottom_add = 1
|
||||
self.bottom.append(line)
|
||||
else:
|
||||
self.bottom.append(line)
|
||||
templateFile.close()
|
||||
if top_add == 1:
|
||||
mymsg = "Did not file '<!-- START -->' marker in the template"
|
||||
gnome.ui.GnomeErrorDialog(mymsg)
|
||||
except IOError,msg:
|
||||
import gnome.ui
|
||||
|
||||
mymsg = "Could not open the template file\n" + str(msg) + "\n" +\
|
||||
"Using default template"
|
||||
gnome.ui.GnomeWarningDialog(mymsg)
|
||||
self.bottom = _bottom
|
||||
self.top = _top
|
||||
except:
|
||||
import gnome.ui
|
||||
|
||||
mymsg = "Could not open the template file\n" + "Using default template"
|
||||
gnome.ui.GnomeWarningDialog(mymsg)
|
||||
self.bottom = _bottom
|
||||
self.top = _top
|
||||
else:
|
||||
self.bottom = _bottom
|
||||
self.top = _top
|
||||
|
||||
if filename[-5:] == ".html" or filename[-4:0] == ".htm":
|
||||
self.filename = filename
|
||||
else:
|
||||
self.filename = filename + ".html"
|
||||
|
||||
self.f = open(self.filename,"w")
|
||||
for line in self.top:
|
||||
self.f.write(line)
|
||||
|
||||
self.f.write('<style type="text/css">\n<!--\n')
|
||||
for key in self.cell_styles.keys():
|
||||
style = self.cell_styles[key]
|
||||
|
||||
self.f.write('.')
|
||||
self.f.write(key)
|
||||
pad = "%.3fcm " % style.get_padding()
|
||||
self.f.write(' { padding:' + pad + pad + pad + pad +'; ')
|
||||
if style.get_top_border():
|
||||
self.f.write('border-top:thin solid #000000; ')
|
||||
else:
|
||||
self.f.write('border-top:none; ')
|
||||
if style.get_bottom_border():
|
||||
self.f.write('border-bottom:thin solid #000000; ')
|
||||
else:
|
||||
self.f.write('border-bottom:none; ')
|
||||
if style.get_right_border():
|
||||
self.f.write('border-right:thin solid #000000; ')
|
||||
else:
|
||||
self.f.write('border-right:none; ')
|
||||
if style.get_left_border():
|
||||
self.f.write('border-left:thin solid #000000 }\n')
|
||||
else:
|
||||
self.f.write('border-left:none }\n')
|
||||
|
||||
for key in self.style_list.keys():
|
||||
style = self.style_list[key]
|
||||
font = style.get_font()
|
||||
self.f.write('.')
|
||||
self.f.write(key)
|
||||
self.f.write(' { font-size:' + str(font.get_size()) + 'pt; ')
|
||||
|
||||
self.f.write('color:#%02x%02x%02x; ' % font.get_color())
|
||||
|
||||
align = style.get_alignment()
|
||||
if align == PARA_ALIGN_LEFT:
|
||||
self.f.write('text-align:left; ')
|
||||
elif align == PARA_ALIGN_CENTER:
|
||||
self.f.write('text-align:center; ')
|
||||
elif align == PARA_ALIGN_RIGHT:
|
||||
self.f.write('text-align:right; ')
|
||||
elif align == PARA_ALIGN_JUSTIFY:
|
||||
self.f.write('text-align:justify; ')
|
||||
self.f.write('text-indent:%.2fcm; ' % style.get_first_indent())
|
||||
self.f.write('margin-right:%.2fcm; ' % style.get_right_margin())
|
||||
self.f.write('margin-left:%.2fcm; ' % style.get_left_margin())
|
||||
if font.get_italic():
|
||||
self.f.write('font-style:italic; ')
|
||||
if font.get_bold():
|
||||
self.f.write('font-weight:bold; ')
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
self.f.write('font-family:"Helvetica","Arial","sans-serif"}\n')
|
||||
else:
|
||||
self.f.write('font-family:"Times New Roman","Times","serif"}\n')
|
||||
|
||||
|
||||
self.f.write('-->\n</style>\n')
|
||||
|
||||
def close(self):
|
||||
for line in self.bottom:
|
||||
self.f.write(line)
|
||||
self.f.close()
|
||||
|
||||
def start_table(self,name,style):
|
||||
self.tbl = self.table_styles[style]
|
||||
self.f.write('<table width="%d%%" cellspacing="0">\n' % self.tbl.get_width())
|
||||
|
||||
def end_table(self):
|
||||
self.f.write('</table>\n')
|
||||
|
||||
def start_row(self):
|
||||
self.col = 0
|
||||
self.f.write('<tr>\n')
|
||||
|
||||
def end_row(self):
|
||||
self.f.write('</tr>\n')
|
||||
|
||||
def start_cell(self,style_name,span=1):
|
||||
self.empty = 1
|
||||
self.f.write('<td')
|
||||
if span > 1:
|
||||
self.f.write(' colspan="' + str(span) + '"')
|
||||
else:
|
||||
self.f.write(' width="')
|
||||
self.f.write(str(self.tbl.get_column_width(self.col)))
|
||||
self.f.write('%"')
|
||||
self.f.write(' class="')
|
||||
self.f.write(style_name)
|
||||
self.f.write('">')
|
||||
self.col = self.col + 1
|
||||
|
||||
def end_cell(self):
|
||||
self.f.write('</td>\n')
|
||||
|
||||
def start_paragraph(self,style_name):
|
||||
self.f.write('<p class="' + style_name + '">')
|
||||
|
||||
def end_paragraph(self):
|
||||
if self.empty == 1:
|
||||
self.f.write(' ')
|
||||
self.empty = 0
|
||||
self.f.write('</p>\n')
|
||||
|
||||
def write_text(self,text):
|
||||
if text != "":
|
||||
self.empty = 0
|
||||
text = string.replace(text,'\n','<br>>')
|
||||
self.f.write(text)
|
||||
|
@ -124,7 +124,7 @@ class Marriage:
|
||||
def add_event(self,text,event):
|
||||
if not event:
|
||||
return
|
||||
self.event_list.append([text,event.getDate(),event.getPlace()])
|
||||
self.event_list.append([text,event.getQuoteDate(),event.getPlace()])
|
||||
self.event_list.set_row_data(self.lines,event)
|
||||
self.lines = self.lines + 1
|
||||
|
||||
|
463
gramps/src/OpenDrawDoc.py
Normal file
463
gramps/src/OpenDrawDoc.py
Normal file
@ -0,0 +1,463 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
import string
|
||||
|
||||
from TextDoc import *
|
||||
from DrawDoc import *
|
||||
|
||||
from latin_utf8 import latin_to_utf8
|
||||
import const
|
||||
|
||||
class OpenDrawDoc(DrawDoc):
|
||||
|
||||
def __init__(self,type,orientation):
|
||||
DrawDoc.__init__(self,type,orientation)
|
||||
self.f = None
|
||||
self.filename = None
|
||||
self.level = 0
|
||||
self.time = "0000-00-00T00:00:00"
|
||||
self.page = 0
|
||||
|
||||
def open(self,filename):
|
||||
import time
|
||||
|
||||
t = time.localtime(time.time())
|
||||
self.time = "%04d-%02d-%02dT%02d:%02d:%02d" % \
|
||||
(t[0],t[1],t[2],t[3],t[4],t[5])
|
||||
|
||||
if filename[-4:] != ".sxd":
|
||||
self.filename = filename + ".sxd"
|
||||
else:
|
||||
self.filename = filename
|
||||
|
||||
tempfile.tempdir = "/tmp"
|
||||
self.tempdir = tempfile.mktemp()
|
||||
os.mkdir(self.tempdir,0700)
|
||||
os.mkdir(self.tempdir + os.sep + "Pictures")
|
||||
os.mkdir(self.tempdir + os.sep + "META-INF")
|
||||
|
||||
self.f = open(self.tempdir + os.sep + "content.xml","w")
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<office:document-content ')
|
||||
self.f.write('xmlns:office="http://openoffice.org/2000/office" ')
|
||||
self.f.write('xmlns:style="http://openoffice.org/2000/style" ')
|
||||
self.f.write('xmlns:text="http://openoffice.org/2000/text" ')
|
||||
self.f.write('xmlns:table="http://openoffice.org/2000/table" ')
|
||||
self.f.write('xmlns:draw="http://openoffice.org/2000/drawing" ')
|
||||
self.f.write('xmlns:fo="http://www.w3.org/1999/XSL/Format" ')
|
||||
self.f.write('xmlns:xlink="http://www.w3.org/1999/xlink" ')
|
||||
self.f.write('xmlns:number="http://openoffice.org/2000/datastyle" ')
|
||||
self.f.write('xmlns:svg="http://www.w3.org/2000/svg" ')
|
||||
self.f.write('xmlns:chart="http://openoffice.org/2000/chart" ')
|
||||
self.f.write('xmlns:dr3d="http://openoffice.org/2000/dr3d" ')
|
||||
self.f.write('xmlns:math="http://www.w3.org/1998/Math/MathML" ')
|
||||
self.f.write('xmlns:form="http://openoffice.org/2000/form" ')
|
||||
self.f.write('xmlns:script="http://openoffice.org/2000/script" ')
|
||||
self.f.write('office:class="text" office:version="0.9">\n')
|
||||
self.f.write('<office:script/>\n')
|
||||
self.f.write('<office:font-decls>\n')
|
||||
self.f.write('<style:font-decl style:name="Times New Roman" ')
|
||||
self.f.write('fo:font-family="'Times New Roman'" ')
|
||||
self.f.write('style:font-family-generic="roman" ')
|
||||
self.f.write('style:font-pitch="variable"/>\n')
|
||||
self.f.write('<style:font-decl style:name="Arial" ')
|
||||
self.f.write('fo:font-family="Arial" ')
|
||||
self.f.write('style:font-family-generic="swiss" ')
|
||||
self.f.write('style:font-pitch="variable"/>\n')
|
||||
self.f.write('</office:font-decls>\n')
|
||||
self.f.write('<office:automatic-styles>\n')
|
||||
self.f.write('<style:style style:name="P1" style:family="paragraph">\n')
|
||||
self.f.write('<style:properties fo:margin-left="0cm" ')
|
||||
self.f.write('fo:margin-right="0cm" fo:text-indent="0cm"/>\n')
|
||||
self.f.write('</style:style>\n')
|
||||
for key in self.paragraph_styles.keys():
|
||||
style = self.paragraph_styles[key]
|
||||
self.f.write('<style:style style:name="T' + key + '" ')
|
||||
self.f.write('style:family="text">\n')
|
||||
self.f.write('<style:properties ')
|
||||
|
||||
font = style.get_font()
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
self.f.write('fo:font-family="Arial" ')
|
||||
else:
|
||||
self.f.write('fo:font-family="'Times New Roman'" ')
|
||||
self.f.write('fo:font-size="' + str(font.get_size()) + 'pt" ')
|
||||
color = font.get_color()
|
||||
self.f.write('fo:color="#%02x%02x%02x" ' % color)
|
||||
if font.get_bold():
|
||||
self.f.write('fo:font-weight="bold" ')
|
||||
if font.get_italic():
|
||||
self.f.write('fo:font-style="italic" ')
|
||||
if font.get_underline():
|
||||
self.f.write('style:text-underline="single" ')
|
||||
self.f.write('style:text-underline-color="font-color" ')
|
||||
self.f.write('/>\n')
|
||||
self.f.write('</style:style>\n')
|
||||
self.f.write('</office:automatic-styles>\n')
|
||||
self.f.write('<office:body>\n')
|
||||
|
||||
def close(self):
|
||||
self.f.write('</office:body>\n')
|
||||
self.f.write('</office:document-content>\n')
|
||||
self.f.close()
|
||||
self._write_styles_file()
|
||||
self._write_manifest()
|
||||
self._write_meta_file()
|
||||
self._write_zip()
|
||||
|
||||
def _write_zip(self):
|
||||
|
||||
if os.path.isfile(self.filename):
|
||||
os.unlink(self.filename)
|
||||
|
||||
os.system("cd " + self.tempdir + "; " + const.zipcmd + " " \
|
||||
+ self.filename + " .")
|
||||
|
||||
os.unlink(self.tempdir + os.sep + "META-INF" + os.sep + "manifest.xml")
|
||||
os.unlink(self.tempdir + os.sep + "content.xml")
|
||||
os.unlink(self.tempdir + os.sep + "meta.xml")
|
||||
os.unlink(self.tempdir + os.sep + "styles.xml")
|
||||
# for image in self.image_list:
|
||||
# os.unlink(self.tempdir + os.sep + "Pictures" + os.sep + image)
|
||||
os.rmdir(self.tempdir + os.sep + "Pictures")
|
||||
os.rmdir(self.tempdir + os.sep + "META-INF")
|
||||
os.rmdir(self.tempdir)
|
||||
|
||||
def _write_styles_file(self):
|
||||
file = self.tempdir + os.sep + "styles.xml"
|
||||
self.f = open(file,"w")
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<office:document-styles ')
|
||||
self.f.write('xmlns:office="http://openoffice.org/2000/office" ')
|
||||
self.f.write('xmlns:style="http://openoffice.org/2000/style" ')
|
||||
self.f.write('xmlns:text="http://openoffice.org/2000/text" ')
|
||||
self.f.write('xmlns:table="http://openoffice.org/2000/table" ')
|
||||
self.f.write('xmlns:draw="http://openoffice.org/2000/drawing" ')
|
||||
self.f.write('xmlns:fo="http://www.w3.org/1999/XSL/Format" ')
|
||||
self.f.write('xmlns:xlink="http://www.w3.org/1999/xlink" ')
|
||||
self.f.write('xmlns:number="http://openoffice.org/2000/datastyle" ')
|
||||
self.f.write('xmlns:svg="http://www.w3.org/2000/svg" ')
|
||||
self.f.write('xmlns:chart="http://openoffice.org/2000/chart" ')
|
||||
self.f.write('xmlns:dr3d="http://openoffice.org/2000/dr3d" ')
|
||||
self.f.write('xmlns:math="http://www.w3.org/1998/Math/MathML" ')
|
||||
self.f.write('xmlns:form="http://openoffice.org/2000/form" ')
|
||||
self.f.write('xmlns:script="http://openoffice.org/2000/script" ')
|
||||
self.f.write('office:class="text" office:version="0.9">\n')
|
||||
self.f.write('<office:font-decls>\n')
|
||||
self.f.write('<style:font-decl style:name="Times New Roman" ')
|
||||
self.f.write('fo:font-family="'Times New Roman'" ')
|
||||
self.f.write('style:font-family-generic="roman" ')
|
||||
self.f.write('style:font-pitch="variable"/>\n')
|
||||
self.f.write('<style:font-decl style:name="Arial" ')
|
||||
self.f.write('fo:font-family="Arial" ')
|
||||
self.f.write('style:font-family-generic="swiss" ')
|
||||
self.f.write('style:font-pitch="variable"/>\n')
|
||||
self.f.write('</office:font-decls>\n')
|
||||
|
||||
self.f.write('<office:styles>\n')
|
||||
self.f.write('<draw:marker draw:name="Arrow" svg:viewBox="0 0 200 400"')
|
||||
self.f.write(' svg:d="m100 0 100 400h-200z"/>\n')
|
||||
self.f.write('<style:default-style style:family="graphics">\n')
|
||||
self.f.write('<style:properties fo:color="#000000" ')
|
||||
self.f.write('fo:font-family="'Times New Roman'" ')
|
||||
self.f.write('style:font-style-name="" style:font-family-generic="roman" ')
|
||||
self.f.write('style:font-pitch="variable" fo:font-size="24pt" ')
|
||||
self.f.write('fo:language="en" fo:country="US" ')
|
||||
self.f.write('style:line-break="strict"/>\n')
|
||||
self.f.write('</style:default-style>\n')
|
||||
|
||||
self.f.write('<style:style style:name="standard" style:family="graphics">\n')
|
||||
self.f.write('<style:properties draw:stroke="solid" ')
|
||||
self.f.write('svg:stroke-width="0cm" ')
|
||||
self.f.write('svg:stroke-color="#000000" ')
|
||||
self.f.write('draw:marker-start-width="0.3cm" ')
|
||||
self.f.write('draw:marker-start-center="false" ')
|
||||
self.f.write('draw:marker-end-width="0.3cm" ')
|
||||
self.f.write('draw:marker-end-center="false" ')
|
||||
self.f.write('draw:fill="solid" ')
|
||||
self.f.write('draw:fill-color="#00b8ff" ')
|
||||
self.f.write('draw:shadow="hidden" ')
|
||||
self.f.write('draw:shadow-offset-x="0.3cm" ')
|
||||
self.f.write('draw:shadow-offset-y="0.3cm" ')
|
||||
self.f.write('draw:shadow-color="#808080" ')
|
||||
self.f.write('fo:color="#000000" ')
|
||||
self.f.write('style:text-outline="false" ')
|
||||
self.f.write('style:text-crossing-out="none" ')
|
||||
self.f.write('fo:font-family="'Times New Roman'" ')
|
||||
self.f.write('style:font-style-name="" ')
|
||||
self.f.write('style:font-family-generic="roman" ')
|
||||
self.f.write('style:font-pitch="variable" ')
|
||||
self.f.write('fo:font-size="24pt" ')
|
||||
self.f.write('fo:font-style="normal" ')
|
||||
self.f.write('fo:text-shadow="none" ')
|
||||
self.f.write('style:text-underline="none" ')
|
||||
self.f.write('fo:font-weight="normal" ')
|
||||
self.f.write('fo:line-height="100%" ')
|
||||
self.f.write('fo:text-align="start" ')
|
||||
self.f.write('text:enable-numbering="false" ')
|
||||
self.f.write('fo:margin-left="0cm" ')
|
||||
self.f.write('fo:margin-right="0cm" ')
|
||||
self.f.write('fo:text-indent="0cm" ')
|
||||
self.f.write('fo:margin-top="0cm" ')
|
||||
self.f.write('fo:margin-bottom="0cm"/>\n')
|
||||
self.f.write('</style:style>\n')
|
||||
|
||||
for style_name in self.draw_styles.keys():
|
||||
style = self.draw_styles[style_name]
|
||||
self.f.write('<style:style style:name="')
|
||||
self.f.write(style_name)
|
||||
self.f.write('" style:family="graphics" ')
|
||||
self.f.write('style:parent-style-name="standard">\n')
|
||||
self.f.write('<style:properties ')
|
||||
self.f.write('draw:fill-color="#%02x%02x%02x" ' % style.get_color())
|
||||
if style.get_shadow():
|
||||
self.f.write('draw:shadow="visible" ')
|
||||
else:
|
||||
self.f.write('draw:shadow="hidden" ')
|
||||
pname = style.get_paragraph_style()
|
||||
self.f.write('/>\n')
|
||||
self.f.write('</style:style>\n')
|
||||
|
||||
self.f.write('<style:style style:name="Standard" ')
|
||||
self.f.write('style:family="paragraph" style:class="text"/>\n')
|
||||
for key in self.paragraph_styles.keys():
|
||||
style = self.paragraph_styles[key]
|
||||
self.f.write('<style:style style:name="' + key + '" ')
|
||||
self.f.write('style:family="paragraph" ')
|
||||
self.f.write('style:parent-style-name="Standard" ')
|
||||
self.f.write('style:class="text">\n')
|
||||
self.f.write('<style:properties ')
|
||||
|
||||
if style.get_padding() != 0.0:
|
||||
self.f.write('fo:padding="%.3fcm" ' % style.get_padding())
|
||||
|
||||
align = style.get_alignment()
|
||||
if align == PARA_ALIGN_LEFT:
|
||||
self.f.write('fo:text-align="left" ')
|
||||
elif align == PARA_ALIGN_RIGHT:
|
||||
self.f.write('fo:text-align="right" ')
|
||||
elif align == PARA_ALIGN_CENTER:
|
||||
self.f.write('fo:text-align="center" ')
|
||||
self.f.write('style:justify-single-word="false" ')
|
||||
else:
|
||||
self.f.write('fo:text-align="justify" ')
|
||||
self.f.write('style:justify-single-word="false" ')
|
||||
font = style.get_font()
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
self.f.write('style:font-name="Arial" ')
|
||||
else:
|
||||
self.f.write('style:font-name="Times New Roman" ')
|
||||
self.f.write('fo:font-size="' + str(font.get_size()) + 'pt" ')
|
||||
color = font.get_color()
|
||||
self.f.write('fo:color="#%02x%02x%02x" ' % color)
|
||||
if font.get_bold():
|
||||
self.f.write('fo:font-weight="bold" ')
|
||||
if font.get_italic():
|
||||
self.f.write('fo:font-style="italic" ')
|
||||
if font.get_underline():
|
||||
self.f.write('style:text-underline="single" ')
|
||||
self.f.write('style:text-underline-color="font-color" ')
|
||||
self.f.write('fo:text-indent="%.2fcm" ' % style.get_first_indent())
|
||||
self.f.write('fo:margin-right="%.2fcm" ' % style.get_right_margin())
|
||||
self.f.write('fo:margin-left="%.2fcm" ' % style.get_left_margin())
|
||||
self.f.write('fo:margin-top="0cm" ')
|
||||
self.f.write('fo:margin-bottom="0.212cm"')
|
||||
self.f.write('/>\n')
|
||||
self.f.write('</style:style>\n')
|
||||
|
||||
# Current no leading number format for headers
|
||||
|
||||
self.f.write('</office:styles>\n')
|
||||
self.f.write('<office:automatic-styles>\n')
|
||||
self.f.write('<style:page-master style:name="PM0">\n')
|
||||
self.f.write('<style:properties fo:page-width="%.2fcm" ' % self.width)
|
||||
self.f.write('fo:page-height="%.2fcm" ' % self.height)
|
||||
self.f.write('style:num-format="1" ')
|
||||
if self.orientation == PAPER_PORTRAIT:
|
||||
self.f.write('style:print-orientation="portrait" ')
|
||||
else:
|
||||
self.f.write('style:print-orientation="landscape" ')
|
||||
self.f.write('fo:margin-top="%.2fcm" ' % self.tmargin)
|
||||
self.f.write('fo:margin-bottom="%.2fcm" ' % self.bmargin)
|
||||
self.f.write('fo:margin-left="%.2fcm" ' % self.lmargin)
|
||||
self.f.write('fo:margin-right="%.2fcm"/>\n' % self.rmargin)
|
||||
self.f.write('</style:page-master>\n')
|
||||
self.f.write('<style:style style:name="dp1" style:family="drawing-page">\n')
|
||||
self.f.write('<style:properties draw:background-size="border" draw:fill="none"/>\n')
|
||||
self.f.write('</style:style>\n')
|
||||
self.f.write('</office:automatic-styles>\n')
|
||||
self.f.write('<office:master-styles>\n')
|
||||
self.f.write('<draw:layer-set>\n')
|
||||
self.f.write('<draw:layer draw:name="layout" draw:locked="false" ')
|
||||
self.f.write('draw:printable="true" draw:visible="true"/>\n')
|
||||
self.f.write('<draw:layer draw:name="background" draw:locked="false" ')
|
||||
self.f.write('draw:printable="true" draw:visible="true"/>\n')
|
||||
self.f.write('<draw:layer draw:name="backgroundobjects" ')
|
||||
self.f.write('draw:locked="false" draw:printable="true" draw:visible="true"/>\n')
|
||||
self.f.write('<draw:layer draw:name="controls" draw:locked="false" ')
|
||||
self.f.write('draw:printable="true" draw:visible="true"/>\n')
|
||||
self.f.write('<draw:layer draw:name="measurelines" draw:locked="false" ')
|
||||
self.f.write('draw:printable="true" draw:visible="true"/>\n')
|
||||
self.f.write('</draw:layer-set>\n')
|
||||
self.f.write('<style:master-page style:name="Home" ')
|
||||
self.f.write('style:page-master-name="PM0" draw:style-name="dp1"/>\n')
|
||||
self.f.write('</office:master-styles>\n')
|
||||
self.f.close()
|
||||
|
||||
def start_paragraph(self,style_name):
|
||||
self.f.write('<text:p text:style-name="%s">' % style_name)
|
||||
|
||||
def end_paragraph(self):
|
||||
self.f.write('</text:p>\n')
|
||||
|
||||
def write_text(self,text):
|
||||
text = string.replace(text,'\t','<text:tab-stop/>')
|
||||
text = string.replace(text,'\n','<text:line-break/>')
|
||||
self.f.write(latin_to_utf8(text))
|
||||
|
||||
def _write_manifest(self):
|
||||
file = self.tempdir + os.sep + "META-INF" + os.sep + "manifest.xml"
|
||||
self.f = open(file,"w")
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<manifest:manifest ')
|
||||
self.f.write('xmlns:manifest="http://openoffice.org/2001/manifest">')
|
||||
self.f.write('<manifest:file-entry ')
|
||||
self.f.write('manifest:media-type="application/vnd.sun.xml.writer" ')
|
||||
self.f.write('manifest:full-path="/"/>')
|
||||
self.f.write('<manifest:file-entry manifest:media-type="" ')
|
||||
self.f.write('manifest:full-path="Pictures/"/>')
|
||||
self.f.write('<manifest:file-entry manifest:media-type="text/xml" ')
|
||||
self.f.write('manifest:full-path="content.xml"/>')
|
||||
self.f.write('<manifest:file-entry manifest:media-type="text/xml" ')
|
||||
self.f.write('manifest:full-path="styles.xml"/>')
|
||||
self.f.write('<manifest:file-entry manifest:media-type="text/xml" ')
|
||||
self.f.write('manifest:full-path="meta.xml"/>')
|
||||
#self.f.write('<manifest:file-entry manifest:media-type="text/xml" ')
|
||||
#self.f.write('manifest:full-path="settings.xml"/>')
|
||||
self.f.write('</manifest:manifest>\n')
|
||||
self.f.close()
|
||||
|
||||
def _write_meta_file(self):
|
||||
file = self.tempdir + os.sep + "meta.xml"
|
||||
name = latin_to_utf8(self.name)
|
||||
self.f = open(file,"w")
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<office:document-meta ')
|
||||
self.f.write('xmlns:office="http://openoffice.org/2000/office" ')
|
||||
self.f.write('xmlns:xlink="http://www.w3.org/1999/xlink" ')
|
||||
self.f.write('xmlns:dc="http://purl.org/dc/elements/1.1/" ')
|
||||
self.f.write('xmlns:meta="http://openoffice.org/2000/meta" ')
|
||||
self.f.write('office:class="text" office:version="0.9">\n');
|
||||
self.f.write('<office:meta>\n')
|
||||
self.f.write('<meta:generator>')
|
||||
self.f.write(const.progName + ' ' + const.version)
|
||||
self.f.write('</meta:generator>\n')
|
||||
self.f.write('<meta:initial-creator>')
|
||||
self.f.write(name)
|
||||
self.f.write('</meta:initial-creator>\n')
|
||||
self.f.write('<meta:creation-date>')
|
||||
self.f.write(self.time)
|
||||
self.f.write('</meta:creation-date>\n')
|
||||
self.f.write('<dc:creator>')
|
||||
self.f.write(name)
|
||||
self.f.write('</dc:creator>\n')
|
||||
self.f.write('<dc:date>')
|
||||
self.f.write(self.time)
|
||||
self.f.write('</dc:date>\n')
|
||||
self.f.write('<meta:print-date>0-00-00T00:00:00</meta:print-date>\n')
|
||||
self.f.write('<dc:language>en-US</dc:language>\n')
|
||||
self.f.write('<meta:editing-cycles>1</meta:editing-cycles>\n')
|
||||
self.f.write('<meta:editing-duration>PT0S</meta:editing-duration>\n')
|
||||
self.f.write('<meta:user-defined meta:name="Info 0"/>\n')
|
||||
self.f.write('<meta:user-defined meta:name="Info 1"/>\n')
|
||||
self.f.write('<meta:user-defined meta:name="Info 2"/>\n')
|
||||
self.f.write('<meta:user-defined meta:name="Info 3"/>\n')
|
||||
self.f.write('</office:meta>\n')
|
||||
self.f.write('</office:document-meta>\n')
|
||||
self.f.close()
|
||||
|
||||
def start_page(self,orientation=None):
|
||||
self.page = self.page + 1
|
||||
self.f.write('<draw:page draw:name="page' + str(self.page) + '" ')
|
||||
self.f.write('draw:master-page-name="Home">\n')
|
||||
|
||||
def end_page(self):
|
||||
self.f.write('</draw:page>\n')
|
||||
|
||||
def draw_line(self,style,x1,y1,x2,y2):
|
||||
self.f.write('<draw:line draw:style="')
|
||||
self.f.write(style)
|
||||
self.f.write('" svg:x1="%.3fcm" ' % x1)
|
||||
self.f.write('svg:y1="%.3fcm" ' % y1)
|
||||
self.f.write('svg:x2="%.3fcm" ' % x2)
|
||||
self.f.write('svg:y2="%.3fcm"/>\n' % y2)
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
box_style = self.draw_styles[style]
|
||||
para_name = box_style.get_paragraph_style()
|
||||
|
||||
self.f.write('<draw:rect draw:style-name="')
|
||||
|
||||
self.f.write(style)
|
||||
self.f.write('" draw:layer="layout" ')
|
||||
self.f.write('svg:width="%.3fcm" ' % box_style.get_width())
|
||||
self.f.write('svg:height="%.3fcm" ' % box_style.get_height())
|
||||
self.f.write('svg:x="%.3fcm" ' % float(x))
|
||||
self.f.write('svg:y="%.3fcm"' % float(y))
|
||||
if text != "":
|
||||
text = string.replace(text,'\t','<text:tab-stop/>')
|
||||
text = latin_to_utf8(string.replace(text,'\n','<text:line-break/>'))
|
||||
self.f.write('>\n')
|
||||
self.f.write('<text:p text:style-name="P1">')
|
||||
self.f.write('<text:span text:style-name="T')
|
||||
self.f.write(para_name)
|
||||
self.f.write('">'+text+'</text:span></text:p>\n')
|
||||
self.f.write('</draw:rect>\n')
|
||||
else:
|
||||
self.f.write('/>\n')
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
||||
|
||||
s = PaperStyle("Junk",27.94,21.59)
|
||||
x = OpenDrawDoc(s,PAPER_PORTRAIT)
|
||||
f = FontStyle()
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
f.set_size(14)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(f)
|
||||
x.add_paragraph_style("mytest",p)
|
||||
|
||||
g = GraphicsStyle()
|
||||
g.set_width(2)
|
||||
g.set_height(2)
|
||||
g.set_paragraph_style("mytest")
|
||||
g.set_shadow(1)
|
||||
x.add_draw_style("mybox",g)
|
||||
|
||||
x.open("/home/dona/test")
|
||||
x.start_page()
|
||||
x.draw_box("mybox","Hello",4,4)
|
||||
x.end_page()
|
||||
x.close()
|
@ -44,7 +44,6 @@ _ = intl.gettext
|
||||
def importData(database, filename, callback):
|
||||
|
||||
parser = xml.sax.saxexts.make_parser()
|
||||
|
||||
basefile = os.path.dirname(filename)
|
||||
database.smap = {}
|
||||
database.pmap = {}
|
||||
@ -114,4 +113,3 @@ def loadData(database, filename, callback):
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -446,6 +446,9 @@ class Event:
|
||||
def getDate(self) :
|
||||
return self.date.getDate()
|
||||
|
||||
def getQuoteDate(self) :
|
||||
return self.date.getQuoteDate()
|
||||
|
||||
def getDateObj(self) :
|
||||
return self.date
|
||||
|
||||
|
@ -131,7 +131,7 @@ EVENBGCOLOR= "evenBackground"
|
||||
#-------------------------------------------------------------------------
|
||||
def birthday(person):
|
||||
if person:
|
||||
return person.getBirth().getDate()
|
||||
return person.getBirth().getQuoteDate()
|
||||
else:
|
||||
return ""
|
||||
|
||||
@ -143,7 +143,7 @@ def birthday(person):
|
||||
#-------------------------------------------------------------------------
|
||||
def deathday(person):
|
||||
if person:
|
||||
return person.getDeath().getDate()
|
||||
return person.getDeath().getQuoteDate()
|
||||
else:
|
||||
return ""
|
||||
|
||||
@ -154,7 +154,7 @@ def deathday(person):
|
||||
#-------------------------------------------------------------------------
|
||||
def on_exit_activate(obj):
|
||||
if utils.wasModified():
|
||||
question = _("Unsaved changes exist in the current datbase\n") + \
|
||||
question = _("Unsaved changes exist in the current database\n") + \
|
||||
_("Do you wish to save the changes?")
|
||||
topWindow.question(question,save_query)
|
||||
else:
|
||||
@ -646,14 +646,20 @@ def read_file(filename):
|
||||
statusbar.set_status(_("Loading ") +\
|
||||
filename + "...")
|
||||
|
||||
try:
|
||||
if load_database(filename) == 1:
|
||||
topWindow.set_title("Gramps - " + filename)
|
||||
else:
|
||||
statusbar.set_status("")
|
||||
Config.save_last_file("")
|
||||
except:
|
||||
displayError(_("Failure reading ") + filename)
|
||||
if load_database(filename) == 1:
|
||||
topWindow.set_title("Gramps - " + filename)
|
||||
else:
|
||||
statusbar.set_status("")
|
||||
Config.save_last_file("")
|
||||
|
||||
# try:
|
||||
# if load_database(filename) == 1:
|
||||
# topWindow.set_title("Gramps - " + filename)
|
||||
# else:
|
||||
# statusbar.set_status("")
|
||||
# Config.save_last_file("")
|
||||
# except:
|
||||
# displayError(_("Failure reading ") + filename)
|
||||
|
||||
statusbar.set_progress(0.0)
|
||||
|
||||
@ -1490,6 +1496,8 @@ def load_family():
|
||||
global active_father
|
||||
global active_family
|
||||
global active_parents
|
||||
global active_spouse
|
||||
|
||||
family_types = []
|
||||
main_family = None
|
||||
|
||||
@ -1557,6 +1565,7 @@ def load_family():
|
||||
spouse = family.getFather()
|
||||
else:
|
||||
spouse = family.getMother()
|
||||
active_spouse = spouse
|
||||
fv_spouse1 = Main.get_widget("fv_spouse1")
|
||||
fv_spouse1.set_text(Config.nameof(spouse))
|
||||
fv_spouse1.set_data("person",spouse)
|
||||
|
@ -28,7 +28,9 @@ import sort
|
||||
import string
|
||||
import utils
|
||||
|
||||
import OpenOffice
|
||||
from TextDoc import *
|
||||
from DrawDoc import *
|
||||
from OpenDrawDoc import *
|
||||
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
@ -49,38 +51,54 @@ db = None
|
||||
#------------------------------------------------------------------------
|
||||
class AncestorChart:
|
||||
|
||||
points = [
|
||||
# X , Y , Xold+3,Yold(+1.4), Y+.7
|
||||
( "1.5", "13.2700" , "" "", ""),
|
||||
( "5.5", "6.6600" , "4.5", "13.2700", "7.3600"),
|
||||
( "5.5", "19.8800" , "4.5", "14.6700", "20.5800"),
|
||||
( "9.5", "3.3550" , "8.5", "6.6600", "4.0550"),
|
||||
( "9.5", "9.9650" , "8.5", "8.0600", "10.6650"),
|
||||
( "9.5", "16.5750" , "8.5", "19.8800", "17.2750"),
|
||||
( "9.5", "23.1850" , "8.5", "21.2800", "23.8850"),
|
||||
("13.5", "1.7025" , "12.5", "3.3550", "2.4025"),
|
||||
("13.5", "5.0075" , "12.5", "4.7550", "5.7075"),
|
||||
("13.5", "8.3125" , "12.5", "9.9650", "9.0125"),
|
||||
("13.5", "11.6175" , "12.5", "11.3650", "12.3175"),
|
||||
("13.5", "14.9225" , "12.5", "16.5750", "15.6225"),
|
||||
("13.5", "18.2275" , "12.5", "17.9750", "18.9275"),
|
||||
("13.5", "21.5325" , "12.5", "23.1850", "22.2325"),
|
||||
("13.5", "24.8375" , "12.5", "24.5850", "25.5375")
|
||||
]
|
||||
|
||||
def __init__(self,database,person,output,template, max):
|
||||
creator = database.getResearcher().getName()
|
||||
self.open_office = OpenOffice.OpenOfficeCore(output,template,".sxd",creator)
|
||||
def __init__(self,database,person,output,doc, max):
|
||||
self.doc = doc
|
||||
self.doc.creator(database.getResearcher().getName())
|
||||
self.map = {}
|
||||
self.database = database
|
||||
self.start = person
|
||||
self.max_generations = max
|
||||
|
||||
self.output = output
|
||||
self.width = 4.5
|
||||
self.height = 1.25
|
||||
|
||||
start = self.doc.get_right_margin()
|
||||
delta = self.doc.get_usable_width() - (self.width + 0.5)
|
||||
delta = delta/3.0
|
||||
uh = self.doc.get_usable_height()
|
||||
ystart = self.doc.get_top_margin() - ((self.height+0.3)/2.0)
|
||||
self.x = [start, start + delta, start + (2*delta), start + (3*delta)]
|
||||
self.y = [ ystart + (uh/2.0), ystart + (uh/4.0),
|
||||
ystart + 3*(uh/4.0), ystart + (uh/8.0),
|
||||
ystart + 3*(uh/8.0), ystart + 5*(uh/8.0),
|
||||
ystart + 7*(uh/8.0),
|
||||
ystart + (uh/16.0), ystart + 3*(uh/16.0),
|
||||
ystart + 5*(uh/16.0), ystart + 7*(uh/16.0),
|
||||
ystart + 9*(uh/16.0), ystart + 11*(uh/16.0),
|
||||
ystart + 13*(uh/16.0), ystart + 15*(uh/16.0)]
|
||||
|
||||
def setup(self):
|
||||
self.file = self.open_office.setup()
|
||||
f = FontStyle()
|
||||
f.set_size(9)
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(f)
|
||||
self.doc.add_paragraph_style("Normal",p)
|
||||
|
||||
g = GraphicsStyle()
|
||||
g.set_height(self.height)
|
||||
g.set_width(self.width)
|
||||
g.set_paragraph_style("Normal")
|
||||
g.set_shadow(1)
|
||||
self.doc.add_draw_style("box",g)
|
||||
|
||||
g = GraphicsStyle()
|
||||
self.doc.add_draw_style("line",g)
|
||||
|
||||
self.doc.open(self.output)
|
||||
|
||||
def end(self):
|
||||
self.open_office.end()
|
||||
self.doc.close()
|
||||
|
||||
def filter(self,person,index):
|
||||
if person == None or index >= 2**self.max_generations:
|
||||
@ -123,57 +141,35 @@ class AncestorChart:
|
||||
self.get_numbers((start*2)+1,index+1,vals)
|
||||
|
||||
def print_page(self,start,generation, page):
|
||||
self.file.write("<draw:page draw:name=\"")
|
||||
self.file.write("Generation %d, page %d\" " % (generation, page))
|
||||
self.file.write("draw:style-name=\"P0\" draw:master-page-name=\"Home\">")
|
||||
|
||||
self.doc.start_page()
|
||||
self.draw_graph(1,start,0)
|
||||
|
||||
self.file.write("</draw:page>\n")
|
||||
self.doc.end_page()
|
||||
|
||||
def draw_graph(self,index,start,level):
|
||||
if self.map.has_key(start) and index <= 15:
|
||||
person = self.map[start]
|
||||
myPoints = AncestorChart.points[index-1]
|
||||
self.file.write("<draw:rect draw:style-name=\"gr1\" svg:x=\"" + myPoints[0])
|
||||
self.file.write("cm\" svg:y=\"" + myPoints[1] + "cm\" svg:width=\"5.5cm\"")
|
||||
self.file.write(" svg:height=\"1.4cm\">\n")
|
||||
|
||||
self.file.write("<text:p text:style-name=\"P1\">")
|
||||
self.file.write("<text:span text:style-name=\"T1\">")
|
||||
self.file.write(person.getPrimaryName().getRegularName())
|
||||
self.file.write("</text:span></text:p>\n");
|
||||
name = person.getPrimaryName().getRegularName()
|
||||
|
||||
birth = person.getBirth()
|
||||
if birth and birth.getDate() != "":
|
||||
self.file.write("<text:p text:style-name=\"P1\">")
|
||||
self.file.write("<text:span text:style-name=\"T1\">b. ")
|
||||
self.file.write(birth.getDate())
|
||||
self.file.write("</text:span></text:p>\n");
|
||||
name = name + "\nb. " + birth.getDate()
|
||||
|
||||
death = person.getDeath()
|
||||
if death and death.getDate() != "":
|
||||
self.file.write("<text:p text:style-name=\"P1\">")
|
||||
self.file.write("<text:span text:style-name=\"T1\">d. ")
|
||||
self.file.write(death.getDate())
|
||||
self.file.write("</text:span></text:p>\n");
|
||||
|
||||
self.file.write("</draw:rect>\n")
|
||||
if myPoints[2] != "":
|
||||
self.file.write("<draw:line draw:style-name=\"gr3\" ")
|
||||
self.file.write("svg:x1=\"" + myPoints[2] + "cm\" svg:y1=\"")
|
||||
self.file.write(myPoints[3] + "cm\" svg:x2=\"")
|
||||
self.file.write(myPoints[2] + "cm\" svg:y2=\"" + myPoints[4] + "cm\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P2\"/>\n")
|
||||
self.file.write("</draw:line>\n");
|
||||
|
||||
self.file.write("<draw:line draw:style-name=\"gr3\" ")
|
||||
self.file.write("svg:x1=\"" + myPoints[2] + "cm\" svg:y1=\"")
|
||||
self.file.write(myPoints[4] + "cm\" svg:x2=\"")
|
||||
self.file.write(myPoints[0] + "cm\" svg:y2=\"" + myPoints[4] + "cm\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P2\"/>\n")
|
||||
self.file.write("</draw:line>\n");
|
||||
name = name + "\nd. " + death.getDate()
|
||||
|
||||
self.doc.draw_box("box",name,self.x[level],self.y[index-1])
|
||||
if index > 1:
|
||||
old_index = int(index/2)-1
|
||||
x1 = self.x[level-1]+(self.width/2.0)
|
||||
x2 = self.x[level]
|
||||
if index % 2 == 1:
|
||||
y1 = self.y[old_index]+self.height
|
||||
else:
|
||||
y1 = self.y[old_index]
|
||||
y2 = self.y[index-1]+(self.height/2.0)
|
||||
self.doc.draw_line("line",x1,y1,x1,y2)
|
||||
self.doc.draw_line("line",x1,y2,x2,y2)
|
||||
self.draw_graph(index*2,start*2,level+1)
|
||||
self.draw_graph((index*2)+1,(start*2)+1,level+1)
|
||||
|
||||
@ -183,6 +179,7 @@ class AncestorChart:
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def report(database,person):
|
||||
import PaperMenu
|
||||
|
||||
global active_person
|
||||
global topDialog
|
||||
@ -197,7 +194,10 @@ def report(database,person):
|
||||
topDialog = GladeXML(glade_file,"dialog1")
|
||||
|
||||
name = person.getPrimaryName().getRegularName()
|
||||
|
||||
|
||||
PaperMenu.make_paper_menu(topDialog.get_widget("papersize"))
|
||||
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
|
||||
|
||||
topDialog.get_widget("labelTitle").set_text("Ancestor chart for " + name)
|
||||
topDialog.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
@ -217,13 +217,16 @@ def on_save_clicked(obj):
|
||||
if outputName == "":
|
||||
return
|
||||
|
||||
if outputName[-4:] != ".sxd":
|
||||
outputName = outputName + ".sxd"
|
||||
paper_obj = topDialog.get_widget("papersize").get_menu().get_active()
|
||||
paper = paper_obj.get_data("i")
|
||||
orien_obj = topDialog.get_widget("orientation").get_menu().get_active()
|
||||
orien = orien_obj.get_data("i")
|
||||
|
||||
max_gen = topDialog.get_widget("generations").get_value_as_int()
|
||||
|
||||
template = const.dataDir + os.sep + "chart.sxd"
|
||||
MyReport = AncestorChart(db,active_person,outputName,template, max_gen)
|
||||
|
||||
document = OpenDrawDoc(paper,orien)
|
||||
|
||||
MyReport = AncestorChart(db,active_person,outputName,document, max_gen)
|
||||
|
||||
MyReport.setup()
|
||||
MyReport.write_report()
|
||||
|
@ -27,7 +27,11 @@ import re
|
||||
import sort
|
||||
import string
|
||||
import utils
|
||||
import OpenOffice
|
||||
|
||||
from TextDoc import *
|
||||
from OpenOfficeDoc import *
|
||||
from HtmlDoc import *
|
||||
from AbiWordDoc import *
|
||||
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
@ -85,31 +89,38 @@ class AncestorReport:
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,database,person,output,max,pgbrk):
|
||||
def __init__(self,database,person,output,max,pgbrk,doc):
|
||||
self.map = {}
|
||||
self.database = database
|
||||
self.start = person
|
||||
self.output = output
|
||||
self.max_generations = max
|
||||
self.pgbrk = pgbrk
|
||||
self.file = None
|
||||
self.doc = doc
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_header_level(1)
|
||||
self.doc.add_style("Title",para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(14)
|
||||
font.set_bold(1)
|
||||
font.set_italic(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_header_level(2)
|
||||
self.doc.add_style("Header",para)
|
||||
|
||||
para = ParagraphStyle()
|
||||
para.set_first_indent(-0.75)
|
||||
para.set_left_margin(1.0)
|
||||
self.doc.add_style("ListEntry",para)
|
||||
self.doc.open(output)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
pass
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
self.file.close()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -125,62 +136,6 @@ class AncestorReport:
|
||||
self.filter(family.getFather(),index*2)
|
||||
self.filter(family.getMother(),(index*2)+1)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_title(self,name):
|
||||
pass
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def heading_start(self,newpage):
|
||||
pass
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def heading_stop(self):
|
||||
pass
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_begin(self):
|
||||
pass
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_end(self):
|
||||
pass
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_para_start(self,number,heading):
|
||||
pass
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_para_stop(self):
|
||||
pass
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -191,7 +146,9 @@ class AncestorReport:
|
||||
self.filter(self.start,1)
|
||||
|
||||
name = self.start.getPrimaryName().getRegularName()
|
||||
self.write_title("Ahnentalfel Chart for " + name)
|
||||
self.doc.start_paragraph("Title")
|
||||
self.doc.write_text("Ahnentalfel Chart for " + name)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
keys = self.map.keys()
|
||||
keys.sort()
|
||||
@ -200,41 +157,38 @@ class AncestorReport:
|
||||
|
||||
for key in keys :
|
||||
if generation == 0 or key >= 2**generation:
|
||||
if generation == 0:
|
||||
self.heading_start(0)
|
||||
else:
|
||||
self.list_end()
|
||||
self.heading_start(self.pgbrk)
|
||||
self.file.write(AncestorReport.gen[generation+1 ]+ " Generation")
|
||||
self.heading_stop()
|
||||
self.list_begin()
|
||||
self.doc.start_paragraph("Header")
|
||||
self.doc.write_text(AncestorReport.gen[generation+1 ]+ " Generation")
|
||||
self.doc.end_paragraph()
|
||||
generation = generation + 1
|
||||
|
||||
self.doc.start_paragraph("ListEntry")
|
||||
person = self.map[key]
|
||||
name = person.getPrimaryName().getRegularName()
|
||||
self.list_para_start(str(key) + ".", name )
|
||||
|
||||
self.doc.write_text(str(key) + ".\t" + name )
|
||||
|
||||
# Check birth record
|
||||
|
||||
birth = person.getBirth()
|
||||
if birth:
|
||||
date = birth.getDateObj()
|
||||
date = birth.getDateObj().get_start_date()
|
||||
place = birth.getPlace()
|
||||
if date.getDate() != "" or place != "":
|
||||
self.file.write(" was born")
|
||||
self.doc.write_text(" was born")
|
||||
if date.getDate() != "":
|
||||
if date.getDay() != -1 and date.getMonth() != -1:
|
||||
self.file.write(" on ")
|
||||
self.doc.write_text(" on ")
|
||||
else:
|
||||
self.file.write(" in ")
|
||||
self.file.write(date.getDate())
|
||||
self.doc.write_text(" in ")
|
||||
self.doc.write_text(date.getDate())
|
||||
if place != "":
|
||||
self.file.write(" in " + place)
|
||||
self.doc.write_text(" in " + place)
|
||||
if place == "" or place[-1] != '.':
|
||||
self.file.write(".")
|
||||
self.file.write("\n")
|
||||
self.doc.write_text(".")
|
||||
self.doc.write_text("\n")
|
||||
else:
|
||||
self.file.write(".\n")
|
||||
self.doc.write_text(".\n")
|
||||
|
||||
death = person.getDeath()
|
||||
buried = None
|
||||
@ -243,419 +197,48 @@ class AncestorReport:
|
||||
buried = event
|
||||
|
||||
if death:
|
||||
date = death.getDateObj()
|
||||
date = death.getDateObj().get_start_date()
|
||||
place = death.getPlace()
|
||||
if date.getDate() != "" or place != "":
|
||||
if person.getGender() == RelLib.Person.male:
|
||||
self.file.write("He")
|
||||
self.doc.write_text("He")
|
||||
else:
|
||||
self.file.write("She")
|
||||
self.file.write(" died")
|
||||
self.doc.write_text("She")
|
||||
self.doc.write_text(" died")
|
||||
|
||||
if date.getDate() != "":
|
||||
if date.getDay() != -1 and date.getMonth() != -1:
|
||||
self.file.write(" on ")
|
||||
self.doc.write_text(" on ")
|
||||
else:
|
||||
self.file.write(" in ")
|
||||
self.file.write(date.getDate())
|
||||
self.doc.write_text(" in ")
|
||||
self.doc.write_text(date.getDate())
|
||||
if place != "":
|
||||
self.file.write(" in " + place)
|
||||
self.doc.write_text(" in " + place)
|
||||
if buried:
|
||||
date = buried.getDateObj()
|
||||
date = buried.getDateObj().get_start_date()
|
||||
place = buried.getPlace()
|
||||
if date.getDate() != "" or place != "":
|
||||
self.file.write(", and was buried")
|
||||
self.doc.write_text(", and was buried")
|
||||
|
||||
if date.getDate() != "":
|
||||
if date.getDay() != -1 and date.getMonth() != -1:
|
||||
self.file.write(" on ")
|
||||
self.doc.write_text(" on ")
|
||||
else:
|
||||
self.file.write(" in ")
|
||||
self.file.write(date.getDate())
|
||||
self.doc.write_text(" in ")
|
||||
self.doc.write_text(date.getDate())
|
||||
if place != "":
|
||||
self.file.write(" in " + place)
|
||||
self.doc.write_text(" in " + place)
|
||||
|
||||
if place == "" or place[-1] != '.':
|
||||
self.file.write(".")
|
||||
self.file.write("\n")
|
||||
self.doc.write_text(".")
|
||||
self.doc.write_text("\n")
|
||||
else:
|
||||
self.file.write(".\n")
|
||||
self.doc.write_text(".\n")
|
||||
|
||||
self.list_para_stop()
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.list_end()
|
||||
self.end()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class OpenOfficeAncestorReport(AncestorReport):
|
||||
|
||||
def __init__(self,database,person,output,max,pgbrk,template):
|
||||
creator = database.getResearcher().getName()
|
||||
self.open_office = OpenOffice.OpenOfficeCore(output,template,".sxw",creator)
|
||||
AncestorReport.__init__(self,database,person,output,max,pgbrk)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
self.file = self.open_office.setup()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
self.open_office.end()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_title(self,name):
|
||||
self.file.write("<text:h text:style-name=\"P1\" ")
|
||||
self.file.write("text:level=\"1\">" + name + "</text:h>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def heading_start(self,newpage):
|
||||
if newpage :
|
||||
self.file.write("<text:h text:style-name=\"P2\"")
|
||||
else:
|
||||
self.file.write("<text:h text:style-name=\"Heading 2\"")
|
||||
self.file.write(" text:level=\"2\">")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def heading_stop(self):
|
||||
self.file.write("</text:h>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_para_start(self,number,heading):
|
||||
self.file.write("<text:p text:style-name=\"Hanging indent\">")
|
||||
self.file.write(number + "<text:tab-stop/>")
|
||||
self.file.write("<text:span text:style-name=\"T1\">")
|
||||
self.file.write(heading + "</text:span>")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_para_stop(self):
|
||||
self.file.write("</text:p>\n")
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class AncestorReportHtml(AncestorReport):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,database,person,output,max,pgbrk,template):
|
||||
self.template = template
|
||||
AncestorReport.__init__(self,database,person,output,max,pgbrk)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_title(self,name):
|
||||
self.file.write("<H1>" + name + "</H1>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def heading_start(self,newpage):
|
||||
self.file.write("<H2>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def heading_stop(self):
|
||||
self.file.write("</H2>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_para_start(self,number,heading):
|
||||
self.file.write("<LI VALUE=\"" + number + "\">")
|
||||
self.file.write("<STRONG>" + heading + "</STRONG>")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_para_stop(self):
|
||||
self.file.write("</LI>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
if self.template == "":
|
||||
self.first = [
|
||||
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">\n',
|
||||
'<HTML>\n',
|
||||
'<HEAD>\n',
|
||||
'<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">\n',
|
||||
'<TITLE>\n',
|
||||
'</TITLE>\n',
|
||||
'</HEAD>\n',
|
||||
'<BODY>\n',
|
||||
'<!-- START -->\n'
|
||||
]
|
||||
self.last = [
|
||||
'<!-- STOP -->\n',
|
||||
'</BODY>\n',
|
||||
'</HTML>\n'
|
||||
]
|
||||
else:
|
||||
start = re.compile(r"<!-- START -->")
|
||||
|
||||
templateFile = open(self.template,"r")
|
||||
lines = templateFile.readlines()
|
||||
templateFile.close()
|
||||
|
||||
in_last = 0
|
||||
for line in lines:
|
||||
if start.search(line):
|
||||
in_last = 1
|
||||
self.last.append(line);
|
||||
elif in_last == 0:
|
||||
self.first.append(line)
|
||||
else:
|
||||
self.last.append(line);
|
||||
self.file = open(self.output,"w")
|
||||
titleRe = re.compile(r"<TITLE>")
|
||||
for line in self.first:
|
||||
if titleRe.search(line):
|
||||
name = self.start.getPrimaryName().getRegularName()
|
||||
self.file.write(line)
|
||||
self.file.write("Ahnentafel Chart for " + name)
|
||||
else:
|
||||
self.file.write(line)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
for line in self.last:
|
||||
self.file.write(line)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_begin(self):
|
||||
self.file.write("<OL>\n");
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_end(self):
|
||||
self.file.write("</OL>\n");
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class AncestorReportAbiword(AncestorReport):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_title(self,name):
|
||||
self.file.write('<p style="Heading 1">' + name + '</p>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def heading_start(self,newpage):
|
||||
self.file.write('<p style="Heading 2">')
|
||||
if newpage:
|
||||
self.file.write('<pbr/>')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def heading_stop(self):
|
||||
self.file.write("</p>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_para_start(self,number,heading):
|
||||
self.file.write('<p props="margin-left:0.5000in; text-indent:-0.5000in">')
|
||||
self.file.write(number + '\t')
|
||||
self.file.write('<c props="font-weight:bold">')
|
||||
self.file.write(heading)
|
||||
self.file.write('</c>')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_para_stop(self):
|
||||
self.file.write("</p>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
self.file = open(self.output,"w")
|
||||
self.file.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
|
||||
self.file.write('<abiword version="0.7.12">\n')
|
||||
self.file.write('<section>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
self.file.write('</section>\n')
|
||||
self.file.write('</abiword>\n')
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class AncestorReportLatex(AncestorReport):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def heading_start(self,newpage):
|
||||
if newpage:
|
||||
self.file.write("\\newpage\n")
|
||||
self.file.write("\\section{")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def heading_stop(self):
|
||||
self.file.write("}\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_para_start(self,number,heading):
|
||||
self.file.write("\\item{" + number + "}\n")
|
||||
self.file.write("\\textbf{" + heading + "}")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
self.first = [
|
||||
"\\documentclass{article}\n",
|
||||
"\\usepackage{makeidx}\n",
|
||||
"\\makeindex\n",
|
||||
"\\begin{document}\n"
|
||||
]
|
||||
self.last = [
|
||||
"\\newpage\n",
|
||||
"\\printindex\n",
|
||||
"\\end{document}\n"
|
||||
]
|
||||
self.file = open(self.output,"w")
|
||||
for line in self.first:
|
||||
self.file.write(line)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_title(self,name):
|
||||
self.file.write("\\title{%s}\n" % name)
|
||||
self.file.write("\\author{}\n")
|
||||
self.file.write("\\maketitle\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_begin(self):
|
||||
self.file.write("\\begin{description}\n");
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def list_end(self):
|
||||
self.file.write("\\end{description}\n");
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
for line in self.last:
|
||||
self.file.write(line)
|
||||
self.doc.close()
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -663,7 +246,8 @@ class AncestorReportLatex(AncestorReport):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def report(database,person):
|
||||
|
||||
import PaperMenu
|
||||
|
||||
global active_person
|
||||
global topDialog
|
||||
global glade_file
|
||||
@ -678,7 +262,10 @@ def report(database,person):
|
||||
topDialog.get_widget("htmltemplate").set_sensitive(0)
|
||||
|
||||
name = person.getPrimaryName().getRegularName()
|
||||
|
||||
|
||||
PaperMenu.make_paper_menu(topDialog.get_widget("papersize"))
|
||||
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
|
||||
|
||||
topDialog.get_widget("labelTitle").set_text("Ahnentalfel Report for " + name)
|
||||
topDialog.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
@ -695,8 +282,12 @@ def report(database,person):
|
||||
def on_html_toggled(obj):
|
||||
if obj.get_active():
|
||||
topDialog.get_widget("htmltemplate").set_sensitive(1)
|
||||
topDialog.get_widget("papersize").set_sensitive(0)
|
||||
topDialog.get_widget("orientation").set_sensitive(0)
|
||||
else:
|
||||
topDialog.get_widget("htmltemplate").set_sensitive(0)
|
||||
topDialog.get_widget("papersize").set_sensitive(1)
|
||||
topDialog.get_widget("orientation").set_sensitive(1)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -710,31 +301,24 @@ def on_save_clicked(obj):
|
||||
outputName = topDialog.get_widget("filename").get_text()
|
||||
max_gen = topDialog.get_widget("generations").get_value_as_int()
|
||||
pgbrk = topDialog.get_widget("pagebreak").get_active()
|
||||
|
||||
template = topDialog.get_widget("htmltemplate").get_full_path(0)
|
||||
paper_obj = topDialog.get_widget("papersize").get_menu().get_active()
|
||||
paper = paper_obj.get_data("i")
|
||||
orien_obj = topDialog.get_widget("orientation").get_menu().get_active()
|
||||
orien = orien_obj.get_data("i")
|
||||
|
||||
if outputName == "":
|
||||
return
|
||||
|
||||
|
||||
if topDialog.get_widget("openoffice").get_active():
|
||||
template = const.dataDir + os.sep + "base.sxw"
|
||||
if outputName[-4:] != ".sxw":
|
||||
outputName = outputName + ".sxw"
|
||||
MyReport = OpenOfficeAncestorReport(db,active_person,outputName,\
|
||||
max_gen, pgbrk, template )
|
||||
elif topDialog.get_widget("html").get_active():
|
||||
template = topDialog.get_widget("htmlfile").get_text()
|
||||
MyReport = AncestorReportHtml(db,active_person,outputName,\
|
||||
max_gen, pgbrk, template)
|
||||
document = OpenOfficeDoc(paper,orien)
|
||||
elif topDialog.get_widget("abiword").get_active():
|
||||
if outputName[-4:] != ".abw":
|
||||
outputName = outputName + ".abw"
|
||||
MyReport = AncestorReportAbiword(db,active_person,outputName,\
|
||||
max_gen, pgbrk)
|
||||
document = AbiWordDoc(paper,orien)
|
||||
else:
|
||||
MyReport = AncestorReportLatex(db,active_person,outputName,\
|
||||
max_gen, pgbrk)
|
||||
document = HtmlDoc(template)
|
||||
|
||||
MyReport.setup()
|
||||
MyReport = AncestorReport(db,active_person,outputName,\
|
||||
max_gen, pgbrk, document)
|
||||
MyReport.write_report()
|
||||
|
||||
utils.destroy_passed_object(obj)
|
||||
|
@ -20,16 +20,18 @@
|
||||
|
||||
"Generate files/Descendant Report"
|
||||
|
||||
import RelLib
|
||||
import const
|
||||
import os
|
||||
import re
|
||||
import sort
|
||||
import string
|
||||
import OpenOffice
|
||||
import utils
|
||||
|
||||
import RelLib
|
||||
import const
|
||||
import utils
|
||||
import const
|
||||
from TextDoc import *
|
||||
from OpenOfficeDoc import *
|
||||
from HtmlDoc import *
|
||||
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
@ -41,44 +43,42 @@ from libglade import *
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class DescendantReport:
|
||||
def __init__(self,name,person):
|
||||
self.name = name
|
||||
self.person = person
|
||||
|
||||
def setup(self):
|
||||
pass
|
||||
|
||||
def report(self):
|
||||
pass
|
||||
|
||||
def end(self):
|
||||
pass
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class OpenOfficeDesReport(DescendantReport):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,name,person,db):
|
||||
def __init__(self,name,person,db,doc):
|
||||
self.creator = db.getResearcher().getName()
|
||||
DescendantReport.__init__(self,name,person)
|
||||
self.name = name
|
||||
self.person = person
|
||||
self.doc = doc
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self,template):
|
||||
self.open_office = OpenOffice.OpenOfficeCore(self.name,template,\
|
||||
".sxw",self.creator)
|
||||
self.file = self.open_office.setup()
|
||||
def setup(self):
|
||||
|
||||
f = FontStyle()
|
||||
f.set_size(14)
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
f.set_bold(1)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(f)
|
||||
|
||||
self.doc.add_style("Title",p)
|
||||
|
||||
f = FontStyle()
|
||||
for i in range(1,10):
|
||||
p = ParagraphStyle()
|
||||
p.set_font(f)
|
||||
p.set_left_margin(float(i-1))
|
||||
self.doc.add_style("Level" + str(i),p)
|
||||
|
||||
self.doc.open(self.name)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -86,7 +86,7 @@ class OpenOfficeDesReport(DescendantReport):
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
self.open_office.end()
|
||||
self.doc.close()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -94,10 +94,10 @@ class OpenOfficeDesReport(DescendantReport):
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def report(self):
|
||||
self.file.write('<text:p text:style-name="Title">')
|
||||
self.file.write('Descendants of ')
|
||||
self.file.write(self.person.getPrimaryName().getRegularName())
|
||||
self.file.write('</text:p>\n')
|
||||
self.doc.start_paragraph("Title")
|
||||
self.doc.write_text('Descendants of ')
|
||||
self.doc.write_text(self.person.getPrimaryName().getRegularName())
|
||||
self.doc.end_paragraph()
|
||||
self.dump(1,self.person)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
@ -106,97 +106,22 @@ class OpenOfficeDesReport(DescendantReport):
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def dump(self,level,person):
|
||||
self.file.write('<text:p text:style-name="P' + str(level) + '">')
|
||||
self.file.write(str(level) + '. ')
|
||||
self.file.write(person.getPrimaryName().getRegularName())
|
||||
self.doc.start_paragraph("Level" + str(level))
|
||||
self.doc.write_text(str(level) + '. ')
|
||||
self.doc.write_text(person.getPrimaryName().getRegularName())
|
||||
|
||||
birth = person.getBirth().getDateObj().getYear()
|
||||
death = person.getDeath().getDateObj().getYear()
|
||||
birth = person.getBirth().getDateObj().get_start_date().getYear()
|
||||
death = person.getDeath().getDateObj().get_start_date().getYear()
|
||||
if birth != -1 or death != -1:
|
||||
self.file.write(' (')
|
||||
self.doc.write_text(' (')
|
||||
if birth != -1:
|
||||
self.file.write('b. ' + str(birth))
|
||||
self.doc.write_text('b. ' + str(birth))
|
||||
if death != -1:
|
||||
if birth != -1:
|
||||
self.file.write(', ')
|
||||
self.file.write('d. ' + str(death))
|
||||
self.file.write(')')
|
||||
self.file.write('</text:p>\n')
|
||||
|
||||
for family in person.getFamilyList():
|
||||
for child in family.getChildList():
|
||||
self.dump(level+1,child)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class AbiwordDesReport(DescendantReport):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self,template):
|
||||
if self.name[-4:] != ".abw":
|
||||
self.name = self.name + ".abw"
|
||||
self.file = open(self.name,"w")
|
||||
self.file.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
|
||||
self.file.write('<abiword version="0.7.12">\n')
|
||||
self.file.write('<section>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
|
||||
self.file.write('</section>\n')
|
||||
self.file.write('</abiword>\n')
|
||||
self.file.close()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def report(self):
|
||||
self.file.write('<p style="Heading 1">')
|
||||
self.file.write('Descendants of ')
|
||||
self.file.write(self.person.getPrimaryName().getRegularName())
|
||||
self.file.write('</p>\n')
|
||||
self.dump(1,self.person)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def dump(self,level,person):
|
||||
self.file.write('<p style="Normal"')
|
||||
if level > 1:
|
||||
self.file.write(' props="margin-left:')
|
||||
val = float(level-1) / 2.0
|
||||
self.file.write("%6.3fin\"" % (val))
|
||||
self.file.write('>')
|
||||
self.file.write(str(level) + '. ')
|
||||
self.file.write(person.getPrimaryName().getRegularName())
|
||||
|
||||
birth = person.getBirth().getDateObj().getYear()
|
||||
death = person.getDeath().getDateObj().getYear()
|
||||
if birth != -1 or death != -1:
|
||||
self.file.write(' (')
|
||||
if birth != -1:
|
||||
self.file.write('b. ' + str(birth))
|
||||
if death != -1:
|
||||
if birth != -1:
|
||||
self.file.write(', ')
|
||||
self.file.write('d. ' + str(death))
|
||||
self.file.write(')')
|
||||
self.file.write('</p>\n')
|
||||
self.doc.write_text(', ')
|
||||
self.doc.write_text('d. ' + str(death))
|
||||
self.doc.write_text(')')
|
||||
self.doc.end_paragraph()
|
||||
|
||||
for family in person.getFamilyList():
|
||||
for child in family.getChildList():
|
||||
@ -209,6 +134,8 @@ class AbiwordDesReport(DescendantReport):
|
||||
#------------------------------------------------------------------------
|
||||
class DesReportWindow:
|
||||
def __init__(self,person,db):
|
||||
import PaperMenu
|
||||
|
||||
self.person = person
|
||||
|
||||
glade_file = os.path.dirname(__file__) + os.sep + "desreport.glade"
|
||||
@ -218,6 +145,10 @@ class DesReportWindow:
|
||||
"on_html_toggled": on_html_toggled,
|
||||
"on_save_clicked": on_save_clicked
|
||||
})
|
||||
|
||||
PaperMenu.make_paper_menu(self.top.get_widget("papersize"))
|
||||
PaperMenu.make_orientation_menu(self.top.get_widget("orientation"))
|
||||
|
||||
mytop = self.top.get_widget("dialog1")
|
||||
mytop.set_data("o",self)
|
||||
mytop.set_data("d",db)
|
||||
@ -244,14 +175,21 @@ def on_save_clicked(obj):
|
||||
if file == "":
|
||||
return
|
||||
|
||||
paper_obj = myobj.top.get_widget("papersize")
|
||||
paper = paper_obj.get_menu().get_active().get_data("i")
|
||||
|
||||
orien_obj = myobj.top.get_widget("orientation")
|
||||
orien = orien_obj.get_menu().get_active().get_data("i")
|
||||
|
||||
if myobj.top.get_widget("openoffice").get_active():
|
||||
report = OpenOfficeDesReport(file,myobj.person,db)
|
||||
document = OpenOfficeDoc(paper,orien)
|
||||
elif myobj.top.get_widget("abiword").get_active():
|
||||
report = AbiwordDesReport(file,myobj.person)
|
||||
document = AbiWordDoc(paper,orien)
|
||||
else:
|
||||
return
|
||||
|
||||
report.setup(const.dataDir + os.sep + "deslist.sxw")
|
||||
report = DescendantReport(file,myobj.person,db,document)
|
||||
report.setup()
|
||||
report.report()
|
||||
report.end()
|
||||
|
||||
@ -263,11 +201,15 @@ def on_save_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_html_toggled(obj):
|
||||
myobj = obj.get_data(OBJECT)
|
||||
if myobj.form.get_widget("html").get_active():
|
||||
myobj.form.get_widget("htmltemplate").set_sensitive(1)
|
||||
myobj = obj.get_data("o")
|
||||
if myobj.top.get_widget("html").get_active():
|
||||
myobj.top.get_widget("htmltemplate").set_sensitive(1)
|
||||
myobj.top.get_widget("papersize").set_sensitive(0)
|
||||
myobj.top.get_widget("orientation").set_sensitive(0)
|
||||
else:
|
||||
myobj.form.get_widget("htmltemplate").set_sensitive(0)
|
||||
myobj.top.get_widget("htmltemplate").set_sensitive(0)
|
||||
myobj.top.get_widget("papersize").set_sensitive(1)
|
||||
myobj.top.get_widget("orientation").set_sensitive(1)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -26,10 +26,12 @@ import os
|
||||
import re
|
||||
import sort
|
||||
import string
|
||||
import tempfile
|
||||
import OpenOffice
|
||||
import utils
|
||||
|
||||
from TextDoc import *
|
||||
from OpenOfficeDoc import *
|
||||
from HtmlDoc import *
|
||||
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
from libglade import *
|
||||
@ -49,58 +51,174 @@ db = None
|
||||
#------------------------------------------------------------------------
|
||||
class FamilyGroup:
|
||||
|
||||
def __init__(self,database,family,output,template):
|
||||
pass
|
||||
|
||||
def __init__(self,database,family,output,doc):
|
||||
self.db = database
|
||||
self.family = family
|
||||
self.output = output
|
||||
self.doc = doc
|
||||
|
||||
para = ParagraphStyle()
|
||||
font = FontStyle()
|
||||
font.set_size(4)
|
||||
para.set_font(font)
|
||||
self.doc.add_style('blank',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.doc.add_style('Title',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(0)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.doc.add_style('Normal',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.doc.add_style('ChildText',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.doc.add_style('ParentName',para)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.2)
|
||||
cell.set_top_border(1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_right_border(1)
|
||||
cell.set_left_border(1)
|
||||
self.doc.add_cell_style('ParentHead',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_left_border(1)
|
||||
self.doc.add_cell_style('TextContents',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(0)
|
||||
cell.set_left_border(1)
|
||||
cell.set_padding(0.1)
|
||||
self.doc.add_cell_style('TextChild1',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_left_border(1)
|
||||
cell.set_padding(0.1)
|
||||
self.doc.add_cell_style('TextChild2',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_right_border(1)
|
||||
cell.set_left_border(1)
|
||||
self.doc.add_cell_style('TextContentsEnd',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.2)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_right_border(1)
|
||||
cell.set_left_border(1)
|
||||
self.doc.add_cell_style('ChildName',cell)
|
||||
|
||||
table = TableStyle()
|
||||
table.set_width(100)
|
||||
table.set_columns(3)
|
||||
table.set_column_width(0,20)
|
||||
table.set_column_width(1,40)
|
||||
table.set_column_width(2,40)
|
||||
self.doc.add_table_style('ParentTable',table)
|
||||
|
||||
table = TableStyle()
|
||||
table.set_width(100)
|
||||
table.set_columns(4)
|
||||
table.set_column_width(0,5)
|
||||
table.set_column_width(1,15)
|
||||
table.set_column_width(2,40)
|
||||
table.set_column_width(3,40)
|
||||
self.doc.add_table_style('ChildTable',table)
|
||||
|
||||
def setup(self):
|
||||
pass
|
||||
self.doc.open(self.output)
|
||||
self.doc.start_paragraph('Title')
|
||||
self.doc.write_text("Family Group Record")
|
||||
self.doc.end_paragraph()
|
||||
|
||||
def end(self):
|
||||
pass
|
||||
|
||||
def write_header(self):
|
||||
pass
|
||||
|
||||
def write_parent(self,type,name):
|
||||
pass
|
||||
|
||||
def start_parent_stats(self):
|
||||
pass
|
||||
|
||||
def end_parent_stats(self):
|
||||
pass
|
||||
|
||||
def write_parent_stats(self,str1,str2,str3):
|
||||
pass
|
||||
|
||||
def write_parent_parent(self,str1,str2):
|
||||
pass
|
||||
|
||||
def start_child_stats(self):
|
||||
pass
|
||||
|
||||
def end_child_stats(self):
|
||||
pass
|
||||
|
||||
def write_child_stats(self,str1,str2,str3,str4,last):
|
||||
pass
|
||||
|
||||
def write_child_name(self,index,child):
|
||||
pass
|
||||
|
||||
def write_child_spouse(self,spouse):
|
||||
pass
|
||||
self.doc.close()
|
||||
|
||||
def dump_parent(self,person):
|
||||
self.start_parent_stats();
|
||||
|
||||
if person.getGender() == RelLib.Person.male:
|
||||
self.write_parent("Husband:",person)
|
||||
id = "Husband"
|
||||
else:
|
||||
self.write_parent("Wife:",person)
|
||||
id = "Wife"
|
||||
|
||||
self.doc.start_table(id,'ParentTable')
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell('ParentHead',3)
|
||||
self.doc.start_paragraph('ParentName')
|
||||
self.doc.write_text(id + ': ')
|
||||
self.doc.write_text(person.getPrimaryName().getRegularName())
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
birth = person.getBirth()
|
||||
death = person.getDeath()
|
||||
self.write_parent_stats("Birth",birth.getDate(),birth.getPlace())
|
||||
self.write_parent_stats("Death",death.getDate(),death.getPlace())
|
||||
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell("TextContents")
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text("Birth")
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell("TextContents")
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text(birth.getDate())
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell("TextContentsEnd")
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text(birth.getPlace())
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell("TextContents")
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text("Death")
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell("TextContents")
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text(death.getDate())
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell("TextContentsEnd")
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text(death.getPlace())
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
family = person.getMainFamily()
|
||||
if family == None or family.getFather() == None:
|
||||
father_name = ""
|
||||
@ -110,528 +228,140 @@ class FamilyGroup:
|
||||
mother_name = ""
|
||||
else:
|
||||
mother_name = family.getMother().getPrimaryName().getRegularName()
|
||||
self.write_parent_parent("Father",father_name)
|
||||
self.write_parent_parent("Mother",mother_name)
|
||||
self.end_parent_stats();
|
||||
|
||||
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell("TextContents")
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text("Father")
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell("TextContentsEnd",2)
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text(father_name)
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell("TextContents")
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text("Mother")
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell("TextContentsEnd",2)
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text(mother_name)
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
self.doc.end_table()
|
||||
|
||||
def dump_child_event(self,text,name,event):
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell(text)
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell('TextContents')
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text(name)
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell('TextContents')
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text(event.getDate())
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell('TextContentsEnd')
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text(event.getPlace())
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
def dump_child(self,index,person):
|
||||
self.start_child_stats();
|
||||
birth = person.getBirth()
|
||||
death = person.getDeath()
|
||||
self.write_child_name(index,person)
|
||||
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell('TextChild1')
|
||||
self.doc.start_paragraph('ChildText')
|
||||
if person.getGender() == RelLib.Person.male:
|
||||
self.doc.write_text("%dM" % index)
|
||||
else:
|
||||
self.doc.write_text("%dF" % index)
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell('ChildName',3)
|
||||
self.doc.start_paragraph('ChildText')
|
||||
self.doc.write_text(person.getPrimaryName().getRegularName())
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
families = len(person.getFamilyList())
|
||||
self.write_child_stats("","Birth",birth.getDate(),\
|
||||
birth.getPlace(),0)
|
||||
self.dump_child_event('TextChild1','Birth',person.getBirth())
|
||||
if families == 0:
|
||||
last = 1
|
||||
self.dump_child_event('TextChild2','Death',person.getDeath())
|
||||
else:
|
||||
last = 0
|
||||
self.write_child_stats("","Death",death.getDate(),\
|
||||
death.getPlace(),last)
|
||||
|
||||
self.dump_child_event('TextChild1','Death',person.getDeath())
|
||||
|
||||
index = 1
|
||||
for family in person.getFamilyList():
|
||||
if person == family.getFather():
|
||||
self.write_child_spouse(family.getMother())
|
||||
spouse =family.getMother()
|
||||
else:
|
||||
self.write_child_spouse(family.getFather())
|
||||
spouse = family.getFather()
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell('TextChild1')
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell('TextContents')
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text("Spouse")
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell('TextContentsEnd',2)
|
||||
self.doc.start_paragraph('Normal')
|
||||
self.doc.write_text(spouse.getPrimaryName().getRegularName())
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
m = family.getMarriage()
|
||||
if families == index:
|
||||
last = 1
|
||||
if index == families:
|
||||
self.dump_child_event('TextChild2','Married',m)
|
||||
else:
|
||||
last = 0
|
||||
self.write_child_stats("","Married",m.getDate(),m.getPlace(),last)
|
||||
self.dump_child_event('TextChild1','Death',m)
|
||||
|
||||
self.end_child_stats();
|
||||
|
||||
def write_report(self):
|
||||
pass
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class OpenOfficeFamilyGroup(FamilyGroup):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,database,family,output,template):
|
||||
self.map = {}
|
||||
self.database = database
|
||||
self.family = family
|
||||
creator = db.getResearcher().getName()
|
||||
self.open_office = OpenOffice.OpenOfficeCore(output,template,".sxw",creator)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
self.file = self.open_office.setup()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
self.open_office.end()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_header(self):
|
||||
self.file.write('<text:h text:style-name="Heading 1" ')
|
||||
self.file.write('text:level="1">')
|
||||
self.file.write('Family Group Record')
|
||||
self.file.write('</text:h>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_parent(self,type,name):
|
||||
self.file.write("<table:table-row>\n")
|
||||
self.file.write("<table:table-cell ")
|
||||
self.file.write("table:style-name=\"Table1.A3\" ")
|
||||
self.file.write("table:number-columns-spanned=\"3\" ")
|
||||
self.file.write("table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"ParentHead\">")
|
||||
self.file.write(type)
|
||||
self.file.write("<text:tab-stop/>")
|
||||
self.file.write(name.getPrimaryName().getRegularName())
|
||||
self.file.write("</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:covered-table-cell>\n")
|
||||
self.file.write("</table:covered-table-cell>\n")
|
||||
self.file.write("<table:covered-table-cell>\n")
|
||||
self.file.write("</table:covered-table-cell>\n")
|
||||
self.file.write("</table:table-row>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def start_parent_stats(self):
|
||||
self.file.write("<table:table table:name=\"Table1\""\
|
||||
" table:style-name=\"Table1\">\n")
|
||||
self.file.write("<table:table-column table:style-name=\""\
|
||||
"Table1.A\"/>\n")
|
||||
self.file.write("<table:table-column table:style-name=\""\
|
||||
"Table1.B\"/>\n")
|
||||
self.file.write("<table:table-column table:style-name=\""
|
||||
"Table1.C\"/>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end_parent_stats(self):
|
||||
self.file.write("</table:table>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_parent_stats(self,str1,str2,str3):
|
||||
self.file.write("<table:table-row>\n")
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table1.A1\" table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P4\">" + str1 + \
|
||||
"</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table1.A1\" table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P4\">" + str2 + \
|
||||
"</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table1.A2\" table:value-type=\"string\">\n");
|
||||
self.file.write("<text:p text:style-name=\"P4\">" + str3 +
|
||||
"</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("</table:table-row>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_parent_parent(self,str1,str2):
|
||||
self.file.write("<table:table-row>\n")
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table1.A1\" table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P4\">" + str1 + \
|
||||
"</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell ")
|
||||
self.file.write("table:style-name=\"Table1.A1\" ")
|
||||
self.file.write("table:number-columns-spanned=\"2\" ")
|
||||
self.file.write("table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P4\">")
|
||||
self.file.write(str2)
|
||||
self.file.write("</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:covered-table-cell>\n")
|
||||
self.file.write("</table:covered-table-cell>\n")
|
||||
self.file.write("</table:table-row>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def start_child_stats(self):
|
||||
self.file.write("<table:table table:name=\"Table3\" "
|
||||
"table:style-name=\"Table3\">\n")
|
||||
self.file.write("<table:table-column table:style-name=\""\
|
||||
"Table3.A\"/>\n")
|
||||
self.file.write("<table:table-column table:style-name=\""\
|
||||
"Table3.B\"/>\n")
|
||||
self.file.write("<table:table-column table:style-name=\""\
|
||||
"Table3.C\"/>\n")
|
||||
self.file.write("<table:table-column table:style-name=\""\
|
||||
"Table3.D\"/>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end_child_stats(self):
|
||||
self.file.write("</table:table>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_child_stats(self,str1,str2,str3,str4,last):
|
||||
self.file.write("<table:table-row>\n")
|
||||
if last == 1:
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table3.A2\" table:value-type=\"string\">\n")
|
||||
else:
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table3.A1\" table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P4\">" + str1 +\
|
||||
"</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table3.A4\" table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P4\">" + str2 +
|
||||
"</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table3.A4\" table:value-type=\"string\">\n");
|
||||
self.file.write("<text:p text:style-name=\"P4\">" + str3 +
|
||||
"</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table3.A4\" table:value-type=\"string\">\n");
|
||||
self.file.write("<text:p text:style-name=\"P4\">" + str4 +
|
||||
"</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("</table:table-row>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_child_name(self,index,child):
|
||||
self.file.write("<table:table-row>\n")
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table3.A3\" table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P4\">" + str(index))
|
||||
if child.getGender() == RelLib.Person.male:
|
||||
self.file.write("M")
|
||||
else:
|
||||
self.file.write("F")
|
||||
self.file.write("</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell table:number-columns-spanned"\
|
||||
"=\"3\" table:style-name=\""\
|
||||
"Table3.A5\" table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P2\">")
|
||||
self.file.write(child.getPrimaryName().getRegularName())
|
||||
self.file.write("</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:covered-table-cell>\n")
|
||||
self.file.write("</table:covered-table-cell>\n")
|
||||
self.file.write("<table:covered-table-cell>\n")
|
||||
self.file.write("</table:covered-table-cell>\n")
|
||||
self.file.write("</table:table-row>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_child_spouse(self,spouse):
|
||||
self.file.write("<table:table-row>\n")
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table3.A1\" table:value-type=\"string\">\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell table:style-name=\""\
|
||||
"Table3.A4\" table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P4\">")
|
||||
self.file.write("Spouse")
|
||||
self.file.write("</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell table:number-columns-spanned"\
|
||||
"=\"2\" table:style-name=\""\
|
||||
"Table3.A4\" table:value-type=\"string\">\n")
|
||||
self.file.write("<text:p text:style-name=\"P4\">")
|
||||
self.file.write(spouse.getPrimaryName().getRegularName())
|
||||
self.file.write("</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:covered-table-cell>\n")
|
||||
self.file.write("</table:covered-table-cell>\n")
|
||||
self.file.write("</table:table-row>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_report(self):
|
||||
self.write_header()
|
||||
self.dump_parent(self.family.getFather())
|
||||
self.doc.start_paragraph("blank")
|
||||
self.doc.end_paragraph()
|
||||
self.dump_parent(self.family.getMother())
|
||||
if len(self.family.getChildList()) > 0:
|
||||
self.file.write("<text:p text:style-name=\"ParentHead\">")
|
||||
self.file.write("Children")
|
||||
self.file.write("<text:tab-stop/>")
|
||||
self.file.write("</text:p>\n")
|
||||
|
||||
length = len(self.family.getChildList())
|
||||
if length > 0:
|
||||
self.doc.start_paragraph("blank")
|
||||
self.doc.end_paragraph()
|
||||
self.doc.start_table('Children','ChildTable')
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell('ParentHead',4)
|
||||
self.doc.start_paragraph('ParentName')
|
||||
self.doc.write_text('Children')
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
index = 1
|
||||
for child in self.family.getChildList():
|
||||
self.dump_child(index,child)
|
||||
index = index + 1
|
||||
|
||||
self.end()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class HtmlFamilyGroup(FamilyGroup):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,database,family,output,template):
|
||||
self.map = {}
|
||||
self.database = database
|
||||
self.family = family
|
||||
self.output = output
|
||||
self.first = []
|
||||
self.last = []
|
||||
if template == "":
|
||||
template = const.dataDir + os.sep + "family.html"
|
||||
self.template = template
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def fix(self,str):
|
||||
if str=="":
|
||||
return " "
|
||||
else:
|
||||
return str
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
templateFile = open(self.template,"r")
|
||||
lines = templateFile.readlines()
|
||||
templateFile.close()
|
||||
|
||||
in_last = 0
|
||||
for line in lines:
|
||||
if line[0:14] == "<!-- START -->":
|
||||
in_last = 1
|
||||
self.last.append(line);
|
||||
elif in_last == 0:
|
||||
self.first.append(line)
|
||||
else:
|
||||
self.last.append(line);
|
||||
|
||||
self.file = open(self.output,"w")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_header(self):
|
||||
for line in self.first:
|
||||
self.file.write(line)
|
||||
self.file.write("<H1>")
|
||||
self.file.write("Family Group Record")
|
||||
self.file.write("</H1>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
for line in self.last:
|
||||
self.file.write(line)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_parent(self,type,name):
|
||||
self.file.write('<tr>\n')
|
||||
self.file.write('<td colspan="3" class="parent_name">')
|
||||
self.file.write(type)
|
||||
self.file.write(' ')
|
||||
self.file.write(name.getPrimaryName().getRegularName())
|
||||
self.file.write('</td>\n')
|
||||
self.file.write('</tr>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def start_parent_stats(self):
|
||||
self.file.write('<table cellspacing="1" width="100%" border="1">\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end_parent_stats(self):
|
||||
self.file.write("</table>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_parent_stats(self,str1,str2,str3):
|
||||
self.file.write('<tr>\n')
|
||||
self.file.write('<td width="20%">' + self.fix(str1) + '</td>\n')
|
||||
self.file.write('<td width="30%">' + self.fix(str2) + '</td>\n')
|
||||
self.file.write('<td>' + self.fix(str3) + '</td>\n')
|
||||
self.file.write('</tr>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_parent_parent(self,str1,str2):
|
||||
self.file.write('<tr>\n')
|
||||
self.file.write('<td>' + self.fix(str1) + '</td>\n')
|
||||
self.file.write('<td colspan="2" class="child_name">' + self.fix(str2) + '</td>\n')
|
||||
self.file.write('</tr>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def start_child_stats(self):
|
||||
self.file.write('<table cellspacing="1" width="100%" border="1">\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end_child_stats(self):
|
||||
self.file.write("</table>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_child_stats(self,str1,str2,str3,str4,last):
|
||||
self.file.write('<tr>\n')
|
||||
self.file.write('<td width="10%">' + self.fix(str1) + '</td>\n')
|
||||
self.file.write('<td width="20%">' + self.fix(str2) + '</td>\n')
|
||||
self.file.write('<td width="30%">' + self.fix(str3) + '</td>\n')
|
||||
self.file.write('<td>' + self.fix(str4) + '</td>\n')
|
||||
self.file.write('</tr>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_child_name(self,index,child):
|
||||
self.file.write("<tr>\n")
|
||||
self.file.write("<td>" + str(index))
|
||||
if child.getGender() == RelLib.Person.male:
|
||||
self.file.write("M")
|
||||
else:
|
||||
self.file.write("F")
|
||||
self.file.write("</td>\n")
|
||||
self.file.write("<td colspan=\"3\">")
|
||||
self.file.write(child.getPrimaryName().getRegularName())
|
||||
self.file.write("</td>\n")
|
||||
self.file.write("</tr>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_child_spouse(self,spouse):
|
||||
self.file.write("<tr>\n")
|
||||
self.file.write("<td> </td>\n")
|
||||
self.file.write("<td>Spouse</td>\n")
|
||||
self.file.write("<td colspan=\"2\">")
|
||||
self.file.write(spouse.getPrimaryName().getRegularName())
|
||||
self.file.write("</td>\n")
|
||||
self.file.write("</tr>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_report(self):
|
||||
self.write_header()
|
||||
self.dump_parent(self.family.getFather())
|
||||
self.dump_parent(self.family.getMother())
|
||||
if len(self.family.getChildList()) > 0:
|
||||
self.file.write("<H2>")
|
||||
self.file.write("Children")
|
||||
self.file.write("</H2>\n")
|
||||
index = 1
|
||||
for child in self.family.getChildList():
|
||||
self.dump_child(index,child)
|
||||
index = index + 1
|
||||
|
||||
self.doc.end_table()
|
||||
self.end()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -640,7 +370,8 @@ class HtmlFamilyGroup(FamilyGroup):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def report(database,person):
|
||||
|
||||
import PaperMenu
|
||||
|
||||
global active_person
|
||||
global topDialog
|
||||
global glade_file
|
||||
@ -664,6 +395,9 @@ def report(database,person):
|
||||
"on_html_toggled" : on_html_toggled
|
||||
})
|
||||
|
||||
PaperMenu.make_paper_menu(topDialog.get_widget("papersize"))
|
||||
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
|
||||
|
||||
frame = topDialog.get_widget("spouse")
|
||||
option_menu = topDialog.get_widget("spouse_menu")
|
||||
|
||||
@ -707,13 +441,18 @@ def on_save_clicked(obj):
|
||||
|
||||
menu = topDialog.get_widget("spouse_menu").get_menu()
|
||||
family = menu.get_active().get_data("f")
|
||||
paper_obj = topDialog.get_widget("papersize")
|
||||
paper = paper_obj.get_menu().get_active().get_data("i")
|
||||
orien_obj = topDialog.get_widget("orientation")
|
||||
orien = orien_obj.get_menu().get_active().get_data("i")
|
||||
|
||||
if topDialog.get_widget("html").get_active():
|
||||
template = topDialog.get_widget("htmlfile").get_text()
|
||||
MyReport = HtmlFamilyGroup(db,family,outputName,template)
|
||||
doc = HtmlDoc(template)
|
||||
else:
|
||||
template = const.dataDir + os.sep + "familygrp.sxw"
|
||||
MyReport = OpenOfficeFamilyGroup(db,family,outputName,template)
|
||||
doc = OpenOfficeDoc(paper,orien)
|
||||
|
||||
MyReport = FamilyGroup(db,family,outputName,doc)
|
||||
|
||||
MyReport.setup()
|
||||
MyReport.write_report()
|
||||
|
@ -27,8 +27,14 @@ import re
|
||||
import sort
|
||||
import string
|
||||
import utils
|
||||
import intl
|
||||
|
||||
import OpenOffice
|
||||
_ = intl.gettext
|
||||
|
||||
from TextDoc import *
|
||||
from OpenOfficeDoc import *
|
||||
from HtmlDoc import *
|
||||
from AbiWordDoc import *
|
||||
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
@ -49,43 +55,20 @@ db = None
|
||||
#------------------------------------------------------------------------
|
||||
class IndivSummary:
|
||||
|
||||
def __init__(self,database,family,output,template):
|
||||
pass
|
||||
|
||||
def setup(self):
|
||||
return 1
|
||||
|
||||
def end(self):
|
||||
pass
|
||||
|
||||
def write_header(self):
|
||||
pass
|
||||
|
||||
def write_trailer(self):
|
||||
pass
|
||||
|
||||
def write_report(self):
|
||||
pass
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class OpenOfficeIndivSummary(IndivSummary):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,database,person,output,template):
|
||||
c = database.getResearcher().getName()
|
||||
self.open_office = OpenOffice.OpenOfficeCore(output,template,".sxw",c)
|
||||
def __init__(self,database,person,output,document):
|
||||
self.d = document
|
||||
|
||||
c = database.getResearcher().getName()
|
||||
self.d.creator(c)
|
||||
self.map = {}
|
||||
self.database = database
|
||||
self.person = person
|
||||
self.output = output
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -93,8 +76,53 @@ class OpenOfficeIndivSummary(IndivSummary):
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
self.file = self.open_office.setup()
|
||||
return 1
|
||||
font = FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.d.add_style("Title",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
font.set_italic(1)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.d.add_style("TableTitle",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.d.add_style("Spouse",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.d.add_style("Normal",p)
|
||||
|
||||
tbl = TableStyle()
|
||||
tbl.set_width(100)
|
||||
tbl.set_columns(2)
|
||||
tbl.set_column_width(0,20)
|
||||
tbl.set_column_width(1,80)
|
||||
self.d.add_table_style("IndTable",tbl)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_top_border(1)
|
||||
cell.set_bottom_border(1)
|
||||
self.d.add_cell_style("TableHead",cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
self.d.add_cell_style("NormalCell",cell)
|
||||
|
||||
self.d.open(self.output)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -102,7 +130,7 @@ class OpenOfficeIndivSummary(IndivSummary):
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
self.open_office.end()
|
||||
self.d.close()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -110,67 +138,8 @@ class OpenOfficeIndivSummary(IndivSummary):
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_header(self):
|
||||
self.file.write('<text:h text:style-name="Heading 1" ')
|
||||
self.file.write('text:level="1">')
|
||||
self.file.write('Summary of ')
|
||||
self.file.write(self.person.getPrimaryName().getRegularName())
|
||||
self.file.write('</text:h>\n')
|
||||
|
||||
if self.image != "":
|
||||
width = 46.0 * self.scale
|
||||
self.file.write('<text:p text:style-name="Text body"/>')
|
||||
self.file.write('<text:p text:style-name="Text body">')
|
||||
self.file.write('<draw:image draw:style-name="Individual Photo" ')
|
||||
self.file.write('draw:name="')
|
||||
self.file.write(self.person.getPrimaryName().getRegularName())
|
||||
self.file.write('" text:anchor-type=')
|
||||
self.file.write('"paragraph" svg:y="0mm" svg:height="46mm" ')
|
||||
val = "%6.2f" % width
|
||||
self.file.write('svg:width=' + string.strip('"%6.2fmm"' % width))
|
||||
self.file.write(' draw:z-index="0" xlink:href="#Pictures/')
|
||||
self.file.write(self.image)
|
||||
self.file.write('" xlink:type="simple" xlink:show="embed" ')
|
||||
self.file.write('xlink:actuate="onLoad"/>\n')
|
||||
self.file.write('</text:p>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_simple_row(self,field1,field2):
|
||||
self.file.write("<table:table-row>\n")
|
||||
self.file.write("<table:table-cell ")
|
||||
self.file.write("table:value-type=\"string\">\n")
|
||||
self.file.write('<text:p text:style-name="Table Contents">')
|
||||
self.file.write(field1)
|
||||
self.file.write('</text:p>\n')
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell ")
|
||||
self.file.write("table:value-type=\"string\">\n")
|
||||
self.file.write('<text:p text:style-name="Table Contents">')
|
||||
self.file.write(field2)
|
||||
self.file.write("</text:p>\n")
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("</table:table-row>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_header_row(self,field1):
|
||||
self.file.write('<table:table-row>\n')
|
||||
self.file.write('<table:table-cell ')
|
||||
self.file.write('table:number-columns-spanned="2" ')
|
||||
self.file.write('table:value-type=\"string\">\n')
|
||||
self.file.write('<text:p text:style-name="P1">')
|
||||
self.file.write(field1)
|
||||
self.file.write('</text:p>\n')
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:covered-table-cell/>\n")
|
||||
self.file.write("</table:table-row>\n")
|
||||
|
||||
pass
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -237,13 +206,27 @@ class OpenOfficeIndivSummary(IndivSummary):
|
||||
if place == "":
|
||||
return
|
||||
else:
|
||||
self.write_simple_row(name,place + ". " + description)
|
||||
val = place + ". " + description
|
||||
else:
|
||||
if place == "":
|
||||
self.write_simple_row(name,date + ". " + description)
|
||||
val = date + ". " + description
|
||||
else:
|
||||
self.write_simple_row(name,date + " in " + place + ". " + \
|
||||
description)
|
||||
val = date + " in " + place + ". " + description
|
||||
|
||||
self.d.start_row()
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.write_text(name)
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.write_text(val)
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
self.d.end_row()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -274,45 +257,58 @@ class OpenOfficeIndivSummary(IndivSummary):
|
||||
#--------------------------------------------------------------------
|
||||
def write_families(self):
|
||||
|
||||
self.file.write('<text:p text:style-name="Standard"/>')
|
||||
self.file.write('<table:table table:name="Table2" table:style-name="Table1">\n')
|
||||
self.file.write('<table:table-column table:style-name="Table1.A"/>\n')
|
||||
self.file.write('<table:table-column table:style-name="Table1.B"/>\n')
|
||||
|
||||
self.write_header_row("Marriages/Children")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.end_paragraph()
|
||||
self.d.start_table("three","IndTable")
|
||||
self.d.start_row()
|
||||
self.d.start_cell("TableHead",2)
|
||||
self.d.start_paragraph("TableTitle")
|
||||
self.d.write_text("Marriages/Children")
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
self.d.end_row()
|
||||
|
||||
for family in self.person.getFamilyList():
|
||||
if self.person == family.getFather():
|
||||
self.write_spouse(family.getMother())
|
||||
spouse = family.getMother()
|
||||
else:
|
||||
self.write_spouse(family.getFather())
|
||||
spouse = family.getFather()
|
||||
self.d.start_row()
|
||||
self.d.start_cell("NormalCell",2)
|
||||
self.d.start_paragraph("Spouse")
|
||||
self.d.write_text(spouse.getPrimaryName().getRegularName())
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
self.d.end_row()
|
||||
|
||||
event_list = [ family.getMarriage(), family.getDivorce() ]
|
||||
event_list = event_list + family.getEventList()
|
||||
for event in event_list:
|
||||
self.write_fact(event)
|
||||
|
||||
child_list = family.getChildList()
|
||||
if len(child_list) > 0:
|
||||
self.file.write("<table:table-row>\n")
|
||||
self.file.write("<table:table-cell ")
|
||||
self.file.write("table:value-type=\"string\">\n")
|
||||
self.file.write('<text:p text:style-name="Table Contents">')
|
||||
self.file.write('Children')
|
||||
self.file.write('</text:p>\n')
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("<table:table-cell ")
|
||||
self.file.write("table:value-type=\"string\">\n")
|
||||
self.d.start_row()
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.write_text("Children")
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
|
||||
self.file.write('<text:p text:style-name="Table Contents">')
|
||||
first = 1
|
||||
for child in family.getChildList():
|
||||
if first == 1:
|
||||
first = 0
|
||||
else:
|
||||
self.file.write('<text:line-break/>')
|
||||
self.file.write(child.getPrimaryName().getRegularName())
|
||||
self.file.write('</text:p>\n')
|
||||
self.file.write("</table:table-cell>\n")
|
||||
self.file.write("</table:table-row>\n")
|
||||
self.file.write('</table:table>\n')
|
||||
self.d.write_text('\n')
|
||||
self.d.write_text(child.getPrimaryName().getRegularName())
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
self.d.end_row()
|
||||
self.d.end_table()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -320,254 +316,130 @@ class OpenOfficeIndivSummary(IndivSummary):
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_report(self):
|
||||
photo_list = self.person.getPhotoList()
|
||||
if len(photo_list) > 0:
|
||||
import GdkImlib
|
||||
file = photo_list[0].getPath()
|
||||
image = GdkImlib.Image(file)
|
||||
height = image.rgb_height
|
||||
scale = float(height)/150.0
|
||||
width = int(image.rgb_width * scale)
|
||||
height = int(height * scale)
|
||||
base = os.path.basename(file)
|
||||
image_name = self.open_office.add_image(base)
|
||||
cmd = const.convert + " -size " + str(width) + "x150 "\
|
||||
+ file + " " + image_name
|
||||
os.system(cmd)
|
||||
self.scale = float(height)/float(width)
|
||||
self.image = base
|
||||
else:
|
||||
self.image = ""
|
||||
# photo_list = self.person.getPhotoList()
|
||||
# if len(photo_list) > 0:
|
||||
# import GdkImlib
|
||||
# file = photo_list[0].getPath()
|
||||
# image = GdkImlib.Image(file)
|
||||
# height = image.rgb_height
|
||||
# scale = float(height)/150.0
|
||||
# width = int(image.rgb_width * scale)
|
||||
# height = int(height * scale)
|
||||
# base = os.path.basename(file)
|
||||
# image_name = self.open_office.add_image(base)
|
||||
# cmd = const.convert + " -size " + str(width) + "x150 "\
|
||||
# + file + " " + image_name
|
||||
# os.system(cmd)
|
||||
# self.scale = float(height)/float(width)
|
||||
# self.image = base
|
||||
# else:
|
||||
# self.image = ""
|
||||
|
||||
self.write_header()
|
||||
self.write_general()
|
||||
self.write_facts()
|
||||
self.d.start_paragraph("Title")
|
||||
self.d.write_text('Summary of ')
|
||||
self.d.write_text(self.person.getPrimaryName().getRegularName())
|
||||
self.d.end_paragraph()
|
||||
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.end_paragraph()
|
||||
self.d.start_table("one","IndTable")
|
||||
|
||||
self.d.start_row()
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.write_text("Name:")
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.write_text(self.person.getPrimaryName().getRegularName())
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
self.d.end_row()
|
||||
|
||||
self.d.start_row()
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.write_text("Gender:")
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
if self.person.getGender() == RelLib.Person.male:
|
||||
self.d.write_text("Male")
|
||||
else:
|
||||
self.d.write_text("Female")
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
self.d.end_row()
|
||||
|
||||
family = self.person.getMainFamily()
|
||||
if family:
|
||||
father = family.getFather().getPrimaryName().getRegularName()
|
||||
mother = family.getMother().getPrimaryName().getRegularName()
|
||||
else:
|
||||
father = ""
|
||||
mother = ""
|
||||
|
||||
self.d.start_row()
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.write_text("Father:")
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.write_text(father)
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
self.d.end_row()
|
||||
|
||||
self.d.start_row()
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.write_text("Mother:")
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
|
||||
self.d.start_cell("NormalCell")
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.write_text(mother)
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
self.d.end_row()
|
||||
self.d.end_table()
|
||||
|
||||
self.d.start_paragraph("Normal")
|
||||
self.d.end_paragraph()
|
||||
|
||||
self.d.start_table("two","IndTable")
|
||||
self.d.start_row()
|
||||
self.d.start_cell("TableHead",2)
|
||||
self.d.start_paragraph("TableTitle")
|
||||
self.d.write_text("Individual Facts")
|
||||
self.d.end_paragraph()
|
||||
self.d.end_cell()
|
||||
self.d.end_row()
|
||||
|
||||
event_list = [ self.person.getBirth(), self.person.getDeath() ]
|
||||
event_list = event_list + self.person.getEventList()
|
||||
for event in event_list:
|
||||
self.write_fact(event)
|
||||
self.d.end_table()
|
||||
|
||||
self.write_families()
|
||||
self.end()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class HtmlIndivSummary(IndivSummary):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,database,family,output,template):
|
||||
self.map = {}
|
||||
self.database = database
|
||||
self.family = family
|
||||
self.output = output
|
||||
self.first = []
|
||||
self.last = []
|
||||
if template == "":
|
||||
template = const.dataDir + os.sep + "family.html"
|
||||
self.template = template
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def fix(self,str):
|
||||
if str=="":
|
||||
return " "
|
||||
else:
|
||||
return str
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
templateFile = open(self.template,"r")
|
||||
lines = templateFile.readlines()
|
||||
templateFile.close()
|
||||
|
||||
in_last = 0
|
||||
for line in lines:
|
||||
if line[0:14] == "<!-- START -->":
|
||||
in_last = 1
|
||||
self.last.append(line);
|
||||
elif in_last == 0:
|
||||
self.first.append(line)
|
||||
else:
|
||||
self.last.append(line);
|
||||
|
||||
if in_last == 0:
|
||||
GnomeErrorDialog("HTML template did not have a START comment")
|
||||
return 0
|
||||
|
||||
self.file = open(self.output,"w")
|
||||
return 1
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_header(self):
|
||||
for line in self.first:
|
||||
self.file.write(line)
|
||||
self.file.write("<H1>")
|
||||
self.file.write("Family Group Record")
|
||||
self.file.write("</H1>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_trailer(self):
|
||||
for line in self.last:
|
||||
self.file.write(line)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_parent(self,type,name):
|
||||
self.file.write('<tr>\n')
|
||||
self.file.write('<td colspan="3" class="parent_name">')
|
||||
self.file.write(type)
|
||||
self.file.write(' ')
|
||||
self.file.write(name.getPrimaryName().getRegularName())
|
||||
self.file.write('</td>\n')
|
||||
self.file.write('</tr>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def start_parent_stats(self):
|
||||
self.file.write('<table cellspacing="1" width="100%" border="1">\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end_parent_stats(self):
|
||||
self.file.write("</table>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_parent_stats(self,str1,str2,str3):
|
||||
self.file.write('<tr>\n')
|
||||
self.file.write('<td width="20%">' + self.fix(str1) + '</td>\n')
|
||||
self.file.write('<td width="30%">' + self.fix(str2) + '</td>\n')
|
||||
self.file.write('<td>' + self.fix(str3) + '</td>\n')
|
||||
self.file.write('</tr>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_parent_parent(self,str1,str2):
|
||||
self.file.write('<tr>\n')
|
||||
self.file.write('<td>' + self.fix(str1) + '</td>\n')
|
||||
self.file.write('<td colspan="2" class="child_name">' + self.fix(str2) + '</td>\n')
|
||||
self.file.write('</tr>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def start_child_stats(self):
|
||||
self.file.write('<table cellspacing="1" width="100%" border="1">\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end_child_stats(self):
|
||||
self.file.write("</table>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_child_stats(self,str1,str2,str3,str4,last):
|
||||
self.file.write('<tr>\n')
|
||||
self.file.write('<td width="10%">' + self.fix(str1) + '</td>\n')
|
||||
self.file.write('<td width="20%">' + self.fix(str2) + '</td>\n')
|
||||
self.file.write('<td width="30%">' + self.fix(str3) + '</td>\n')
|
||||
self.file.write('<td>' + self.fix(str4) + '</td>\n')
|
||||
self.file.write('</tr>\n')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_child_name(self,index,child):
|
||||
self.file.write("<tr>\n")
|
||||
self.file.write("<td>" + str(index))
|
||||
if child.getGender() == RelLib.Person.male:
|
||||
self.file.write("M")
|
||||
else:
|
||||
self.file.write("F")
|
||||
self.file.write("</td>\n")
|
||||
self.file.write("<td colspan=\"3\">")
|
||||
self.file.write(child.getPrimaryName().getRegularName())
|
||||
self.file.write("</td>\n")
|
||||
self.file.write("</tr>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_child_spouse(self,spouse):
|
||||
self.file.write("<tr>\n")
|
||||
self.file.write("<td> </td>\n")
|
||||
self.file.write("<td>Spouse</td>\n")
|
||||
self.file.write("<td colspan=\"2\">")
|
||||
self.file.write(spouse.getPrimaryName().getRegularName())
|
||||
self.file.write("</td>\n")
|
||||
self.file.write("</tr>\n")
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_report(self):
|
||||
self.write_header()
|
||||
self.dump_parent(self.family.getFather())
|
||||
self.dump_parent(self.family.getMother())
|
||||
if len(self.family.getChildList()) > 0:
|
||||
self.file.write("<H2>")
|
||||
self.file.write("Children")
|
||||
self.file.write("</H2>\n")
|
||||
index = 1
|
||||
for child in self.family.getChildList():
|
||||
self.dump_child(index,child)
|
||||
index = index + 1
|
||||
|
||||
self.write_trailer()
|
||||
self.end()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def report(database,person):
|
||||
import PaperMenu
|
||||
|
||||
global active_person
|
||||
global topDialog
|
||||
@ -585,6 +457,10 @@ def report(database,person):
|
||||
label = topDialog.get_widget("labelTitle")
|
||||
|
||||
label.set_text("Individual Summary for " + name)
|
||||
|
||||
PaperMenu.make_paper_menu(topDialog.get_widget("papersize"))
|
||||
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
|
||||
|
||||
topDialog.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_save_clicked" : on_save_clicked,
|
||||
@ -612,16 +488,20 @@ def on_save_clicked(obj):
|
||||
if outputName == "":
|
||||
return
|
||||
|
||||
paper_obj = topDialog.get_widget("papersize")
|
||||
paper = paper_obj.get_menu().get_active().get_data("i")
|
||||
orien_obj = topDialog.get_widget("orientation")
|
||||
orien = orien_obj.get_menu().get_active().get_data("i")
|
||||
|
||||
if topDialog.get_widget("html").get_active():
|
||||
template = topDialog.get_widget("htmlfile").get_text()
|
||||
MyReport = HtmlIndivSummary(db,family,outputName,template)
|
||||
doc = HtmlDoc(template)
|
||||
else:
|
||||
template = const.dataDir + os.sep + "indsum.sxw"
|
||||
MyReport = OpenOfficeIndivSummary(db,active_person,outputName,template)
|
||||
doc = OpenOfficeDoc(paper,orien)
|
||||
|
||||
if MyReport.setup() == 0:
|
||||
return
|
||||
|
||||
MyReport = IndivSummary(db,active_person,outputName,doc)
|
||||
|
||||
MyReport.setup()
|
||||
MyReport.write_report()
|
||||
|
||||
utils.destroy_passed_object(obj)
|
||||
@ -632,8 +512,8 @@ def on_save_clicked(obj):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return "Creates a family group report, showing information on "\
|
||||
"a set of parents and their children."
|
||||
return _("Creates a family group report, showing information on ") +\
|
||||
_("a set of parents and their children.")
|
||||
|
||||
|
||||
|
||||
|
@ -139,7 +139,7 @@ def importData(database, filename):
|
||||
familyTree = 0
|
||||
in_change = 0
|
||||
photo = None
|
||||
ansel = 0
|
||||
encoding = 0
|
||||
|
||||
# add some checking here
|
||||
|
||||
@ -174,8 +174,10 @@ def importData(database, filename):
|
||||
for line in allLines:
|
||||
|
||||
line = string.replace(line, '\r', "")
|
||||
if ansel == 1:
|
||||
if encoding == 1:
|
||||
line = latin_ansel.ansel_to_latin(line)
|
||||
elif encoding == 2:
|
||||
line = latin_utf8.utf8_to_latin(line)
|
||||
|
||||
if currentLine == value and index <= 20:
|
||||
index = index + 1
|
||||
@ -187,12 +189,13 @@ def importData(database, filename):
|
||||
|
||||
currentLine = currentLine + 1
|
||||
|
||||
|
||||
regex_match = charRegexp.match(line)
|
||||
if regex_match:
|
||||
id = regex_match.groups()
|
||||
if id[0] == "ANSEL":
|
||||
ansel = 1
|
||||
encoding = 1
|
||||
elif id[0] == "UNICODE" or id[0] == "UTF-8" or id[0] == "UTF8":
|
||||
encoding = 2
|
||||
continue
|
||||
|
||||
regex_match = changeRegexp.match(line)
|
||||
|
@ -209,129 +209,15 @@
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>abiword</name>
|
||||
<visible>False</visible>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Abiword</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>format</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>html</name>
|
||||
<visible>False</visible>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>on_html_toggled</handler>
|
||||
<last_modification_time>Tue, 20 Mar 2001 17:02:37 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>HTML</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>format</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>latex</name>
|
||||
<visible>False</visible>
|
||||
<can_focus>True</can_focus>
|
||||
<label>LaTeX</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>format</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox1</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label11</name>
|
||||
<visible>False</visible>
|
||||
<label>Template : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeFileEntry</class>
|
||||
<name>htmltemplate</name>
|
||||
<visible>False</visible>
|
||||
<sensitive>False</sensitive>
|
||||
<history_id>HtmlTemplate</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<title>Choose the HTML template</title>
|
||||
<directory>False</directory>
|
||||
<modal>False</modal>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>htmlfile</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
<label>Options</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
@ -339,15 +225,13 @@
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox4</name>
|
||||
<class>GtkTable</class>
|
||||
<name>table1</name>
|
||||
<rows>3</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
@ -355,14 +239,121 @@
|
||||
<label>Generations : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label14</name>
|
||||
<label>Paper : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label15</name>
|
||||
<label>Orientation : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>papersize</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items>
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>orientation</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items>
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
@ -383,16 +374,21 @@
|
||||
<page>10</page>
|
||||
<page_size>10</page_size>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -180,6 +180,7 @@
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame1</name>
|
||||
<border_width>3</border_width>
|
||||
<label>Format</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
@ -225,97 +226,90 @@
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>html</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>on_html_toggled</handler>
|
||||
<last_modification_time>Tue, 20 Mar 2001 17:02:37 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>HTML</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>format</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>latex</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>LaTeX</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>format</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox1</name>
|
||||
<name>hbox5</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>html</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>on_html_toggled</handler>
|
||||
<last_modification_time>Tue, 20 Mar 2001 17:02:37 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>HTML</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>format</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label11</name>
|
||||
<label>Template : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox1</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeFileEntry</class>
|
||||
<name>htmltemplate</name>
|
||||
<sensitive>False</sensitive>
|
||||
<history_id>HtmlTemplate</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<title>Choose the HTML template</title>
|
||||
<directory>False</directory>
|
||||
<modal>False</modal>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>htmlfile</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<class>GtkLabel</class>
|
||||
<name>label11</name>
|
||||
<label>Template : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeFileEntry</class>
|
||||
<name>htmltemplate</name>
|
||||
<sensitive>False</sensitive>
|
||||
<history_id>HtmlTemplate</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<title>Choose the HTML template</title>
|
||||
<directory>False</directory>
|
||||
<modal>False</modal>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>htmlfile</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -323,10 +317,12 @@
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
<border_width>4</border_width>
|
||||
<label>Options</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
@ -334,69 +330,214 @@
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox4</name>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox5</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label13</name>
|
||||
<label>Generations : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkSpinButton</class>
|
||||
<name>generations</name>
|
||||
<can_focus>True</can_focus>
|
||||
<climb_rate>1</climb_rate>
|
||||
<digits>0</digits>
|
||||
<numeric>True</numeric>
|
||||
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
|
||||
<snap>False</snap>
|
||||
<wrap>False</wrap>
|
||||
<value>10</value>
|
||||
<lower>1</lower>
|
||||
<upper>28</upper>
|
||||
<step>1</step>
|
||||
<page>10</page>
|
||||
<page_size>10</page_size>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>pagebreak</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>New page for each generation</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>20</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table1</name>
|
||||
<rows>4</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label14</name>
|
||||
<label>Paper : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label13</name>
|
||||
<label>Generations : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>pagebreak</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Page break between generations</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>3</top_attach>
|
||||
<bottom_attach>4</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkSpinButton</class>
|
||||
<name>generations</name>
|
||||
<can_focus>True</can_focus>
|
||||
<climb_rate>1</climb_rate>
|
||||
<digits>0</digits>
|
||||
<numeric>True</numeric>
|
||||
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
|
||||
<snap>False</snap>
|
||||
<wrap>False</wrap>
|
||||
<value>10</value>
|
||||
<lower>1</lower>
|
||||
<upper>28</upper>
|
||||
<step>1</step>
|
||||
<page>10</page>
|
||||
<page_size>10</page_size>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>papersize</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items></items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label15</name>
|
||||
<label>Orientation : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>orientation</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items></items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -304,9 +304,124 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
<label>Options</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table1</name>
|
||||
<rows>2</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
<class>GtkLabel</class>
|
||||
<name>label13</name>
|
||||
<label>Paper : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label14</name>
|
||||
<label>Orientation : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>papersize</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items></items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>orientation</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items></items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -311,9 +311,124 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
<label>Options</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table1</name>
|
||||
<rows>2</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
<class>GtkLabel</class>
|
||||
<name>label14</name>
|
||||
<label>Orientation : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label13</name>
|
||||
<label>Paper : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>orientation</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items></items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>papersize</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items></items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -288,9 +288,126 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
<label>Options</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table1</name>
|
||||
<rows>2</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
<class>GtkLabel</class>
|
||||
<name>label13</name>
|
||||
<label>Paper : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label14</name>
|
||||
<label>Orientation : </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>orientation</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items>
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>papersize</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items>
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>5</xpad>
|
||||
<ypad>5</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user