Adapted the filters for internationalization, fixed minor bugs in report generators

svn: r44
This commit is contained in:
Don Allingham
2001-05-21 02:06:08 +00:00
parent 02a8bd3c3d
commit 175f7224a8
33 changed files with 362 additions and 116 deletions

View File

@ -32,11 +32,12 @@ class AbiWordDoc(TextDoc):
TextDoc.__init__(self,type,orientation) TextDoc.__init__(self,type,orientation)
self.f = None self.f = None
self.level = 0 self.level = 0
self.new_page = 0
def open(self,filename): def open(self,filename):
if filename[-4:] != ".abw": if filename[-4:] != ".abw":
self.filename = filename + ".abw" self.filename = "%s.abw" % filename
else: else:
self.filename = filename self.filename = filename
@ -104,6 +105,7 @@ class AbiWordDoc(TextDoc):
def start_paragraph(self,style_name): def start_paragraph(self,style_name):
style = self.style_list[style_name] style = self.style_list[style_name]
self.current_style = style
self.f.write('<p props="') self.f.write('<p props="')
if style.get_alignment() == PARA_ALIGN_RIGHT: if style.get_alignment() == PARA_ALIGN_RIGHT:
self.f.write('text-align:right;') self.f.write('text-align:right;')
@ -118,6 +120,7 @@ class AbiWordDoc(TextDoc):
indent = float(style.get_first_indent())/2.54 indent = float(style.get_first_indent())/2.54
self.f.write(' margin-right:%.4fin;' % rmargin) self.f.write(' margin-right:%.4fin;' % rmargin)
self.f.write(' margin-left:%.4fin;' % lmargin) self.f.write(' margin-left:%.4fin;' % lmargin)
self.f.write(' tabstops:%.4fin/L;' % lmargin)
self.f.write(' text-indent:%.4fin' % indent) self.f.write(' text-indent:%.4fin' % indent)
self.f.write('">') self.f.write('">')
font = style.get_font() font = style.get_font()
@ -126,7 +129,7 @@ class AbiWordDoc(TextDoc):
self.f.write('Arial;') self.f.write('Arial;')
else: else:
self.f.write('Times New Roman;') self.f.write('Times New Roman;')
self.f.write('font-size:' + str(font.get_size()) + 'pt') self.f.write('font-size:%dpt' % font.get_size())
if font.get_bold(): if font.get_bold():
self.f.write('; font-weight:bold') self.f.write('; font-weight:bold')
if font.get_italic(): if font.get_italic():
@ -135,15 +138,58 @@ class AbiWordDoc(TextDoc):
if color != (0,0,0): if color != (0,0,0):
self.f.write('; color:%2x%2x%2x' % color) self.f.write('; color:%2x%2x%2x' % color)
if font.get_underline(): if font.get_underline():
self.f.write('; text-decoration:underline' % color) self.f.write('; text-decoration:underline')
self.f.write('">') self.f.write('">')
if self.new_page == 1:
self.new_page = 0
self.f.write('<pbr/>')
def page_break(self,orientation=None):
self.new_page = 1
def end_paragraph(self): def end_paragraph(self):
self.f.write('</c></p>\n') self.f.write('</c></p>\n')
def write_text(self,text): def write_text(self,text):
self.f.write(text) self.f.write(text)
def start_bold(self):
font = self.current_style.get_font()
self.f.write('</c><c props="font-family:')
if font.get_type_face() == FONT_SANS_SERIF:
self.f.write('Arial;')
else:
self.f.write('Times New Roman;')
self.f.write('font-size:%dpt' % font.get_size())
self.f.write('; font-weight:bold')
if font.get_italic():
self.f.write('; font-style:italic')
color = font.get_color()
if color != (0,0,0):
self.f.write('; color:%2x%2x%2x' % color)
if font.get_underline():
self.f.write('; text-decoration:underline')
self.f.write('">')
def end_bold(self):
font = self.current_style.get_font()
self.f.write('</c><c props="font-family:')
if font.get_type_face() == FONT_SANS_SERIF:
self.f.write('Arial;')
else:
self.f.write('Times New Roman;')
self.f.write('font-size:%dpt' % font.get_size())
if font.get_bold():
self.f.write('; font-weight:bold')
if font.get_italic():
self.f.write('; font-style:italic')
color = font.get_color()
if color != (0,0,0):
self.f.write('; color:%2x%2x%2x' % color)
if font.get_underline():
self.f.write('; text-decoration:underline')
self.f.write('">')
if __name__ == "__main__": if __name__ == "__main__":
paper = PaperStyle("Letter",27.94,21.59) paper = PaperStyle("Letter",27.94,21.59)

