Plugin clean up

svn: r1310
This commit is contained in:
Don Allingham 2003-02-15 23:03:48 +00:00
parent 15ffffef7f
commit 9734f8091c
12 changed files with 1256 additions and 1034 deletions

View File

@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
dnl May need to run automake && aclocal first dnl May need to run automake && aclocal first
AC_INIT(src/gramps.py) AC_INIT(src/gramps.py)
AM_INIT_AUTOMAKE(gramps, 0.9.0) AM_INIT_AUTOMAKE(gramps, 0.9.0)
RELEASE=rc5 RELEASE=1
VERSIONSTRING=$VERSION VERSIONSTRING=$VERSION
if test x"$RELEASE" != "x" if test x"$RELEASE" != "x"

View File

@ -116,15 +116,17 @@ documenters = [
'Lawrence Allingham' 'Lawrence Allingham'
] ]
translators = u'Radek Malcic <malcic@atlas.cz>\n' \ translators = u'Radek Malcic <malcic@atlas.cz> - Czech\n' \
u'Lars Kristian Lundin <gramps@lklundin.dk>\n' \ u'Lars Kristian Lundin <gramps@lklundin.dk> - Danish (Dansk)\n' \
u'Bernd Schandl <schandl@gmx.net>\n' \ u'Bernd Schandl <schandl@gmx.net> - German (Deutsch)\n' \
u'Andr\xe9s Sep\xfalveda <andres@ccpo.odu.edu>\n' \ u'Andr\xe9s Sep\xfalveda <andres@ccpo.odu.edu> - Spanish (Espa\xf1ol)\n' \
u'Laurent Protois <laurent.protois@free.fr>\n' \ u'Laurent Protois <laurent.protois@free.fr> - French (Fran\xe7ais)\n' \
u'Marco Molteni <molter@gufi.org>\n' \ u'Marco Molteni <molter@gufi.org> - Italian (Italiano)\n' \
u'Marcos Bedinelli\n' \ u'Marcos Bedinelli - Brazilian-Portuguese (Portugu\xeas do Brasil)\n' \
u'Alexander Roitman <shura@alex.neuro.umn.edu>\n' \ u'Alex Roitman <shura@alex.neuro.umn.edu> - Russian\n' \
u'Jens Arvidsson <arvid-jens@algonet.se>' \ u'Jens Arvidsson <arvid-jens@algonet.se> - Swedish (Svenska)' \
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -116,15 +116,17 @@ documenters = [
'Lawrence Allingham' 'Lawrence Allingham'
] ]
translators = u'Radek Malcic <malcic@atlas.cz>\n' \ translators = u'Radek Malcic <malcic@atlas.cz> - Czech\n' \
u'Lars Kristian Lundin <gramps@lklundin.dk>\n' \ u'Lars Kristian Lundin <gramps@lklundin.dk> - Danish (Dansk)\n' \
u'Bernd Schandl <schandl@gmx.net>\n' \ u'Bernd Schandl <schandl@gmx.net> - German (Deutsch)\n' \
u'Andr\xe9s Sep\xfalveda <andres@ccpo.odu.edu>\n' \ u'Andr\xe9s Sep\xfalveda <andres@ccpo.odu.edu> - Spanish (Espa\xf1ol)\n' \
u'Laurent Protois <laurent.protois@free.fr>\n' \ u'Laurent Protois <laurent.protois@free.fr> - French (Fran\xe7ais)\n' \
u'Marco Molteni <molter@gufi.org>\n' \ u'Marco Molteni <molter@gufi.org> - Italian (Italiano)\n' \
u'Marcos Bedinelli\n' \ u'Marcos Bedinelli - Brazilian-Portuguese (Portugu\xeas do Brasil)\n' \
u'Alexander Roitman <shura@alex.neuro.umn.edu>\n' \ u'Alex Roitman <shura@alex.neuro.umn.edu> - Russian\n' \
u'Jens Arvidsson <arvid-jens@algonet.se>' \ u'Jens Arvidsson <arvid-jens@algonet.se> - Swedish (Svenska)' \
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -56,7 +56,6 @@ class ChangeTypes:
self.glade.signal_autoconnect({ self.glade.signal_autoconnect({
"on_close_clicked" : Utils.destroy_passed_object, "on_close_clicked" : Utils.destroy_passed_object,
"on_combo_insert_text" : Utils.combo_insert_text,
"on_apply_clicked" : self.on_apply_clicked "on_apply_clicked" : self.on_apply_clicked
}) })

View File

