diff --git a/gramps/src/Date.py b/gramps/src/Date.py
index e93266415..67799c267 100644
--- a/gramps/src/Date.py
+++ b/gramps/src/Date.py
@@ -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
+
#-------------------------------------------------------------------------
#
#
diff --git a/gramps/src/DrawDoc.py b/gramps/src/DrawDoc.py
new file mode 100644
index 000000000..120eda929
--- /dev/null
+++ b/gramps/src/DrawDoc.py
@@ -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
+
diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py
index bf9e56c76..ec1439a2e 100644
--- a/gramps/src/EditPerson.py
+++ b/gramps/src/EditPerson.py
@@ -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)
diff --git a/gramps/src/HtmlDoc.py b/gramps/src/HtmlDoc.py
new file mode 100644
index 000000000..7690aaf30
--- /dev/null
+++ b/gramps/src/HtmlDoc.py
@@ -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 = [
+ '\n',
+ '\n',
+ '
\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n'
+ ]
+
+_bottom = [
+ '\n',
+ '\n',
+ '\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"")
+ stop = re.compile(r"")
+
+ 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 '' 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('\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('\n' % self.tbl.get_width())
+
+ def end_table(self):
+ self.f.write('
\n')
+
+ def start_row(self):
+ self.col = 0
+ self.f.write('\n')
+
+ def end_row(self):
+ self.f.write('
\n')
+
+ def start_cell(self,style_name,span=1):
+ self.empty = 1
+ self.f.write(' 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(' | \n')
+
+ def start_paragraph(self,style_name):
+ self.f.write('')
+
+ def end_paragraph(self):
+ if self.empty == 1:
+ self.f.write(' ')
+ self.empty = 0
+ self.f.write('
\n')
+
+ def write_text(self,text):
+ if text != "":
+ self.empty = 0
+ text = string.replace(text,'\n','
>')
+ self.f.write(text)
+
diff --git a/gramps/src/Marriage.py b/gramps/src/Marriage.py
index 1c9c4206e..3570a2a4b 100644
--- a/gramps/src/Marriage.py
+++ b/gramps/src/Marriage.py
@@ -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
diff --git a/gramps/src/OpenDrawDoc.py b/gramps/src/OpenDrawDoc.py
new file mode 100644
index 000000000..d76892967
--- /dev/null
+++ b/gramps/src/OpenDrawDoc.py
@@ -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('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ for key in self.paragraph_styles.keys():
+ style = self.paragraph_styles[key]
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+
+ def close(self):
+ self.f.write('\n')
+ self.f.write('\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('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+
+ for style_name in self.draw_styles.keys():
+ style = self.draw_styles[style_name]
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+
+ self.f.write('\n')
+ for key in self.paragraph_styles.keys():
+ style = self.paragraph_styles[key]
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+
+ # Current no leading number format for headers
+
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n' % self.rmargin)
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.close()
+
+ def start_paragraph(self,style_name):
+ self.f.write('' % style_name)
+
+ def end_paragraph(self):
+ self.f.write('\n')
+
+ def write_text(self,text):
+ text = string.replace(text,'\t','')
+ text = string.replace(text,'\n','')
+ 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('\n')
+ self.f.write('')
+ self.f.write('')
+ self.f.write('')
+ self.f.write('')
+ self.f.write('')
+ self.f.write('')
+ #self.f.write('')
+ self.f.write('\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('\n')
+ self.f.write('\n');
+ self.f.write('\n')
+ self.f.write('')
+ self.f.write(const.progName + ' ' + const.version)
+ self.f.write('\n')
+ self.f.write('')
+ self.f.write(name)
+ self.f.write('\n')
+ self.f.write('')
+ self.f.write(self.time)
+ self.f.write('\n')
+ self.f.write('')
+ self.f.write(name)
+ self.f.write('\n')
+ self.f.write('')
+ self.f.write(self.time)
+ self.f.write('\n')
+ self.f.write('0-00-00T00:00:00\n')
+ self.f.write('en-US\n')
+ self.f.write('1\n')
+ self.f.write('PT0S\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.write('\n')
+ self.f.close()
+
+ def start_page(self,orientation=None):
+ self.page = self.page + 1
+ self.f.write('\n')
+
+ def end_page(self):
+ self.f.write('\n')
+
+ def draw_line(self,style,x1,y1,x2,y2):
+ self.f.write('\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('')
+ text = latin_to_utf8(string.replace(text,'\n',''))
+ self.f.write('>\n')
+ self.f.write('')
+ self.f.write(''+text+'\n')
+ self.f.write('\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()
diff --git a/gramps/src/ReadXML.py b/gramps/src/ReadXML.py
index 5ee1d45e7..03cf8fab7 100644
--- a/gramps/src/ReadXML.py
+++ b/gramps/src/ReadXML.py
@@ -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):
-
diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py
index 9bb28c4e5..b29d5c9db 100644
--- a/gramps/src/RelLib.py
+++ b/gramps/src/RelLib.py
@@ -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
diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py
index 342982a3a..5138603e8 100755
--- a/gramps/src/gramps_main.py
+++ b/gramps/src/gramps_main.py
@@ -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)
diff --git a/gramps/src/plugins/AncestorChart.py b/gramps/src/plugins/AncestorChart.py
index 935d98912..491a08335 100644
--- a/gramps/src/plugins/AncestorChart.py
+++ b/gramps/src/plugins/AncestorChart.py
@@ -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("")
-
+ self.doc.start_page()
self.draw_graph(1,start,0)
-
- self.file.write("\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("\n")
-
- self.file.write("")
- self.file.write("")
- self.file.write(person.getPrimaryName().getRegularName())
- self.file.write("\n");
+ name = person.getPrimaryName().getRegularName()
birth = person.getBirth()
if birth and birth.getDate() != "":
- self.file.write("")
- self.file.write("b. ")
- self.file.write(birth.getDate())
- self.file.write("\n");
+ name = name + "\nb. " + birth.getDate()
death = person.getDeath()
if death and death.getDate() != "":
- self.file.write("")
- self.file.write("d. ")
- self.file.write(death.getDate())
- self.file.write("\n");
-
- self.file.write("\n")
- if myPoints[2] != "":
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n");
-
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\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()
diff --git a/gramps/src/plugins/AncestorReport.py b/gramps/src/plugins/AncestorReport.py
index aa8a0f97e..68a87eeb2 100644
--- a/gramps/src/plugins/AncestorReport.py
+++ b/gramps/src/plugins/AncestorReport.py
@@ -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("" + name + "\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def heading_start(self,newpage):
- if newpage :
- self.file.write("")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def heading_stop(self):
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def list_para_start(self,number,heading):
- self.file.write("")
- self.file.write(number + "")
- self.file.write("")
- self.file.write(heading + "")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def list_para_stop(self):
- self.file.write("\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("" + name + "
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def heading_start(self,newpage):
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def heading_stop(self):
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def list_para_start(self,number,heading):
- self.file.write("")
- self.file.write("" + heading + "")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def list_para_stop(self):
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def setup(self):
- if self.template == "":
- self.first = [
- '\n',
- '\n',
- '\n',
- '\n',
- '\n',
- '\n',
- '\n',
- '\n',
- '\n'
- ]
- self.last = [
- '\n',
- '\n',
- '\n'
- ]
- else:
- start = re.compile(r"")
-
- 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"")
- 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("\n");
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def list_end(self):
- self.file.write("
\n");
-
-#------------------------------------------------------------------------
-#
-#
-#
-#------------------------------------------------------------------------
-class AncestorReportAbiword(AncestorReport):
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_title(self,name):
- self.file.write('' + name + '
\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def heading_start(self,newpage):
- self.file.write('')
- if newpage:
- self.file.write('')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def heading_stop(self):
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def list_para_start(self,number,heading):
- self.file.write('')
- self.file.write(number + '\t')
- self.file.write('')
- self.file.write(heading)
- self.file.write('')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def list_para_stop(self):
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def setup(self):
- self.file = open(self.output,"w")
- self.file.write('\n')
- self.file.write('\n')
- self.file.write('\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def end(self):
- self.file.write('\n')
- self.file.write('\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)
diff --git a/gramps/src/plugins/DescendReport.py b/gramps/src/plugins/DescendReport.py
index bde5dd2e0..8bbbfe157 100644
--- a/gramps/src/plugins/DescendReport.py
+++ b/gramps/src/plugins/DescendReport.py
@@ -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('')
- self.file.write('Descendants of ')
- self.file.write(self.person.getPrimaryName().getRegularName())
- self.file.write('\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('')
- 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('\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('\n')
- self.file.write('\n')
- self.file.write('\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def end(self):
-
- self.file.write('\n')
- self.file.write('\n')
- self.file.close()
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def report(self):
- self.file.write('')
- self.file.write('Descendants of ')
- self.file.write(self.person.getPrimaryName().getRegularName())
- self.file.write('
\n')
- self.dump(1,self.person)
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def dump(self,level,person):
- self.file.write(' 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('
\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)
#------------------------------------------------------------------------
#
diff --git a/gramps/src/plugins/FamilyGroup.py b/gramps/src/plugins/FamilyGroup.py
index 261f7bc40..ad827b1cc 100644
--- a/gramps/src/plugins/FamilyGroup.py
+++ b/gramps/src/plugins/FamilyGroup.py
@@ -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('')
- self.file.write('Family Group Record')
- self.file.write('\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_parent(self,type,name):
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("")
- self.file.write(type)
- self.file.write("")
- self.file.write(name.getPrimaryName().getRegularName())
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def start_parent_stats(self):
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def end_parent_stats(self):
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_parent_stats(self,str1,str2,str3):
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("" + str1 + \
- "\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("" + str2 + \
- "\n")
- self.file.write("\n")
- self.file.write("\n");
- self.file.write("" + str3 +
- "\n")
- self.file.write("\n")
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_parent_parent(self,str1,str2):
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("" + str1 + \
- "\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("")
- self.file.write(str2)
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def start_child_stats(self):
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def end_child_stats(self):
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_child_stats(self,str1,str2,str3,str4,last):
- self.file.write("\n")
- if last == 1:
- self.file.write("\n")
- else:
- self.file.write("\n")
- self.file.write("" + str1 +\
- "\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("" + str2 +
- "\n")
- self.file.write("\n")
- self.file.write("\n");
- self.file.write("" + str3 +
- "\n")
- self.file.write("\n")
- self.file.write("\n");
- self.file.write("" + str4 +
- "\n")
- self.file.write("\n")
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_child_name(self,index,child):
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("" + str(index))
- if child.getGender() == RelLib.Person.male:
- self.file.write("M")
- else:
- self.file.write("F")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("")
- self.file.write(child.getPrimaryName().getRegularName())
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_child_spouse(self,spouse):
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("")
- self.file.write("Spouse")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("")
- self.file.write(spouse.getPrimaryName().getRegularName())
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\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("")
- self.file.write("Children")
- self.file.write("")
- self.file.write("\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] == "":
- 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("")
- self.file.write("Family Group Record")
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def end(self):
- for line in self.last:
- self.file.write(line)
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_parent(self,type,name):
- self.file.write('\n')
- self.file.write('')
- self.file.write(type)
- self.file.write(' ')
- self.file.write(name.getPrimaryName().getRegularName())
- self.file.write(' | \n')
- self.file.write('
\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def start_parent_stats(self):
- self.file.write('\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def end_parent_stats(self):
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_parent_stats(self,str1,str2,str3):
- self.file.write('\n')
- self.file.write('' + self.fix(str1) + ' | \n')
- self.file.write('' + self.fix(str2) + ' | \n')
- self.file.write('' + self.fix(str3) + ' | \n')
- self.file.write('
\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_parent_parent(self,str1,str2):
- self.file.write('\n')
- self.file.write('' + self.fix(str1) + ' | \n')
- self.file.write('' + self.fix(str2) + ' | \n')
- self.file.write('
\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def start_child_stats(self):
- self.file.write('\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def end_child_stats(self):
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_child_stats(self,str1,str2,str3,str4,last):
- self.file.write('\n')
- self.file.write('' + self.fix(str1) + ' | \n')
- self.file.write('' + self.fix(str2) + ' | \n')
- self.file.write('' + self.fix(str3) + ' | \n')
- self.file.write('' + self.fix(str4) + ' | \n')
- self.file.write('
\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_child_name(self,index,child):
- self.file.write("\n")
- self.file.write("" + str(index))
- if child.getGender() == RelLib.Person.male:
- self.file.write("M")
- else:
- self.file.write("F")
- self.file.write(" | \n")
- self.file.write("")
- self.file.write(child.getPrimaryName().getRegularName())
- self.file.write(" | \n")
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_child_spouse(self,spouse):
- self.file.write("\n")
- self.file.write(" | \n")
- self.file.write("Spouse | \n")
- self.file.write("")
- self.file.write(spouse.getPrimaryName().getRegularName())
- self.file.write(" | \n")
- self.file.write("
\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("")
- self.file.write("Children")
- self.file.write("
\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()
diff --git a/gramps/src/plugins/IndivSummary.py b/gramps/src/plugins/IndivSummary.py
index f36d61dbe..545712a9f 100644
--- a/gramps/src/plugins/IndivSummary.py
+++ b/gramps/src/plugins/IndivSummary.py
@@ -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('')
- self.file.write('Summary of ')
- self.file.write(self.person.getPrimaryName().getRegularName())
- self.file.write('\n')
-
- if self.image != "":
- width = 46.0 * self.scale
- self.file.write('')
- self.file.write('')
- self.file.write('\n')
- self.file.write('\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_simple_row(self,field1,field2):
- self.file.write("\n")
- self.file.write("\n")
- self.file.write('')
- self.file.write(field1)
- self.file.write('\n')
- self.file.write("\n")
- self.file.write("\n")
- self.file.write('')
- self.file.write(field2)
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_header_row(self,field1):
- self.file.write('\n')
- self.file.write('\n')
- self.file.write('')
- self.file.write(field1)
- self.file.write('\n')
- self.file.write("\n")
- self.file.write("\n")
- self.file.write("\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('')
- self.file.write('\n')
- self.file.write('\n')
- self.file.write('\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("\n")
- self.file.write("\n")
- self.file.write('')
- self.file.write('Children')
- self.file.write('\n')
- self.file.write("\n")
- self.file.write("\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('')
first = 1
for child in family.getChildList():
if first == 1:
first = 0
else:
- self.file.write('')
- self.file.write(child.getPrimaryName().getRegularName())
- self.file.write('\n')
- self.file.write("\n")
- self.file.write("\n")
- self.file.write('\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] == "":
- 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("")
- self.file.write("Family Group Record")
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_trailer(self):
- for line in self.last:
- self.file.write(line)
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_parent(self,type,name):
- self.file.write('\n')
- self.file.write('')
- self.file.write(type)
- self.file.write(' ')
- self.file.write(name.getPrimaryName().getRegularName())
- self.file.write(' | \n')
- self.file.write('
\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def start_parent_stats(self):
- self.file.write('\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def end_parent_stats(self):
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_parent_stats(self,str1,str2,str3):
- self.file.write('\n')
- self.file.write('' + self.fix(str1) + ' | \n')
- self.file.write('' + self.fix(str2) + ' | \n')
- self.file.write('' + self.fix(str3) + ' | \n')
- self.file.write('
\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_parent_parent(self,str1,str2):
- self.file.write('\n')
- self.file.write('' + self.fix(str1) + ' | \n')
- self.file.write('' + self.fix(str2) + ' | \n')
- self.file.write('
\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def start_child_stats(self):
- self.file.write('\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def end_child_stats(self):
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_child_stats(self,str1,str2,str3,str4,last):
- self.file.write('\n')
- self.file.write('' + self.fix(str1) + ' | \n')
- self.file.write('' + self.fix(str2) + ' | \n')
- self.file.write('' + self.fix(str3) + ' | \n')
- self.file.write('' + self.fix(str4) + ' | \n')
- self.file.write('
\n')
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_child_name(self,index,child):
- self.file.write("\n")
- self.file.write("" + str(index))
- if child.getGender() == RelLib.Person.male:
- self.file.write("M")
- else:
- self.file.write("F")
- self.file.write(" | \n")
- self.file.write("")
- self.file.write(child.getPrimaryName().getRegularName())
- self.file.write(" | \n")
- self.file.write("
\n")
-
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
- def write_child_spouse(self,spouse):
- self.file.write("\n")
- self.file.write(" | \n")
- self.file.write("Spouse | \n")
- self.file.write("")
- self.file.write(spouse.getPrimaryName().getRegularName())
- self.file.write(" | \n")
- self.file.write("
\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("")
- self.file.write("Children")
- self.file.write("
\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.")
diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py
index 0c6ecbefd..e9548f7a1 100644
--- a/gramps/src/plugins/ReadGedcom.py
+++ b/gramps/src/plugins/ReadGedcom.py
@@ -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)
diff --git a/gramps/src/plugins/ancestorchart.glade b/gramps/src/plugins/ancestorchart.glade
index 5be6319fb..639e40443 100644
--- a/gramps/src/plugins/ancestorchart.glade
+++ b/gramps/src/plugins/ancestorchart.glade
@@ -209,129 +209,15 @@
False
-
-
- GtkRadioButton
- abiword
- False
- True
-
- False
- True
- format
-
- 0
- False
- False
-
-
-
-
- GtkRadioButton
- html
- False
- True
-
- toggled
- on_html_toggled
- Tue, 20 Mar 2001 17:02:37 GMT
-
-
- False
- True
- format
-
- 0
- False
- False
-
-
-
-
- GtkRadioButton
- latex
- False
- True
-
- False
- True
- format
-
- 0
- False
- False
-
-
-
-
- GtkHBox
- hbox1
- False
- 0
-
- 5
- True
- True
-
-
-
- Placeholder
-
-
-
- GtkLabel
- label11
- False
-
- GTK_JUSTIFY_CENTER
- False
- 1
- 0.5
- 0
- 0
-
- 0
- True
- True
-
-
-
-
- GnomeFileEntry
- htmltemplate
- False
- False
- HtmlTemplate
- 10
- Choose the HTML template
- False
- False
-
- 5
- True
- True
-
-
-
- GtkEntry
- GnomeEntry:entry
- htmlfile
- True
- True
- True
- 0
-
-
-
-
- GtkHBox
- hbox3
- False
- 0
+ GtkFrame
+ frame2
+
+ 0
+ GTK_SHADOW_ETCHED_IN
0
True
@@ -339,15 +225,13 @@
- GtkHBox
- hbox4
+ GtkTable
+ table1
+ 3
+ 2
False
- 0
-
- 0
- True
- True
-
+ 0
+ 0
GtkLabel
@@ -355,14 +239,121 @@
GTK_JUSTIFY_CENTER
False
- 0.5
+ 1
0.5
0
0
- 0
- False
- False
+ 0
+ 1
+ 2
+ 3
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label14
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label15
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkOptionMenu
+ papersize
+ True
+
+
+ 0
+
+ 1
+ 2
+ 0
+ 1
+ 5
+ 5
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkOptionMenu
+ orientation
+ True
+
+
+ 0
+
+ 1
+ 2
+ 1
+ 2
+ 5
+ 5
+ False
+ False
+ False
+ False
+ True
+ False
@@ -383,16 +374,21 @@
10
10
- 0
- False
- True
+ 1
+ 2
+ 2
+ 3
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
-
-
- Placeholder
-
diff --git a/gramps/src/plugins/ancestorreport.glade b/gramps/src/plugins/ancestorreport.glade
index af77de08c..702e33ac1 100644
--- a/gramps/src/plugins/ancestorreport.glade
+++ b/gramps/src/plugins/ancestorreport.glade
@@ -180,6 +180,7 @@
GtkFrame
frame1
+ 3
0
GTK_SHADOW_ETCHED_IN
@@ -225,97 +226,90 @@
-
- GtkRadioButton
- html
- True
-
- toggled
- on_html_toggled
- Tue, 20 Mar 2001 17:02:37 GMT
-
-
- False
- True
- format
-
- 0
- False
- False
-
-
-
-
- GtkRadioButton
- latex
- True
-
- False
- True
- format
-
- 0
- False
- False
-
-
-
GtkHBox
- hbox1
+ hbox5
False
0
- 5
- True
- True
+ 0
+ False
+ False
- Placeholder
+ GtkRadioButton
+ html
+ True
+
+ toggled
+ on_html_toggled
+ Tue, 20 Mar 2001 17:02:37 GMT
+
+
+ False
+ True
+ format
+
+ 0
+ False
+ False
+
- GtkLabel
- label11
-
- GTK_JUSTIFY_CENTER
- False
- 1
- 0.5
- 0
- 0
+ GtkHBox
+ hbox1
+ False
+ 0
0
True
True
-
-
-
- GnomeFileEntry
- htmltemplate
- False
- HtmlTemplate
- 10
- Choose the HTML template
- False
- False
-
- 5
- True
- True
-
- GtkEntry
- GnomeEntry:entry
- htmlfile
- True
- True
- True
- 0
-
+ GtkLabel
+ label11
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ True
+ True
+
+
+
+
+ GnomeFileEntry
+ htmltemplate
+ False
+ HtmlTemplate
+ 10
+ Choose the HTML template
+ False
+ False
+
+ 5
+ True
+ True
+
+
+
+ GtkEntry
+ GnomeEntry:entry
+ htmlfile
+ True
+ True
+ True
+ 0
+
+
@@ -323,10 +317,12 @@
- GtkHBox
- hbox3
- False
- 0
+ GtkFrame
+ frame2
+ 4
+
+ 0
+ GTK_SHADOW_ETCHED_IN
0
True
@@ -334,69 +330,214 @@
- GtkHBox
- hbox4
+ GtkVBox
+ vbox5
False
0
-
- 0
- True
- True
-
- GtkLabel
- label13
-
- GTK_JUSTIFY_CENTER
- False
- 0.5
- 0.5
- 0
- 0
+ GtkHBox
+ hbox3
+ False
+ 0
0
- False
- False
-
-
-
-
- GtkSpinButton
- generations
- True
- 1
- 0
- True
- GTK_UPDATE_ALWAYS
- False
- False
- 10
- 1
- 28
- 1
- 10
- 10
-
- 0
- False
+ True
True
-
-
-
- GtkCheckButton
- pagebreak
- True
-
- False
- True
-
- 20
- False
- False
-
+
+ GtkTable
+ table1
+ 4
+ 2
+ False
+ 0
+ 0
+
+ 0
+ True
+ True
+
+
+
+ GtkLabel
+ label14
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label13
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 2
+ 3
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkCheckButton
+ pagebreak
+ True
+
+ False
+ True
+
+ 1
+ 2
+ 3
+ 4
+ 5
+ 5
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkSpinButton
+ generations
+ True
+ 1
+ 0
+ True
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 10
+ 1
+ 28
+ 1
+ 10
+ 10
+
+ 1
+ 2
+ 2
+ 3
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkOptionMenu
+ papersize
+ True
+
+ 0
+
+ 1
+ 2
+ 0
+ 1
+ 5
+ 5
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label15
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkOptionMenu
+ orientation
+ True
+
+ 0
+
+ 1
+ 2
+ 1
+ 2
+ 5
+ 5
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
diff --git a/gramps/src/plugins/desreport.glade b/gramps/src/plugins/desreport.glade
index ca0d4fe8b..654cc48b1 100644
--- a/gramps/src/plugins/desreport.glade
+++ b/gramps/src/plugins/desreport.glade
@@ -304,9 +304,124 @@
+
+
+
+
+ GtkFrame
+ frame2
+
+ 0
+ GTK_SHADOW_ETCHED_IN
+
+ 0
+ True
+ True
+
+
+
+ GtkTable
+ table1
+ 2
+ 2
+ False
+ 0
+ 0
- Placeholder
+ GtkLabel
+ label13
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label14
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkOptionMenu
+ papersize
+ True
+
+ 0
+
+ 1
+ 2
+ 0
+ 1
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkOptionMenu
+ orientation
+ True
+
+ 0
+
+ 1
+ 2
+ 1
+ 2
+ 5
+ 5
+ False
+ False
+ False
+ False
+ True
+ False
+
diff --git a/gramps/src/plugins/familygroup.glade b/gramps/src/plugins/familygroup.glade
index c8a061d74..657985d7f 100644
--- a/gramps/src/plugins/familygroup.glade
+++ b/gramps/src/plugins/familygroup.glade
@@ -311,9 +311,124 @@
+
+
+
+
+ GtkFrame
+ frame2
+
+ 0
+ GTK_SHADOW_ETCHED_IN
+
+ 0
+ True
+ True
+
+
+
+ GtkTable
+ table1
+ 2
+ 2
+ False
+ 0
+ 0
- Placeholder
+ GtkLabel
+ label14
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label13
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkOptionMenu
+ orientation
+ True
+
+ 0
+
+ 1
+ 2
+ 1
+ 2
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkOptionMenu
+ papersize
+ True
+
+ 0
+
+ 1
+ 2
+ 0
+ 1
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
diff --git a/gramps/src/plugins/indsum.glade b/gramps/src/plugins/indsum.glade
index 0f3578f70..dc7fa9a2e 100644
--- a/gramps/src/plugins/indsum.glade
+++ b/gramps/src/plugins/indsum.glade
@@ -288,9 +288,126 @@
+
+
+
+
+ GtkFrame
+ frame2
+
+ 0
+ GTK_SHADOW_ETCHED_IN
+
+ 0
+ True
+ True
+
+
+
+ GtkTable
+ table1
+ 2
+ 2
+ False
+ 0
+ 0
- Placeholder
+ GtkLabel
+ label13
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label14
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 0
+ 1
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkOptionMenu
+ orientation
+ True
+
+
+ 0
+
+ 1
+ 2
+ 1
+ 2
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkOptionMenu
+ papersize
+ True
+
+
+ 0
+
+ 1
+ 2
+ 0
+ 1
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+