View File

@ -1023,7 +1023,7 @@ def on_apply_person_clicked(obj):
if error == 1: if error == 1:
msg = _("Changing the gender caused problems with marriage information.") msg = _("Changing the gender caused problems with marriage information.")
msg2 = _("Please check the person's marriage relationships") msg2 = _("Please check the person's marriage relationships.")
GnomeErrorDialog(msg + msg2) GnomeErrorDialog(msg + msg2)
text = edit_person_obj.notes_field.get_chars(0,-1) text = edit_person_obj.notes_field.get_chars(0,-1)

View File

@ -18,13 +18,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
#-------------------------------------------------------------------------
#
# Documentation String - used to describe the filter
#
#-------------------------------------------------------------------------
"All people"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Standard python modules # Standard python modules
@ -33,6 +26,9 @@
import re import re
import os import os
import sys import sys
import intl
_ = intl.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -40,7 +36,6 @@ import sys
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Filter: class Filter:
"All people"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -106,9 +101,9 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 0 return 0
filterList = [ "All people" ] filterList = [ _("All people") ]
filterMap = { "All people" : create } filterMap = { _("All people") : create }
filterEnb = { "All people" : need_qualifier } filterEnb = { _("All people") : need_qualifier }
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -135,9 +130,16 @@ def load_filters(dir):
plugin = __import__(groups[0]) plugin = __import__(groups[0])
except: except:
continue continue
if "get_name" in plugin.__dict__.keys():
name = plugin.get_name()
else:
name = plugin.__doc__
for task in plugin.__dict__.keys(): for task in plugin.__dict__.keys():
if task == "create": if task == "create":
filterMap[plugin.__doc__] = plugin.__dict__[task] filterMap[name] = plugin.__dict__[task]
filterList.append(plugin.__doc__) filterList.append(plugin.__doc__)
if task == "need_qualifier" : if task == "need_qualifier" :
filterEnb[plugin.__doc__] = plugin.__dict__[task] filterEnb[name] = plugin.__dict__[task]

View File

@ -785,7 +785,6 @@ class GrampsParser(handler.ContentHandler):
f(self,attrs) f(self,attrs)
except: except:
GrampsParser.func_map[tag] = (None,None) GrampsParser.func_map[tag] = (None,None)
print tag
self.func = None self.func = None
#--------------------------------------------------------------------- #---------------------------------------------------------------------

View File