@ -40,7 +40,7 @@ import gnome.ui
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
class DetAncestorReport(Report): class DetAncestorReport(Report):
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
# #
@ -59,7 +59,7 @@ class DetAncestorReport(Report):
try: try:
self.doc.open(output) self.doc.open(output)
except IOError,msg: except IOError,msg:
gnome.ui.GnomeErrorDialog(_("Could not open %s") % output + "\n" + msg) ErrorDialog(_("Could not open %s") % output + "\n" + msg)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
@ -87,6 +87,9 @@ class DetAncestorReport(Report):
NAME Born: DATE PLACE Died: DATE e NAME Born: DATE PLACE Died: DATE e
NAME Born: DATE PLACE Died: PLACE d NAME Born: DATE PLACE Died: PLACE d
NAME Born: DATE PLACE c NAME Born: DATE PLACE c
NAME Born: DATE Died: DATE PLACE b
NAME Born: DATE Died: DATE a
NAME Born: DATE Died: PLACE 9
NAME Born: DATE 8 NAME Born: DATE 8
NAME Born: PLACE Died: DATE PLACE 7 NAME Born: PLACE Died: DATE PLACE 7
NAME Born: PLACE Died: DATE 6 NAME Born: PLACE Died: DATE 6
@ -123,10 +126,8 @@ class DetAncestorReport(Report):
childID= child.getId() childID= child.getId()
if self.prevGenIDs.get(childID) != None: if self.prevGenIDs.get(childID) != None:
name= "[" + str(self.prevGenIDs.get(childID)) + "] "+ name name= "[" + str(self.prevGenIDs.get(childID)) + "] "+ name
#print "Child List: <", birth.getDate(), ">", birth.getPlaceName()
if birth.getDate() != "": if birth.getDate() != "":
#print birth.getPlaceName() if birth.getPlaceName() != "":
if birth.getPlaceName() != None:
if death.getDate() != "": if death.getDate() != "":
if death.getPlaceName() != "": if death.getPlaceName() != "":
self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \ self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \
@ -151,13 +152,13 @@ class DetAncestorReport(Report):
else: else:
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.getDate(), death.getDate())) # a (name, birth.getDate(), death.getDate())) # a
elif death.PlaceName() != "": elif death.getPlaceName() != "":
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.getDate(), birth.getPlaceName())) # 9 (name, birth.getDate(), death.getPlaceName())) # 9
else: self.doc.write_text(_("- %s Born: %s") % \ else: self.doc.write_text(_("- %s Born: %s") % \
(name, birth.getDate())) # 8 (name, birth.getDate())) # 8
else: else:
if birth.getPlaceName() != None: if birth.getPlaceName() != "":
if death.getDate() != "": if death.getDate() != "":
if death.getPlaceName() != "": if death.getPlaceName() != "":
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
@ -167,7 +168,7 @@ class DetAncestorReport(Report):
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.getPlaceName(), death.getDate())) # 6 (name, birth.getPlaceName(), death.getDate())) # 6
elif death.getPlaceName() != "": elif death.getPlaceName() != "":
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
(name, birth.getPlaceName(), death.getPlaceName())) # 5 (name, birth.getPlaceName(), death.getPlaceName())) # 5
else: self.doc.write_text(_("- %s Born: %s") % \ else: self.doc.write_text(_("- %s Born: %s") % \
(name, birth.getPlaceName())) # 4 (name, birth.getPlaceName())) # 4
@ -279,7 +280,7 @@ class DetAncestorReport(Report):
else: else:
self.doc.write_text(_(" was born in the year %s.") % date.getYear()) self.doc.write_text(_(" was born in the year %s.") % date.getYear())
elif place != "": elif place != "":
self.doc.write_text(_(" in %s.") % place) self.doc.write_text(_(" was born in %s.") % place)
else: else:
self.doc.write_text(_(".")) self.doc.write_text(_("."))
@ -404,25 +405,25 @@ class DetAncestorReport(Report):
if person.getGender() == RelLib.Person.male: if person.getGender() == RelLib.Person.male:
if father != "": if father != "":
if mother != "": if mother != "":
self.doc.write_text(_(" %s was the son of %s and %s." % \ self.doc.write_text(_(" %s was the son of %s and %s.") % \
(firstName, father, mother))) (firstName, father, mother))
else: else:
self.doc.write_text(_(" %s was the son of %s." % \ self.doc.write_text(_(" %s was the son of %s.") % \
(firstName, father))) (firstName, father))
else: else:
self.doc.write_text(_(" %s was the son of %s." % \ self.doc.write_text(_(" %s was the son of %s.") % \
(firstName, mother))) (firstName, mother))
else: else:
if father != "": if father != "":
if mother != "": if mother != "":
self.doc.write_text(_(" %s was the daughter of %s and %s." % \ self.doc.write_text(_(" %s was the daughter of %s and %s.") % \
(firstName, father, mother))) (firstName, father, mother))
else: else:
self.doc.write_text(_(" %s was the daughter of %s." % \ self.doc.write_text(_(" %s was the daughter of %s.") % \
(firstName, father))) (firstName, father))
else: else:
self.doc.write_text(_(" %s was the daughter of %s." % \ self.doc.write_text(_(" %s was the daughter of %s.") % \
(firstName, mother))) (firstName, mother))
def write_marriage(self, person, rptOptions): def write_marriage(self, person, rptOptions):
@ -430,22 +431,27 @@ class DetAncestorReport(Report):
HE/SHE married SPOUSE on FULLDATE in PLACE. HE/SHE married SPOUSE on FULLDATE in PLACE.
HE/SHE married SPOUSE on FULLDATE. HE/SHE married SPOUSE on FULLDATE.
HE/SHE married SPOUSE in PLACE. HE/SHE married SPOUSE in PLACE.
He/SHE married SPOUSE HE/SHE married SPOUSE
HE/SHE married on FULLDATE in PLACE.
HE/SHE married on FULLDATE.
HE/SHE married in PLACE.
""" """
famList= person.getFamilyList() famList= person.getFamilyList()
if len(famList) > 0: if len(famList) > 0:
fam_num= 0 fam_num= 0
endOfSent= ""
for fam in famList: for fam in famList:
fam_num= fam_num + 1 fam_num= fam_num + 1
spouse= "" spouse= ""
t= ""
if person.getGender() == RelLib.Person.male: if person.getGender() == RelLib.Person.male:
if fam.getMother() != None: if fam.getMother() != None:
spouse= fam.getMother().getPrimaryName().getRegularName() spouse= fam.getMother().getPrimaryName().getRegularName()
if fam_num == 1: if fam_num == 1:
heshe= _("He") heshe= _("He")
elif fam_num < len(famList): elif fam_num < len(famList):
heshe= _(",") heshe= _(",")
else: heshe= _("and he") else: heshe= _("and he")
else: else:
if fam_num == 1: if fam_num == 1:
heshe= _("She") heshe= _("She")
@ -477,25 +483,26 @@ class DetAncestorReport(Report):
if spouse != "": if spouse != "":
if fulldate == "" and place == "": if fulldate == "" and place == "":
t= _(" %s married %s" % (heshe, spouse)) t= _(" %s married %s") % (heshe, spouse)
elif fulldate == "" and place != "": elif fulldate == "" and place != "":
t= _(" %s married %s in %s" % (heshe, spouse, place)) t= _(" %s married %s in %s") % (heshe, spouse, place)
elif fulldate != "" and place == "": elif fulldate != "" and place == "":
t= _(" %s married %s on %s" % (heshe, spouse, fulldate)) t= _(" %s married %s on %s") % (heshe, spouse, fulldate)
else: t= _(" %s married %s on %s in %s" % \ else: t= _(" %s married %s on %s in %s") % \
(heshe, spouse, fulldate, place)) (heshe, spouse, fulldate, place)
else: else:
if fulldate == "" and place == "": if fulldate == "" and place != "":
t= _(" %s married") t= _(" %s married in %s") % (heshe, place)
elif fulldate == "" and place != "":
t= _(" %s married in %s" % (heshe, place))
elif fulldate != "" and place == "": elif fulldate != "" and place == "":
t= _(" %s married on %s" % (heshe, fulldate)) t= _(" %s married on %s") % (heshe, fulldate)
else: t= _(" %s married on %s in %s" % \ elif fulldate != "" and place != "":
(heshe, fulldate, place)) t= _(" %s married on %s in %s") % \
(heshe, fulldate, place)
if t != "": self.doc.write_text(t) if t != "":
if fam_num == len(famList): self.doc.write_text(".") self.doc.write_text(t)
endOfSent= "."
if fam_num == len(famList): self.doc.write_text(endOfSent)
def write_mate(self, mate, rptOptions): def write_mate(self, mate, rptOptions):
"""Output birth, death, parentage, marriage and notes information """ """Output birth, death, parentage, marriage and notes information """
@ -509,9 +516,9 @@ class DetAncestorReport(Report):
ind= fam.getMother() ind= fam.getMother()
person= fam.getMother().getPrimaryName().getRegularName() person= fam.getMother().getPrimaryName().getRegularName()
firstName= fam.getMother().getPrimaryName().getFirstName() firstName= fam.getMother().getPrimaryName().getFirstName()
heshe= _("He") heshe= _("She")
else: else:
heshe= _("She") heshe= _("He")
if fam.getFather() != None: if fam.getFather() != None:
ind= fam.getFather() ind= fam.getFather()
person= fam.getFather().getPrimaryName().getRegularName() person= fam.getFather().getPrimaryName().getRegularName()
@ -598,10 +605,10 @@ class DetAncestorReport(Report):
# #
# #
#-------------------------------------------------------------------- #--------------------------------------------------------------------
def write_report(self): def write_report(self, rptOpt):
self.filter(self.start,1) self.filter(self.start,1)
rptOpt= reportOptions() #rptOpt= reportOptions()
name = self.start.getPrimaryName().getRegularName() name = self.start.getPrimaryName().getRegularName()
self.doc.start_paragraph("Title") self.doc.start_paragraph("Title")
@ -738,13 +745,145 @@ class DetAncestorReportDialog(TextReportDialog):
try: try:
MyReport = DetAncestorReport(self.db, self.person, self.target_path, MyReport = DetAncestorReport(self.db, self.person, self.target_path,
self.max_gen, self.pg_brk, self.doc) self.max_gen, self.pg_brk, self.doc)
MyReport.write_report()
rptOpt= reportOptions()
rptOpt.firstName= self.firstName
rptOpt.fullDate= self.fullDate
rptOpt.listChildren= self.listChildren
rptOpt.includeNotes= self.includeNotes
rptOpt.blankPlace= self.blankPlace
rptOpt.blankDate= self.blankDate
rptOpt.calcAgeFlag= self.calcAgeFlag
rptOpt.dupPersons= self.dupPersons
rptOpt.childRef= self.childRef
rptOpt.addImages= self.addImages
MyReport.write_report(rptOpt)
except Errors.ReportError, msg: except Errors.ReportError, msg:
ErrorDialog(str(msg)) ErrorDialog(str(msg))
except: except:
import DisplayTrace import DisplayTrace
DisplayTrace.DisplayTrace() DisplayTrace.DisplayTrace()
#*** Begin change
def add_user_options(self):
# Create a GTK Checkbox widgets
# Pronoun instead of first name
self.first_name_option = gtk.CheckButton(_("Use first names instead of pronouns"))
self.first_name_option.set_active(0)
# Full date usage
self.full_date_option = gtk.CheckButton(_("Use full dates instead of only the year"))
self.full_date_option.set_active(1)
# Children List
self.list_children_option = gtk.CheckButton(_("List children"))
self.list_children_option.set_active(1)
# Print notes
self.include_notes_option = gtk.CheckButton(_("Include notes"))
self.include_notes_option.set_active(1)
# Replace missing Place with ___________
self.place_option = gtk.CheckButton(_("Replace Place with ______"))
self.place_option.set_active(0)
# Replace missing dates with __________
self.date_option = gtk.CheckButton(_("Replace Dates with ______"))
self.date_option.set_active(0)
# Add "Died at the age of NN" in text
self.age_option = gtk.CheckButton(_("Compute age"))
self.age_option.set_active(1)
# Omit duplicate persons, occurs when distant cousins marry
self.dupPersons_option = gtk.CheckButton(_("Omit duplicate ancestors"))
self.dupPersons_option.set_active(1)
#Add descendant reference in child list
self.childRef_option = gtk.CheckButton(_("Add descendant reference in child list"))
self.childRef_option.set_active(1)
#Add photo/image reference
self.image_option = gtk.CheckButton(_("Include Photo/Images from Gallery"))
self.image_option.set_active(0)
# Add new options. The first argument is the tab name for grouping options.
# if you want to put everyting in the generic "Options" category, use
# self.add_option(text,widget) instead of self.add_frame_option(category,text,widget)
self.add_frame_option('Content','',self.first_name_option)
self.add_frame_option('Content','',self.full_date_option)
self.add_frame_option('Content','',self.list_children_option)
self.add_frame_option('Content','',self.include_notes_option)
self.add_frame_option('Content','',self.place_option)
self.add_frame_option('Content','',self.date_option)
self.add_frame_option('Content','',self.age_option)
self.add_frame_option('Content','',self.dupPersons_option)
self.add_frame_option('Content','',self.childRef_option)
self.add_frame_option('Content','',self.image_option)
def parse_report_options_frame(self):
"""Parse the report options frame of the dialog. Save the user selected choices for later use."""
# call the parent task to handle normal options
ReportDialog.parse_report_options_frame(self)
# get values from the widgets
if self.first_name_option.get_active():
self.firstName = reportOptions.Yes
else:
self.firstName = reportOptions.No
if self.full_date_option.get_active():
self.fullDate = reportOptions.Yes
else:
self.fullDate = reportOptions.No
if self.list_children_option.get_active():
self.listChildren = reportOptions.Yes
else:
self.listChildren = reportOptions.No
if self.include_notes_option.get_active():
self.includeNotes = reportOptions.Yes
else:
self.includeNotes = reportOptions.No
if self.place_option.get_active():
self.blankPlace = reportOptions.Yes
else:
self.blankPlace = reportOptions.No
if self.date_option.get_active():
self.blankDate = reportOptions.Yes
else:
self.blankDate = reportOptions.No
if self.age_option.get_active():
self.calcAgeFlag = reportOptions.Yes
else:
self.calcAgeFlag = reportOptions.No
if self.dupPersons_option.get_active():
self.dupPersons = reportOptions.Yes
else:
self.dupPersons = reportOptions.No
if self.childRef_option.get_active():
self.childRef = reportOptions.Yes
else:
self.childRef = reportOptions.No
if self.image_option.get_active():
self.addImages = reportOptions.Yes
else:
self.addImages = reportOptions.No
#*** End of change
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# #
@ -820,6 +959,13 @@ def get_xpm_image():
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from Plugins import register_report from Plugins import register_report
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
from Plugins import register_report
register_report( register_report(
report, report,
_("Detailed Ancestral Report"), _("Detailed Ancestral Report"),
@ -831,7 +977,6 @@ register_report(
author_email="bdegrasse1@attbi.com" author_email="bdegrasse1@attbi.com"
) )
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# #
@ -840,8 +985,6 @@ register_report(
class reportOptions: class reportOptions:
Yes=1 Yes=1
No= 0 No= 0
Left= 2
Right= 3
def __init__(self): def __init__(self):
### Initialize report options### ### Initialize report options###
@ -889,9 +1032,9 @@ class reportOptions:
self.calcAgeFlag= reportOptions.Yes self.calcAgeFlag= reportOptions.Yes
#Add Photos and Images to report #Add Photos and Images to report
self.addImages= reportOptions.No self.addImages= reportOptions.Yes
#self.imageAttrTag= "DetAncestralReport-H" self.imageAttrTag= "DetAncestralReport-H"
self.imageAttrTag= "DetAncestralReport-L" #self.imageAttrTag= "DetAncestralReport-L"
#Omit sensitive information such as birth, christening, marriage #Omit sensitive information such as birth, christening, marriage
# for living after XXXXX date. # for living after XXXXX date.
@ -913,12 +1056,10 @@ class reportOptions:
birth= ind.getBirth().getDateObj().get_start_date() birth= ind.getBirth().getDateObj().get_start_date()
death= ind.getDeath().getDateObj().get_start_date() death= ind.getDeath().getDateObj().get_start_date()
#print "birth=", birth.__dict__
#print "death=", death.__dict__
self.t= "" self.t= ""
if birth.getYearValid() and death.getYearValid(): if birth.getYearValid() and death.getYearValid():
self.age= death.getYear() - birth.getYear() self.age= death.getYear() - birth.getYear()
self.units= "year" self.units= 3 # year
if birth.getMonthValid() and death.getMonthValid(): if birth.getMonthValid() and death.getMonthValid():
if birth.getMonth() > death.getMonth(): if birth.getMonth() > death.getMonth():
self.age= self.age -1 self.age= self.age -1
@ -929,10 +1070,22 @@ class reportOptions:
self.age= death.getMonth() - birth.getMonth() # calc age in months self.age= death.getMonth() - birth.getMonth() # calc age in months
if birth.getDay() > death.getDay(): if birth.getDay() > death.getDay():
self.age= self.age - 1 self.age= self.age - 1
self.units= "month" self.units= 2 # month
if self.age == 0: if self.age == 0:
self.age= death.getDay() + 31 - birth.getDay() # calc age in days self.age= death.getDay() + 31 - birth.getDay() # calc age in days
self.units= "day" self.units= 1 # day
self.t= _(" at the age of %d %s") % (self.age, self.units) if self.age > 1:
if self.age > 1: self.t= self.t + "s" if self.units == 1:
self.t= _(" at the age of %d days") % self.age
elif self.units == 2:
self.t= _(" at the age of %d months") % self.age
else:
self.t= _(" at the age of %d years") % self.age
else:
if self.units == 1:
self.t= _(" at the age of %d day") % self.age
elif self.units == 2:
self.t= _(" at the age of %d month") % self.age
else:
self.t= _(" at the age of %d year") % self.age
return self.t return self.t

View File

@ -1,4 +1,3 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
@ -24,15 +23,15 @@
import RelLib import RelLib
import os import os
import sort import sort
import Errors
from QuestionDialog import ErrorDialog
from intl import gettext as _ from intl import gettext as _
import Errors
from Report import * from Report import *
from TextDoc import * from TextDoc import *
import gtk import gtk
import gnome.ui import gnome.ui
from QuestionDialog import ErrorDialog
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -60,7 +59,7 @@ class DetDescendantReport(Report):
try: try:
self.doc.open(output) self.doc.open(output)
except IOError,msg: except IOError,msg:
gnome.ui.GnomeErrorDialog(_("Could not open %s") % output + "\n" + msg) ErrorDialog(_("Could not open %s") % output + "\n" + msg)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
@ -98,6 +97,9 @@ class DetDescendantReport(Report):
NAME Born: DATE PLACE Died: DATE e NAME Born: DATE PLACE Died: DATE e
NAME Born: DATE PLACE Died: PLACE d NAME Born: DATE PLACE Died: PLACE d
NAME Born: DATE PLACE c NAME Born: DATE PLACE c
NAME Born: DATE Died: DATE PLACE b
NAME Born: DATE Died: DATE a
NAME Born: DATE Died: PLACE 9
NAME Born: DATE 8 NAME Born: DATE 8
NAME Born: PLACE Died: DATE PLACE 7 NAME Born: PLACE Died: DATE PLACE 7
NAME Born: PLACE Died: DATE 6 NAME Born: PLACE Died: DATE 6
@ -137,7 +139,7 @@ class DetDescendantReport(Report):
#print "Child List: <", birth.getDate(), ">", birth.getPlaceName() #print "Child List: <", birth.getDate(), ">", birth.getPlaceName()
if birth.getDate() != "": if birth.getDate() != "":
#print birth.getPlaceName() #print birth.getPlaceName()
if birth.getPlaceName() != None: if birth.getPlaceName() != "":
if death.getDate() != "": if death.getDate() != "":
if death.getPlaceName() != "": if death.getPlaceName() != "":
self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \ self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \
@ -162,13 +164,13 @@ class DetDescendantReport(Report):
else: else:
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.getDate(), death.getDate())) # a (name, birth.getDate(), death.getDate())) # a
elif death.PlaceName() != "": elif death.getPlaceName() != "":
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.getDate(), birth.getPlaceName())) # 9 (name, birth.getDate(), death.getPlaceName())) # 9
else: self.doc.write_text(_("- %s Born: %s") % \ else: self.doc.write_text(_("- %s Born: %s") % \
(name, birth.getDate())) # 8 (name, birth.getDate())) # 8
else: else:
if birth.getPlaceName() != None: if birth.getPlaceName() != "":
if death.getDate() != "": if death.getDate() != "":
if death.getPlaceName() != "": if death.getPlaceName() != "":
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
@ -178,7 +180,7 @@ class DetDescendantReport(Report):
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.getPlaceName(), death.getDate())) # 6 (name, birth.getPlaceName(), death.getDate())) # 6
elif death.getPlaceName() != "": elif death.getPlaceName() != "":
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.getPlaceName(), death.getPlaceName())) # 5 (name, birth.getPlaceName(), death.getPlaceName())) # 5
else: self.doc.write_text(_("- %s Born: %s") % \ else: self.doc.write_text(_("- %s Born: %s") % \
(name, birth.getPlaceName())) # 4 (name, birth.getPlaceName())) # 4
@ -290,7 +292,7 @@ class DetDescendantReport(Report):
else: else:
self.doc.write_text(_(" was born in the year %s.") % date.getYear()) self.doc.write_text(_(" was born in the year %s.") % date.getYear())
elif place != "": elif place != "":
self.doc.write_text(_(" in %s.") % place) self.doc.write_text(_(" was born in %s.") % place)
else: else:
self.doc.write_text(_(".")) self.doc.write_text(_("."))
@ -415,25 +417,25 @@ class DetDescendantReport(Report):
if person.getGender() == RelLib.Person.male: if person.getGender() == RelLib.Person.male:
if father != "": if father != "":
if mother != "": if mother != "":
self.doc.write_text(_(" %s was the son of %s and %s." % \ self.doc.write_text(_(" %s was the son of %s and %s.") % \
(firstName, father, mother))) (firstName, father, mother))
else: else:
self.doc.write_text(_(" %s was the son of %s." % \ self.doc.write_text(_(" %s was the son of %s.") % \
(firstName, father))) (firstName, father))
else: else:
self.doc.write_text(_(" %s was the son of %s." % \ self.doc.write_text(_(" %s was the son of %s.") % \
(firstName, mother))) (firstName, mother))
else: else:
if father != "": if father != "":
if mother != "": if mother != "":
self.doc.write_text(_(" %s was the daughter of %s and %s." % \ self.doc.write_text(_(" %s was the daughter of %s and %s.") % \
(firstName, father, mother))) (firstName, father, mother))
else: else:
self.doc.write_text(_(" %s was the daughter of %s." % \ self.doc.write_text(_(" %s was the daughter of %s.") % \
(firstName, father))) (firstName, father))
else: else:
self.doc.write_text(_(" %s was the daughter of %s." % \ self.doc.write_text(_(" %s was the daughter of %s.") % \
(firstName, mother))) (firstName, mother))
def write_marriage(self, person, rptOptions): def write_marriage(self, person, rptOptions):
@ -441,7 +443,7 @@ class DetDescendantReport(Report):
HE/SHE married SPOUSE on FULLDATE in PLACE. HE/SHE married SPOUSE on FULLDATE in PLACE.
HE/SHE married SPOUSE on FULLDATE. HE/SHE married SPOUSE on FULLDATE.
HE/SHE married SPOUSE in PLACE. HE/SHE married SPOUSE in PLACE.
He/SHE married SPOUSE HE/SHE married SPOUSE
""" """
famList= person.getFamilyList() famList= person.getFamilyList()
if len(famList) > 0: if len(famList) > 0:
@ -452,11 +454,11 @@ class DetDescendantReport(Report):
if person.getGender() == RelLib.Person.male: if person.getGender() == RelLib.Person.male:
if fam.getMother() != None: if fam.getMother() != None:
spouse= fam.getMother().getPrimaryName().getRegularName() spouse= fam.getMother().getPrimaryName().getRegularName()
if fam_num == 1: if fam_num == 1:
heshe= _("He") heshe= _("He")
elif fam_num < len(famList): elif fam_num < len(famList):
heshe= _(",") heshe= _(",")
else: heshe= _("and he") else: heshe= _("and he")
else: else:
if fam_num == 1: if fam_num == 1:
heshe= _("She") heshe= _("She")
@ -488,22 +490,22 @@ class DetDescendantReport(Report):
if spouse != "": if spouse != "":
if fulldate == "" and place == "": if fulldate == "" and place == "":
t= _(" %s married %s" % (heshe, spouse)) t= _(" %s married %s") % (heshe, spouse)
elif fulldate == "" and place != "": elif fulldate == "" and place != "":
t= _(" %s married %s in %s" % (heshe, spouse, place)) t= _(" %s married %s in %s") % (heshe, spouse, place)
elif fulldate != "" and place == "": elif fulldate != "" and place == "":
t= _(" %s married %s on %s" % (heshe, spouse, fulldate)) t= _(" %s married %s on %s") % (heshe, spouse, fulldate)
else: t= _(" %s married %s on %s in %s" % \ else: t= _(" %s married %s on %s in %s") % \
(heshe, spouse, fulldate, place)) (heshe, spouse, fulldate, place)
else: else:
if fulldate == "" and place == "": if fulldate == "" and place == "":
t= _(" %s married") t= _(" %s married")
elif fulldate == "" and place != "": elif fulldate == "" and place != "":
t= _(" %s married in %s" % (heshe, place)) t= _(" %s married in %s") % (heshe, place)
elif fulldate != "" and place == "": elif fulldate != "" and place == "":
t= _(" %s married on %s" % (heshe, fulldate)) t= _(" %s married on %s") % (heshe, fulldate)
else: t= _(" %s married on %s in %s" % \ else: t= _(" %s married on %s in %s") % \
(heshe, fulldate, place)) (heshe, fulldate, place)
if t != "": self.doc.write_text(t) if t != "": self.doc.write_text(t)
if fam_num == len(famList): self.doc.write_text(".") if fam_num == len(famList): self.doc.write_text(".")
@ -630,7 +632,6 @@ class DetDescendantReport(Report):
spouseName= fam.getFather().getPrimaryName().getFirstName() spouseName= fam.getFather().getPrimaryName().getFirstName()
self.doc.start_paragraph("Title") self.doc.start_paragraph("Title")
#print "title: ", name, spouseName, spouseName
if spouseName != "": if spouseName != "":
name = spouseName + " and " + name name = spouseName + " and " + name
@ -643,7 +644,6 @@ class DetDescendantReport(Report):
generation = 0 generation = 0
need_header = 1 need_header = 1
# for generation in xrange(self.max_generations):
for generation in xrange(len(self.genKeys)): for generation in xrange(len(self.genKeys)):
if self.pgbrk and generation > 0: if self.pgbrk and generation > 0:
self.doc.page_break() self.doc.page_break()
@ -655,6 +655,7 @@ class DetDescendantReport(Report):
self.prevGenIDs= self.genIDs.copy() self.prevGenIDs= self.genIDs.copy()
self.genIDs.clear() self.genIDs.clear()
for key in self.genKeys[generation]: for key in self.genKeys[generation]:
person = self.map[key] person = self.map[key]
self.genIDs[person.getId()]= key self.genIDs[person.getId()]= key
@ -763,60 +764,10 @@ class DetDescendantReportDialog(TextReportDialog):
"""Create the object that will produce the Detailed Ancestral """Create the object that will produce the Detailed Ancestral
Report. All user dialog has already been handled and the Report. All user dialog has already been handled and the
output file opened.""" output file opened."""
try: MyReport = DetDescendantReport(self.db, self.person, self.target_path,
MyReport = DetDescendantReport(self.db, self.person, self.target_path, self.max_gen, self.pg_brk, self.doc)
self.max_gen, self.pg_brk, self.doc) MyReport.write_report()
MyReport.write_report()
except Errors.ReportError, msg:
ErrorDialog(str(msg))
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
def add_user_options(self):
# Create a GTK Checkbox widget for pronoun usage
self.first_name_option = gtk.CheckButton(_("Use first names instead of pronouns"))
self.first_name_option.set_active(0)
# Create a GTK Checkbox widget for full date usage
self.full_date_option = gtk.CheckButton(_("Use full dates instead of only the year"))
self.full_date_option.set_active(1)
# Create a GTK Checkbox widget for full date usage
self.list_children_option = gtk.CheckButton(_("List children"))
self.list_children_option.set_active(1)
# Add new options. The first argument is the tab name for grouping options.
# if you want to put everyting in the generic "Options" category, use
# self.add_option(text,widget) instead of self.add_frame_option(category,text,widget)
self.add_frame_option('Content','',self.first_name_option)
self.add_frame_option('Content','',self.full_date_option)
self.add_frame_option('Content','',self.list_children_option)
def parse_report_options_frame(self):
"""Parse the report options frame of the dialog. Save the
user selected choices for later use."""
# call the parent task to handle normal options
ReportDialog.parse_report_options_frame(self)
# get values from the widgets
if self.first_name_option.get_active():
self.firstName = reportOptions.Yes
else:
self.firstName = reportOptions.No
if self.full_date_option.get_active():
self.fullDate = reportOptions.Yes
else:
self.fullDate = reportOptions.No
if self.list_children_option.get_active():
self.listChildren = reportOptions.Yes
else:
self.listChildren = reportOptions.No
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -904,7 +855,6 @@ register_report(
author_email="bdegrasse1@attbi.com" author_email="bdegrasse1@attbi.com"
) )
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# #
@ -960,7 +910,7 @@ class reportOptions:
#Add Photos and Images to report #Add Photos and Images to report
self.addImages= reportOptions.No self.addImages= reportOptions.No
self.imageAttrTag= "DetDecendantReport" self.imageAttrTag= "DetDescendantReport"
#Omit sensitive information such as birth, christening, marriage #Omit sensitive information such as birth, christening, marriage
# for living after XXXXX date. # for living after XXXXX date.
@ -987,7 +937,7 @@ class reportOptions:
self.t= "" self.t= ""
if birth.getYearValid() and death.getYearValid(): if birth.getYearValid() and death.getYearValid():
self.age= death.getYear() - birth.getYear() self.age= death.getYear() - birth.getYear()
self.units= "year" self.units= 3 # year
if birth.getMonthValid() and death.getMonthValid(): if birth.getMonthValid() and death.getMonthValid():
if birth.getMonth() > death.getMonth(): if birth.getMonth() > death.getMonth():
self.age= self.age -1 self.age= self.age -1
@ -998,10 +948,22 @@ class reportOptions:
self.age= death.getMonth() - birth.getMonth() # calc age in months self.age= death.getMonth() - birth.getMonth() # calc age in months
if birth.getDay() > death.getDay(): if birth.getDay() > death.getDay():
self.age= self.age - 1 self.age= self.age - 1
self.units= "month" self.units= 2 # month
if self.age == 0: if self.age == 0:
self.age= death.getDay() + 31 - birth.getDay() # calc age in days self.age= death.getDay() + 31 - birth.getDay() # calc age in days
self.units= "day" self.units= 1 # day
self.t= _(" at the age of %d %s") % (self.age, self.units) if self.age > 1:
if self.age > 1: self.t= self.t + "s" if self.units == 1:
self.t= _(" at the age of %d days") % self.age
elif self.units == 2:
self.t= _(" at the age of %d months") % self.age
else:
self.t= _(" at the age of %d years") % self.age
else:
if self.units == 1:
self.t= _(" at the age of %d day") % self.age
elif self.units == 2:
self.t= _(" at the age of %d month") % self.age
else:
self.t= _(" at the age of %d year") % self.age
return self.t return self.t