@ -40,6 +40,7 @@ class OpenOfficeDoc(TextDoc):
self.filename = None self.filename = None
self.level = 0 self.level = 0
self.time = "0000-00-00T00:00:00" self.time = "0000-00-00T00:00:00"
self.new_page = 0
def open(self,filename): def open(self,filename):
import time import time
@ -91,6 +92,15 @@ class OpenOfficeDoc(TextDoc):
self.f.write('style:font-pitch="variable"/>\n') self.f.write('style:font-pitch="variable"/>\n')
self.f.write('</office:font-decls>\n') self.f.write('</office:font-decls>\n')
self.f.write('<office:automatic-styles>\n') self.f.write('<office:automatic-styles>\n')
for style_name in self.style_list.keys():
style = self.style_list[style_name]
self.f.write('<style:style style:name="NL')
self.f.write(style_name)
self.f.write('" style:family="paragraph" ')
self.f.write('style:parent-style-name="')
self.f.write(style_name)
self.f.write('">\n<style:properties fo:break-before="page"/>\n')
self.f.write('</style:style>\n')
for style_name in self.table_styles.keys(): for style_name in self.table_styles.keys():
style = self.table_styles[style_name] style = self.table_styles[style_name]
self.f.write('<style:style style:name="' + style_name + '" ') self.f.write('<style:style style:name="' + style_name + '" ')
@ -132,7 +142,7 @@ class OpenOfficeDoc(TextDoc):
self.f.write('/>\n') self.f.write('/>\n')
self.f.write('</style:style>\n') self.f.write('</style:style>\n')
self.f.write('<style:style style:name="T1" style:family="text">\n') self.f.write('<style:style style:name="Tbold" style:family="text">\n')
self.f.write('<style:properties fo:font-weight="bold"/>\n') self.f.write('<style:properties fo:font-weight="bold"/>\n')
self.f.write('</style:style>\n') self.f.write('</style:style>\n')
self.f.write('</office:automatic-styles>\n') self.f.write('</office:automatic-styles>\n')
@ -206,6 +216,12 @@ class OpenOfficeDoc(TextDoc):
for col in range(1,self.span): for col in range(1,self.span):
self.f.write('<table:covered-table-cell/>\n') self.f.write('<table:covered-table-cell/>\n')
def start_bold(self):
self.f.write('<text:span text:style-name="Tbold">')
def end_bold(self):
self.f.write('</text:span>')
def _write_zip(self): def _write_zip(self):
if os.path.isfile(self.filename): if os.path.isfile(self.filename):
@ -364,14 +380,23 @@ class OpenOfficeDoc(TextDoc):
self.f.write('</office:master-styles>\n') self.f.write('</office:master-styles>\n')
self.f.write('</office:document-styles>\n') self.f.write('</office:document-styles>\n')
self.f.close() self.f.close()
def page_break(self):
self.new_page = 1
def start_paragraph(self,style_name): def start_paragraph(self,style_name):
style = self.style_list[style_name] style = self.style_list[style_name]
self.level = style.get_header_level() self.level = style.get_header_level()
if self.new_page == 1:
self.new_page = 0
name = "NL%s" % style_name
else:
name = style_name
if self.level == 0: if self.level == 0:
self.f.write('<text:p text:style-name="' + style_name + '">') self.f.write('<text:p text:style-name="%s">' % name)
else: else:
self.f.write('<text:h text:style-name="' + style_name) self.f.write('<text:h text:style-name="')
self.f.write(name)
self.f.write('" text:level="' + str(self.level) + '">') self.f.write('" text:level="' + str(self.level) + '">')
def end_paragraph(self): def end_paragraph(self):

View File

@ -377,10 +377,13 @@ class TextDoc:
def close(self): def close(self):
pass pass
def start_page(self,orientation=None): def page_break(self):
pass pass
def end_page(self): def start_bold(self):
pass
def end_bold(self):
pass pass
def start_paragraph(self,style_name): def start_paragraph(self,style_name):

View File