View File

@ -148,7 +148,7 @@ class EventComparison:
def on_apply_clicked(self,obj): def on_apply_clicked(self,obj):
cfilter = self.filter_menu.get_active().get_data("filter") cfilter = self.filter_menu.get_active().get_data("filter")
plist = cfilter.apply(self.db.getPersonMap().values()) plist = cfilter.apply(self.db,self.db.getPersonMap().values())
if len(plist) == 0: if len(plist) == 0:
WarningDialog(_("No matches were found")) WarningDialog(_("No matches were found"))

View File

@ -134,11 +134,10 @@ class Merge:
self.show() self.show()
def progress_update(self,val): def progress_update(self,val):
self.progress.set_value(val) self.progress.update(val/100.0)
while gtk.events_pending(): while gtk.events_pending():
gtk.mainiteration() gtk.mainiteration()
def find_potentials(self,thresh): def find_potentials(self,thresh):
top = gtk.glade.XML(self.glade_file,"message") top = gtk.glade.XML(self.glade_file,"message")
self.topWin = top.get_widget("message") self.topWin = top.get_widget("message")

View File

@ -275,7 +275,7 @@ def on_apply_clicked(obj):
}) })
top = verifyResult.get_widget("verify_result") top = verifyResult.get_widget("verify_result")
textwindow = verifyResult.get_widget("textwindow") textwindow = verifyResult.get_widget("textwindow")
textwindow.show_string(text) textwindow.get_buffer().set_text(text)
top.show() top.show()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -119,6 +119,8 @@
<property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property> <property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property> <property name="modal">False</property>
<property name="default_width">450</property>
<property name="default_height">350</property>
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="destroy_with_parent">False</property> <property name="destroy_with_parent">False</property>
<property name="has_separator">True</property> <property name="has_separator">True</property>

View File

@ -47,7 +47,6 @@ class SoundGen:
self.glade = gtk.glade.XML(glade_file,"soundEx") self.glade = gtk.glade.XML(glade_file,"soundEx")
self.glade.signal_autoconnect({ self.glade.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object, "destroy_passed_object" : Utils.destroy_passed_object,
"on_combo_insert_text" : Utils.combo_insert_text,
"on_apply_clicked" : self.on_apply_clicked, "on_apply_clicked" : self.on_apply_clicked,
}) })

File diff suppressed because it is too large Load Diff