@ -4,7 +4,6 @@ mv template.po template.po.bak
echo "Working on the glade files" echo "Working on the glade files"
libglade-xgettext -c -o glade.c *.glade libglade-xgettext -c -o glade.c *.glade
echo "Working on python files" echo "Working on python files"
./get_strings *.py >> glade.c ./get_strings *.py filters/*.py >> glade.c
echo "Building template.po" echo "Building template.po"
xgettext -C -s -a -o template.po glade.c xgettext -C -s -a -o template.po glade.c
#rm glade.c

View File

@ -67,7 +67,7 @@ gtkrcFile = rootDir + os.sep + "gtkrc"
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
progName = "gramps" progName = "gramps"
version = "0.1.4" version = "0.1.5pre"
copyright = "(C) 2001 Donald N. Allingham" copyright = "(C) 2001 Donald N. Allingham"
authors = ["Donald N. Allingham"] authors = ["Donald N. Allingham"]
comments = _("Gramps (Genealogical Research and Analysis Management ") +\ comments = _("Gramps (Genealogical Research and Analysis Management ") +\

View File

@ -24,6 +24,8 @@ import Filter
import string import string
import Date import Date
import RelLib import RelLib
import intl
_ = intl.gettext
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -60,6 +62,14 @@ class EventAfter(Filter.Filter):
break break
return val return val
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def get_name():
return _("People with an event after ...")
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# #

View File

@ -24,6 +24,8 @@ import Filter
import string import string
import Date import Date
import RelLib import RelLib
import intl
_ = intl.gettext
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -76,3 +78,11 @@ def create(text):
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def need_qualifier(): def need_qualifier():
return 1 return 1
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def get_name():
return _("People with an event before ...")

View File

@ -22,6 +22,8 @@
import Filter import Filter
import RelLib import RelLib
import intl
_ = intl.gettext
class Disconnected(Filter.Filter): class Disconnected(Filter.Filter):
"Disconnected individuals" "Disconnected individuals"
@ -34,3 +36,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 0 return 0
def get_name():
return _("Disconnected individuals")

View File

@ -24,6 +24,8 @@ import Filter
import string import string
import re import re
import RelLib import RelLib
import intl
_ = intl.gettext
class EventPlace(Filter.Filter): class EventPlace(Filter.Filter):
"People with an event location of ..." "People with an event location of ..."
@ -52,3 +54,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 1 return 1
def get_name():
return _("People with an event location of ...")

View File

@ -22,6 +22,8 @@
import Filter import Filter
import string import string
import intl
_ = intl.gettext
class EventType(Filter.Filter): class EventType(Filter.Filter):
"People who have photos" "People who have photos"
@ -37,3 +39,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 1 return 1
def get_name():
return _("People who have an event type of ...")

View File

@ -24,6 +24,8 @@ import Filter
import string import string
import utils import utils
from RelLib import Person from RelLib import Person
import intl
_ = intl.gettext
class Females(Filter.Filter): class Females(Filter.Filter):
"Females" "Females"
@ -37,3 +39,5 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 0 return 0
def get_name():
return _("Females")

View File

@ -23,6 +23,8 @@
import Filter import Filter
import string import string
import utils import utils
import intl
_ = intl.gettext
class HavePhotos(Filter.Filter): class HavePhotos(Filter.Filter):
"People who have photos" "People who have photos"
@ -35,3 +37,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 0 return 0
def get_name():
return _("People who have photos")

View File

@ -22,6 +22,8 @@
import Filter import Filter
from RelLib import Person from RelLib import Person
import intl
_ = intl.gettext
class IncompleteNames(Filter.Filter): class IncompleteNames(Filter.Filter):
"People with incomplete names" "People with incomplete names"
@ -36,3 +38,5 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 0 return 0
def get_name():
return _("People with incomplete names")

View File

@ -23,6 +23,8 @@
import Filter import Filter
import soundex import soundex
import RelLib import RelLib
import intl
_ = intl.gettext
class MatchSndEx(Filter.Filter): class MatchSndEx(Filter.Filter):
"Names with same SoundEx code as ..." "Names with same SoundEx code as ..."
@ -39,3 +41,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 1 return 1
def get_name():
return _("Names with same SoundEx code as ...")

View File

@ -23,6 +23,8 @@
import Filter import Filter
import soundex import soundex
import RelLib import RelLib
import intl
_ = intl.gettext
class MatchSndEx2(Filter.Filter): class MatchSndEx2(Filter.Filter):
"Names with the specified SoundEx code" "Names with the specified SoundEx code"
@ -35,3 +37,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 1 return 1
def get_name():
return _("Names with the specified SoundEx code")

View File

@ -23,6 +23,8 @@
import Filter import Filter
import string import string
import utils import utils
import intl
_ = intl.gettext
class MultipleMarriages(Filter.Filter): class MultipleMarriages(Filter.Filter):
"People with multiple marriage records" "People with multiple marriage records"
@ -35,3 +37,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 0 return 0
def get_name():
return _("People with multiple marriage records")

View File

@ -23,6 +23,8 @@
import Filter import Filter
import string import string
import utils import utils
import intl
_ = intl.gettext
class NeverMarried(Filter.Filter): class NeverMarried(Filter.Filter):
"People with no marriage records" "People with no marriage records"
@ -35,3 +37,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 0 return 0
def get_name():
return _("People with no marriage records")

View File

@ -23,6 +23,8 @@
import Filter import Filter
import string import string
import utils import utils
import intl
_ = intl.gettext
class NoBirthdate(Filter.Filter): class NoBirthdate(Filter.Filter):
"People no listed birth date" "People no listed birth date"
@ -35,3 +37,8 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 0 return 0
def get_name():
return _("People no listed birth date")

View File

@ -23,6 +23,8 @@
import Filter import Filter
import string import string
import utils import utils
import intl
_ = intl.gettext
class HaveChildren(Filter.Filter): class HaveChildren(Filter.Filter):
"People with children" "People with children"
@ -41,3 +43,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 0 return 0
def get_name():
return _("People with children")

View File

@ -23,6 +23,8 @@
import Filter import Filter
import re import re
import utils import utils
import intl
_ = intl.gettext
class RegExMatch(Filter.Filter): class RegExMatch(Filter.Filter):
"Names that match a regular expression" "Names that match a regular expression"
@ -46,3 +48,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 1 return 1
def get_name():
return _("Names that match a regular expression")

View File

@ -23,6 +23,8 @@
import Filter import Filter
import string import string
import utils import utils
import intl
_ = intl.gettext
class SubString(Filter.Filter): class SubString(Filter.Filter):
"Names that contain a substring" "Names that contain a substring"
@ -35,3 +37,6 @@ def create(text):
def need_qualifier(): def need_qualifier():
return 1 return 1
def get_name():
return _("Names that contain a substring")

View File

@ -36,6 +36,9 @@ from gtk import *
from gnome.ui import * from gnome.ui import *
from libglade import * from libglade import *
import intl
_ = intl.gettext
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# #
@ -198,7 +201,8 @@ def report(database,person):
PaperMenu.make_paper_menu(topDialog.get_widget("papersize")) PaperMenu.make_paper_menu(topDialog.get_widget("papersize"))
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation")) PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
topDialog.get_widget("labelTitle").set_text("Ancestor chart for " + name) title = _("Ancestor chart for %s") % name
topDialog.get_widget("labelTitle").set_text(title)
topDialog.signal_autoconnect({ topDialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object, "destroy_passed_object" : utils.destroy_passed_object,
"on_save_clicked" : on_save_clicked "on_save_clicked" : on_save_clicked
@ -213,7 +217,7 @@ def on_save_clicked(obj):
global active_person global active_person
global db global db
outputName = topDialog.get_widget("filename").get_text() outputName = topDialog.get_widget("fileentry1").get_full_path(0)
if outputName == "": if outputName == "":
return return
@ -240,7 +244,16 @@ def on_save_clicked(obj):
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def get_description(): def get_description():
return "Produces a graphical ancestral tree graph" return _("Produces a graphical ancestral tree graph")
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def get_name():
return _("Generate files/Ancestor Chart")
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #

View File

@ -29,6 +29,9 @@ from gtk import *
from gnome.ui import * from gnome.ui import *
from libglade import * from libglade import *
import intl
_ = intl.gettext
col2person = {} col2person = {}
reportPerson = None reportPerson = None
zoom = 1.0 zoom = 1.0
@ -377,7 +380,10 @@ def mysort(first, second) :
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def get_description(): def get_description():
return "Produces a graphical ancestral tree graph" return _("Produces a graphical ancestral tree graph")
def get_name():
return _("View/View an ancestor graph")
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #

View File

@ -27,6 +27,9 @@ import re
import sort import sort
import string import string
import utils import utils
import intl
_ = intl.gettext
from TextDoc import * from TextDoc import *
from OpenOfficeDoc import * from OpenOfficeDoc import *
@ -53,35 +56,35 @@ db = None
class AncestorReport: class AncestorReport:
gen = { gen = {
1 : "First", 1 : _("First"),
2 : "Second", 2 : _("Second"),
3 : "Third", 3 : _("Third"),
4 : "Fourth", 4 : _("Fourth"),
5 : "Fifth", 5 : _("Fifth"),
6 : "Sixth", 6 : _("Sixth"),
7 : "Seventh", 7 : _("Seventh"),
8 : "Eighth", 8 : _("Eighth"),
9 : "Ninth", 9 : _("Ninth"),
10: "Tenth", 10: _("Tenth"),
11: "Eleventh", 11: _("Eleventh"),
12: "Twelfth", 12: _("Twelfth"),
13: "Thirteenth", 13: _("Thirteenth"),
14: "Fourteenth", 14: _("Fourteenth"),
15: "Fifteenth", 15: _("Fifteenth"),
16: "Sixteenth", 16: _("Sixteenth"),
17: "Seventeenth", 17: _("Seventeenth"),
18: "Eigthteenth", 18: _("Eigthteenth"),
19: "Nineteenth", 19: _("Nineteenth"),
20: "Twentieth", 20: _("Twentieth"),
21: "Twenty-first", 21: _("Twenty-first"),
22: "Twenty-second", 22: _("Twenty-second"),
23: "Twenty-third", 23: _("Twenty-third"),
24: "Twenty-fourth", 24: _("Twenty-fourth"),
25: "Twenty-fifth", 25: _("Twenty-fifth"),
26: "Twenty-sixth", 26: _("Twenty-sixth"),
27: "Twenty-seventh", 27: _("Twenty-seventh"),
28: "Twenty-eighth", 28: _("Twenty-eighth"),
29: "Twenty-ninth" 29: _("Twenty-ninth")
} }
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -103,6 +106,8 @@ class AncestorReport:
para = ParagraphStyle() para = ParagraphStyle()
para.set_font(font) para.set_font(font)
para.set_header_level(1) para.set_header_level(1)
para.set_top_border(0.2)
para.set_bottom_border(0.2)
self.doc.add_style("Title",para) self.doc.add_style("Title",para)
font = FontStyle() font = FontStyle()
@ -113,6 +118,8 @@ class AncestorReport:
para = ParagraphStyle() para = ParagraphStyle()
para.set_font(font) para.set_font(font)
para.set_header_level(2) para.set_header_level(2)
para.set_top_border(0.15)
para.set_bottom_border(0.15)
self.doc.add_style("Header",para) self.doc.add_style("Header",para)
para = ParagraphStyle() para = ParagraphStyle()
@ -122,7 +129,7 @@ class AncestorReport:
try: try:
self.doc.open(output) self.doc.open(output)
except IOError,msg: except IOError,msg:
GnomeErrorDialog("Could not open %s\n%s",msg) GnomeErrorDialog(_("Could not open %s\n%s"),msg)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
@ -150,7 +157,8 @@ class AncestorReport:
name = self.start.getPrimaryName().getRegularName() name = self.start.getPrimaryName().getRegularName()
self.doc.start_paragraph("Title") self.doc.start_paragraph("Title")
self.doc.write_text("Ahnentafel Chart for " + name) title = _("Ahnentafel Chart for %s") % name
self.doc.write_text(title)
self.doc.end_paragraph() self.doc.end_paragraph()
keys = self.map.keys() keys = self.map.keys()
@ -160,8 +168,11 @@ class AncestorReport:
for key in keys : for key in keys :
if generation == 0 or key >= 2**generation: if generation == 0 or key >= 2**generation:
if self.pgbrk and generation > 0:
self.doc.page_break()
self.doc.start_paragraph("Header") self.doc.start_paragraph("Header")
self.doc.write_text(AncestorReport.gen[generation+1 ]+ " Generation") t = _("%s Generation") % AncestorReport.gen[generation+1]
self.doc.write_text(t)
self.doc.end_paragraph() self.doc.end_paragraph()
generation = generation + 1 generation = generation + 1
@ -169,7 +180,14 @@ class AncestorReport:
person = self.map[key] person = self.map[key]
name = person.getPrimaryName().getRegularName() name = person.getPrimaryName().getRegularName()
self.doc.write_text(str(key) + ".\t" + name ) self.doc.write_text(str(key) + ".\t")
self.doc.start_bold()
self.doc.write_text(name)
self.doc.end_bold()
if name[-1:] == '.':
self.doc.write_text(" ")
else:
self.doc.write_text(". ")
# Check birth record # Check birth record
@ -177,21 +195,25 @@ class AncestorReport:
if birth: if birth:
date = birth.getDateObj().get_start_date() date = birth.getDateObj().get_start_date()
place = birth.getPlace() place = birth.getPlace()
if place[-1:] == '.':
place = place[:-1]
if date.getDate() != "" or place != "": if date.getDate() != "" or place != "":
self.doc.write_text(" was born")
if date.getDate() != "": if date.getDate() != "":
if date.getDay() != -1 and date.getMonth() != -1: if date.getDay() != -1 and date.getMonth() != -1:
self.doc.write_text(" on ") if place != "":
t = _("%s was born on %s in %s. ") % \
(name,date.getDate(),place)
else:
t = _("%s was born on %s. ") % \
(name,date.getDate())
else: else:
self.doc.write_text(" in ") if place != "":
self.doc.write_text(date.getDate()) t = _("%s was born in %s in %s. ") % \
if place != "": (name,date.getDate(),place)
self.doc.write_text(" in " + place) else:
if place == "" or place[-1] != '.': t = _("%s was born in %s. ") % \
self.doc.write_text(".") (name,date.getDate())
self.doc.write_text("\n") self.doc.write_text(t)
else:
self.doc.write_text(".\n")
death = person.getDeath() death = person.getDeath()
buried = None buried = None
@ -202,42 +224,71 @@ class AncestorReport:
if death: if death:
date = death.getDateObj().get_start_date() date = death.getDateObj().get_start_date()
place = death.getPlace() place = death.getPlace()
if place[-1:] == '.':
place = place[:-1]
if date.getDate() != "" or place != "": if date.getDate() != "" or place != "":
if person.getGender() == RelLib.Person.male: if person.getGender() == RelLib.Person.male:
self.doc.write_text("He") male = 1
else: else:
self.doc.write_text("She") male = 0
self.doc.write_text(" died")
if date.getDate() != "": if date.getDate() != "":
if date.getDay() != -1 and date.getMonth() != -1: if date.getDay() != -1 and date.getMonth() != -1:
self.doc.write_text(" on ") if male:
if place != "":
t = _("He died on %s in %s") % \
(date.getDate(),place)
else:
t = _("He died on %s") % date.getDate()
else:
if place != "":
t = _("She died on %s in %s") % \
(date.getDate(),place)
else:
t = _("She died on %s") % date.getDate()
else: else:
self.doc.write_text(" in ") if male:
self.doc.write_text(date.getDate()) if place != "":
if place != "": t = _("He died in %s in %s") % \
self.doc.write_text(" in " + place) (date.getDate(),place)
else:
t = _("He died in %s") % date.getDate()
else:
if place != "":
t = _("She died in %s in %s") % \
(date.getDate(),place)
else:
t = _("She died in %s") % date.getDate()
self.doc.write_text(t)
if buried: if buried:
date = buried.getDateObj().get_start_date() date = buried.getDateObj().get_start_date()
place = buried.getPlace() place = buried.getPlace()
if place[-1:] == '.':
place = place[:-1]
if date.getDate() != "" or place != "": if date.getDate() != "" or place != "":
self.doc.write_text(", and was buried")
if date.getDate() != "": if date.getDate() != "":
if date.getDay() != -1 and date.getMonth() != -1: if date.getDay() != -1 and date.getMonth() != -1:
self.doc.write_text(" on ") if place != "":
t = _(", and was buried on %s in %s.") % \
(date.getDate(),place)
else:
t = _(", and was buried on %s.") % \
date.getDate()
else: else:
self.doc.write_text(" in ") if place != "":
self.doc.write_text(date.getDate()) t = _(", and was buried in %s in %s.") % \
if place != "": (date.getDate(),place)
self.doc.write_text(" in " + place) else:
t = _(", and was buried in %s.") % \
if place == "" or place[-1] != '.': date.getDate()
else:
t = _(" and was buried in %s." % place)
self.doc.write_text(t)
else:
self.doc.write_text(".") self.doc.write_text(".")
self.doc.write_text("\n")
else:
self.doc.write_text(".\n")
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.close() self.doc.close()
@ -301,7 +352,10 @@ def on_save_clicked(obj):
global active_person global active_person
global db global db
outputName = topDialog.get_widget("filename").get_text() outputName = topDialog.get_widget("fileentry1").get_full_path(0)
if outputName == "":
return
max_gen = topDialog.get_widget("generations").get_value_as_int() max_gen = topDialog.get_widget("generations").get_value_as_int()
pgbrk = topDialog.get_widget("pagebreak").get_active() pgbrk = topDialog.get_widget("pagebreak").get_active()
template = topDialog.get_widget("htmltemplate").get_full_path(0) template = topDialog.get_widget("htmltemplate").get_full_path(0)
@ -310,9 +364,6 @@ def on_save_clicked(obj):
orien_obj = topDialog.get_widget("orientation").get_menu().get_active() orien_obj = topDialog.get_widget("orientation").get_menu().get_active()
orien = orien_obj.get_data("i") orien = orien_obj.get_data("i")
if outputName == "":
return
if topDialog.get_widget("openoffice").get_active(): if topDialog.get_widget("openoffice").get_active():
document = OpenOfficeDoc(paper,orien) document = OpenOfficeDoc(paper,orien)
elif topDialog.get_widget("abiword").get_active(): elif topDialog.get_widget("abiword").get_active():
@ -332,7 +383,10 @@ def on_save_clicked(obj):
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def get_description(): def get_description():
return "Produces a textual ancestral report" return _("Produces a textual ancestral report")
def get_name():
return _("Generate files/Ahnentafel Chart")
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #

View File

@ -29,6 +29,9 @@ from libglade import *
import RelLib import RelLib
import const import const
import utils import utils
import intl
_ = intl.gettext
topDialog = None topDialog = None
@ -90,5 +93,7 @@ def runTool(database,person,callback):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def get_description(): def get_description():
return "Allows all the events of a certain name to be renamed to a new name" return _("Allows all the events of a certain name to be renamed to a new name")
def get_name():
return _("Database Processing/Rename personal event types")

View File

@ -24,6 +24,8 @@ import RelLib
import utils import utils
import soundex import soundex
import Config import Config
import intl
_ = intl.gettext
import string import string
import os import os
@ -136,26 +138,26 @@ class CheckIntegrity:
errors = blink + efam + pphotos + fphotos errors = blink + efam + pphotos + fphotos
if errors == 0: if errors == 0:
GnomeOkDialog("No errors were found") GnomeOkDialog(_("No errors were found"))
return return
text = "" text = ""
if blink == 1: if blink == 1:
text = text + "1 broken family link was found\n" text = text + _("1 broken family link was found\n")
elif blink > 1: elif blink > 1:
text = text + "%d broken family links were found\n" % blink text = text + _("%d broken family links were found\n") % blink
if efam == 1: if efam == 1:
text = text + "1 empty family was found\n" text = text + _("1 empty family was found\n")
elif efam > 1: elif efam > 1:
text = text + "%d empty families were found\n" % efam text = text + _("%d empty families were found\n") % efam
if fphotos == 1: if fphotos == 1:
text = text + "1 broken family photo was found\n" text = text + _("1 broken family photo was found\n")
elif fphotos > 1: elif fphotos > 1:
text = text + "%d broken family photos were found\n" % fphotos text = text + _("%d broken family photos were found\n") % fphotos
if pphotos == 1: if pphotos == 1:
text = text + "1 broken personal photo was found\n" text = text + _("1 broken personal photo was found\n")
elif pphotos > 1: elif pphotos > 1:
text = text + "%d broken personal photos were found\n" % pphotos text = text + _("%d broken personal photos were found\n") % pphotos
GnomeWarningDialog(string.strip(text)) GnomeWarningDialog(string.strip(text))
@ -165,5 +167,7 @@ class CheckIntegrity:
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def get_description(): def get_description():
return "Checks the database for any relationship errors" return _("Checks the database for any relationship errors")
def get_name():
return _("Database Processing/Check database integrity")

View File

@ -172,7 +172,7 @@ def on_save_clicked(obj):
myobj = obj.get_data("o") myobj = obj.get_data("o")
db = obj.get_data("d") db = obj.get_data("d")
file = myobj.top.get_widget("filename").get_text() file = myobj.top.get_widget("fileentry1").get_full_path(0)
if file == "": if file == "":
return return

View File

@ -435,7 +435,7 @@ def on_save_clicked(obj):
global active_person global active_person
global db global db
outputName = topDialog.get_widget("filename").get_text() outputName = topDialog.get_widget("fileentry1").get_full_path(0)
if outputName == "": if outputName == "":
return return

View File

@ -242,8 +242,8 @@ def on_ok_clicked(obj):
global restrict global restrict
global no_photos global no_photos
start = re.compile(r"<!-- START -->") start = re.compile(r"<!--\s*START\s*-->")
stop = re.compile(r"<!-- STOP -->") stop = re.compile(r"<!--\s*STOP\s*-->")
top = [] top = []
bottom = [] bottom = []

View File

@ -394,7 +394,7 @@ def on_save_clicked(obj):
global active_person global active_person
global db global db
outputName = topDialog.get_widget("filename").get_text() outputName = topDialog.get_widget("fileentry1").get_full_path(0)
if outputName == "": if outputName == "":
return return