* src/plugins/FtmStyleDescendants.py: Convert to db interface.
svn: r3121
This commit is contained in:
parent
87b29118d7
commit
5cb8a8ea22
@ -1,6 +1,7 @@
|
|||||||
2004-05-03 Alex Roitman <shura@alex.neuro.umn.edu>
|
2004-05-03 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/plugins/DetDescendantReport.py: Convert to db interface.
|
* src/plugins/DetDescendantReport.py: Convert to db interface.
|
||||||
* src/plugins/DetAncestralReport.py: Translate string.
|
* src/plugins/DetAncestralReport.py: Translate string.
|
||||||
|
* src/plugins/FtmStyleDescendants.py: Convert to db interface.
|
||||||
|
|
||||||
2004-05-02 Don Allingham <donaldallingham@users.sourceforge.net>
|
2004-05-02 Don Allingham <donaldallingham@users.sourceforge.net>
|
||||||
* src/DbPrompter.py: 2.4 filechooser
|
* src/DbPrompter.py: 2.4 filechooser
|
||||||
|
@ -85,22 +85,24 @@ class FtmDescendantReport(Report.Report):
|
|||||||
cell = BaseDoc.TableCellStyle()
|
cell = BaseDoc.TableCellStyle()
|
||||||
self.doc.add_cell_style('FTD-Normal',cell)
|
self.doc.add_cell_style('FTD-Normal',cell)
|
||||||
|
|
||||||
def apply_filter(self,person,index,generation=1):
|
def apply_filter(self,person_id,index,generation=1):
|
||||||
|
|
||||||
if person == None or generation > self.max_generations:
|
if (not person_id) or (generation > self.max_generations):
|
||||||
return
|
return
|
||||||
|
|
||||||
self.anc_map[index] = person
|
self.anc_map[index] = person_id
|
||||||
try:
|
try:
|
||||||
self.gen_map[generation].append(index)
|
self.gen_map[generation].append(index)
|
||||||
except:
|
except:
|
||||||
self.gen_map[generation] = []
|
self.gen_map[generation] = []
|
||||||
self.gen_map[generation].append(index)
|
self.gen_map[generation].append(index)
|
||||||
|
|
||||||
for family in person.get_family_id_list():
|
person = self.database.find_person_from_id(person_id)
|
||||||
for child in family.get_child_id_list():
|
for family_id in person.get_family_id_list():
|
||||||
|
family = self.database.find_family_from_id(family_id)
|
||||||
|
for child_id in family.get_child_id_list():
|
||||||
ix = max(self.anc_map.keys())
|
ix = max(self.anc_map.keys())
|
||||||
self.apply_filter(child,ix+1,generation+1)
|
self.apply_filter(child_id,ix+1,generation+1)
|
||||||
|
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
@ -108,7 +110,7 @@ class FtmDescendantReport(Report.Report):
|
|||||||
if self.newpage:
|
if self.newpage:
|
||||||
self.doc.page_break()
|
self.doc.page_break()
|
||||||
|
|
||||||
self.apply_filter(self.start,1)
|
self.apply_filter(self.start.get_id(),1)
|
||||||
|
|
||||||
name = self.start.get_primary_name().get_regular_name()
|
name = self.start.get_primary_name().get_regular_name()
|
||||||
self.doc.start_paragraph("FTD-Title")
|
self.doc.start_paragraph("FTD-Title")
|
||||||
@ -130,7 +132,8 @@ class FtmDescendantReport(Report.Report):
|
|||||||
indexlist = self.gen_map[generation]
|
indexlist = self.gen_map[generation]
|
||||||
indexlist.sort()
|
indexlist.sort()
|
||||||
for key in indexlist:
|
for key in indexlist:
|
||||||
person = self.anc_map[key]
|
person_id = self.anc_map[key]
|
||||||
|
person = self.database.find_person_from_id(person_id)
|
||||||
|
|
||||||
pri_name = person.get_primary_name()
|
pri_name = person.get_primary_name()
|
||||||
self.doc.start_paragraph("FTD-Entry","%d." % key)
|
self.doc.start_paragraph("FTD-Entry","%d." % key)
|
||||||
@ -141,16 +144,28 @@ class FtmDescendantReport(Report.Report):
|
|||||||
|
|
||||||
# Check birth record
|
# Check birth record
|
||||||
|
|
||||||
birth = person.get_birth()
|
birth_id = person.get_birth_id()
|
||||||
bplace = birth.get_place_name()
|
bplace = ""
|
||||||
bdate = birth.get_date()
|
bdate = ""
|
||||||
|
if birth_id:
|
||||||
|
birth = self.database.find_event_from_id(birth_id)
|
||||||
|
bdate = birth.get_date()
|
||||||
|
bplace_id = birth.get_place_id()
|
||||||
|
if bplace_id:
|
||||||
|
bplace = self.database.find_place_from_id(bplace_id).get_title()
|
||||||
|
|
||||||
death = person.get_death()
|
death_id = person.get_death_id()
|
||||||
dplace = death.get_place_name()
|
dplace = ""
|
||||||
ddate = death.get_date()
|
ddate = ""
|
||||||
|
if death_id:
|
||||||
|
death = self.database.find_event_from_id(death_id)
|
||||||
|
ddate = death.get_date()
|
||||||
|
dplace_id = death.get_place_id()
|
||||||
|
if dplace_id:
|
||||||
|
dplace = self.database.find_place_from_id(dplace_id).get_title()
|
||||||
|
|
||||||
birth_valid = bdate != "" or bplace != ""
|
birth_valid = bdate or bplace
|
||||||
death_valid = ddate != "" or dplace != ""
|
death_valid = ddate or dplace
|
||||||
|
|
||||||
if birth_valid or death_valid:
|
if birth_valid or death_valid:
|
||||||
if person.get_gender() == RelLib.Person.male:
|
if person.get_gender() == RelLib.Person.male:
|
||||||
@ -460,12 +475,13 @@ class FtmDescendantReport(Report.Report):
|
|||||||
keys.sort()
|
keys.sort()
|
||||||
for key in keys:
|
for key in keys:
|
||||||
srcref = self.sref_map[key]
|
srcref = self.sref_map[key]
|
||||||
base = srcref.get_base_id()
|
base_id = srcref.get_base_id()
|
||||||
|
base = self.database.find_source_from_id(base_id)
|
||||||
|
|
||||||
self.doc.start_paragraph('FTD-Endnotes',"%d." % key)
|
self.doc.start_paragraph('FTD-Endnotes',"%d." % key)
|
||||||
self.doc.write_text(base.get_title())
|
self.doc.write_text(base.get_title())
|
||||||
|
|
||||||
for item in [ base.get_author(), base.get_publication_info(), base.getAbbrev(),
|
for item in [ base.get_author(), base.get_publication_info(), base.get_abbreviation(),
|
||||||
srcref.get_date().get_date(),]:
|
srcref.get_date().get_date(),]:
|
||||||
if item:
|
if item:
|
||||||
self.doc.write_text('; %s' % item)
|
self.doc.write_text('; %s' % item)
|
||||||
@ -544,9 +560,16 @@ class FtmDescendantReport(Report.Report):
|
|||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
ncount += 1
|
ncount += 1
|
||||||
|
|
||||||
for event in person.get_event_list():
|
for event_id in person.get_event_list():
|
||||||
|
if not event_id:
|
||||||
|
continue
|
||||||
|
event = self.database.find_event_from_id(event_id)
|
||||||
date = event.get_date()
|
date = event.get_date()
|
||||||
place = event.get_place_id()
|
place_id = event.get_place_id()
|
||||||
|
if place_id:
|
||||||
|
place = self.database.find_place_from_id(place_id)
|
||||||
|
else:
|
||||||
|
place = None
|
||||||
|
|
||||||
if not date and not place:
|
if not date and not place:
|
||||||
continue
|
continue
|
||||||
@ -561,19 +584,19 @@ class FtmDescendantReport(Report.Report):
|
|||||||
if date and place:
|
if date and place:
|
||||||
self.doc.write_text(_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
|
self.doc.write_text(_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
|
||||||
'event_name' : _(event.get_name()),
|
'event_name' : _(event.get_name()),
|
||||||
'date' : event.get_date(),
|
'date' : date,
|
||||||
'endnotes' : self.endnotes(event),
|
'endnotes' : self.endnotes(event),
|
||||||
'place' : event.get_place_name() })
|
'place' : place.get_title() })
|
||||||
elif date:
|
elif date:
|
||||||
self.doc.write_text(_('%(event_name)s: %(date)s%(endnotes)s. ') % {
|
self.doc.write_text(_('%(event_name)s: %(date)s%(endnotes)s. ') % {
|
||||||
'event_name' : _(event.get_name()),
|
'event_name' : _(event.get_name()),
|
||||||
'endnotes' : self.endnotes(event),
|
'endnotes' : self.endnotes(event),
|
||||||
'date' : event.get_date()})
|
'date' : date})
|
||||||
else:
|
else:
|
||||||
self.doc.write_text(_('%(event_name)s: %(place)s%(endnotes)s. ') % {
|
self.doc.write_text(_('%(event_name)s: %(place)s%(endnotes)s. ') % {
|
||||||
'event_name' : _(event.get_name()),
|
'event_name' : _(event.get_name()),
|
||||||
'endnotes' : self.endnotes(event),
|
'endnotes' : self.endnotes(event),
|
||||||
'place' : event.get_place_name() })
|
'place' : place.get_title() })
|
||||||
if event.get_description():
|
if event.get_description():
|
||||||
self.doc.write_text(event.get_description())
|
self.doc.write_text(event.get_description())
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
@ -584,15 +607,25 @@ class FtmDescendantReport(Report.Report):
|
|||||||
|
|
||||||
first = 1
|
first = 1
|
||||||
|
|
||||||
for family in person.get_family_id_list():
|
for family_id in person.get_family_id_list():
|
||||||
if family.get_father_id() and family.get_mother_id():
|
family = self.database.find_family_from_id(family_id)
|
||||||
husband = family.get_father_id().get_primary_name().get_regular_name()
|
father_id = family.get_father_id()
|
||||||
wife = family.get_mother_id().get_primary_name().get_regular_name()
|
mother_id = family.get_mother_id()
|
||||||
|
if father_id and mother_id:
|
||||||
|
husband = self.database.find_person_from_id(father_id).get_primary_name().get_regular_name()
|
||||||
|
wife = self.database.find_person_from_id(mother_id).get_primary_name().get_regular_name()
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
for event in family.get_event_list():
|
for event_id in family.get_event_list():
|
||||||
|
if not event_id:
|
||||||
|
continue
|
||||||
|
event = self.database.find_event_from_id(event_id)
|
||||||
date = event.get_date()
|
date = event.get_date()
|
||||||
place = event.get_place_id()
|
place_id = event.get_place_id()
|
||||||
|
if place_id:
|
||||||
|
place = self.database.find_place_from_id(place_id)
|
||||||
|
else:
|
||||||
|
place = None
|
||||||
|
|
||||||
if not date and not place:
|
if not date and not place:
|
||||||
continue
|
continue
|
||||||
@ -606,19 +639,19 @@ class FtmDescendantReport(Report.Report):
|
|||||||
if date and place:
|
if date and place:
|
||||||
self.doc.write_text(_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
|
self.doc.write_text(_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
|
||||||
'event_name' : _(event.get_name()),
|
'event_name' : _(event.get_name()),
|
||||||
'date' : event.get_date(),
|
'date' : date,
|
||||||
'endnotes' : self.endnotes(event),
|
'endnotes' : self.endnotes(event),
|
||||||
'place' : event.get_place_name() })
|
'place' : place.get_title() })
|
||||||
elif date:
|
elif date:
|
||||||
self.doc.write_text(_('%(event_name)s: %(date)s%(endnotes)s. ') % {
|
self.doc.write_text(_('%(event_name)s: %(date)s%(endnotes)s. ') % {
|
||||||
'event_name' : _(event.get_name()),
|
'event_name' : _(event.get_name()),
|
||||||
'endnotes' : self.endnotes(event),
|
'endnotes' : self.endnotes(event),
|
||||||
'date' : event.get_date()})
|
'date' : date})
|
||||||
else:
|
else:
|
||||||
self.doc.write_text(_('%(event_name)s: %(place)s%(endnotes)s. ') % {
|
self.doc.write_text(_('%(event_name)s: %(place)s%(endnotes)s. ') % {
|
||||||
'event_name' : _(event.get_name()),
|
'event_name' : _(event.get_name()),
|
||||||
'endnotes' : self.endnotes(event),
|
'endnotes' : self.endnotes(event),
|
||||||
'place' : event.get_place_name() })
|
'place' : place.get_title() })
|
||||||
if event.get_description():
|
if event.get_description():
|
||||||
self.doc.write_text(event.get_description())
|
self.doc.write_text(event.get_description())
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
@ -629,20 +662,25 @@ class FtmDescendantReport(Report.Report):
|
|||||||
|
|
||||||
name = person.get_primary_name().get_regular_name()
|
name = person.get_primary_name().get_regular_name()
|
||||||
|
|
||||||
for family in person.get_family_id_list():
|
for family_id in person.get_family_id_list():
|
||||||
|
family = self.database.find_family_from_id(family_id)
|
||||||
first = 1
|
first = 1
|
||||||
|
|
||||||
if family.get_father_id() == person:
|
father_id = family.get_father_id()
|
||||||
spouse = family.get_mother_id()
|
mother_id = family.get_mother_id()
|
||||||
|
if father_id == person.get_id():
|
||||||
|
spouse_id = mother_id
|
||||||
else:
|
else:
|
||||||
spouse = family.get_father_id()
|
spouse_id = father_id
|
||||||
|
spouse = self.database.find_person_from_id(spouse_id)
|
||||||
|
|
||||||
child_index = 0
|
child_index = 0
|
||||||
for child in family.get_child_id_list():
|
for child_id in family.get_child_id_list():
|
||||||
|
child = self.database.find_person_from_id(child_id)
|
||||||
child_index = child_index + 1
|
child_index = child_index + 1
|
||||||
child_name = child.get_primary_name().get_regular_name()
|
child_name = child.get_primary_name().get_regular_name()
|
||||||
for (ind,p) in self.anc_map.items():
|
for (ind,p_id) in self.anc_map.items():
|
||||||
if p == child:
|
if p_id == child_id:
|
||||||
index = ind
|
index = ind
|
||||||
|
|
||||||
if first:
|
if first:
|
||||||
@ -672,13 +710,25 @@ class FtmDescendantReport(Report.Report):
|
|||||||
self.doc.start_cell('FTD-Normal')
|
self.doc.start_cell('FTD-Normal')
|
||||||
self.doc.start_paragraph('FTD-Details')
|
self.doc.start_paragraph('FTD-Details')
|
||||||
|
|
||||||
death = child.get_death()
|
birth_id = child.get_birth_id()
|
||||||
dplace = death.get_place_name()
|
bplace = ""
|
||||||
ddate = death.get_date()
|
bdate = ""
|
||||||
|
if birth_id:
|
||||||
|
birth = self.database.find_event_from_id(birth_id)
|
||||||
|
bdate = birth.get_date()
|
||||||
|
bplace_id = birth.get_place_id()
|
||||||
|
if bplace_id:
|
||||||
|
bplace = self.database.find_place_from_id(bplace_id).get_title()
|
||||||
|
|
||||||
birth = child.get_birth()
|
death_id = child.get_death_id()
|
||||||
bplace = birth.get_place_name()
|
dplace = ""
|
||||||
bdate = birth.get_date()
|
ddate = ""
|
||||||
|
if death_id:
|
||||||
|
death = self.database.find_event_from_id(death_id)
|
||||||
|
ddate = death.get_date()
|
||||||
|
dplace_id = death.get_place_id()
|
||||||
|
if dplace_id:
|
||||||
|
dplace = self.database.find_place_from_id(dplace_id).get_title()
|
||||||
|
|
||||||
if child.get_gender() == RelLib.Person.male:
|
if child.get_gender() == RelLib.Person.male:
|
||||||
if bdate:
|
if bdate:
|
||||||
@ -949,18 +999,32 @@ class FtmDescendantReport(Report.Report):
|
|||||||
family_list = person.get_family_id_list()
|
family_list = person.get_family_id_list()
|
||||||
if not family_list:
|
if not family_list:
|
||||||
return
|
return
|
||||||
family = family_list[0]
|
family_id = family_list[0]
|
||||||
if family.get_father_id() == person:
|
family = self.database.find_family_from_id(family_id)
|
||||||
spouse = family.get_mother_id()
|
if family.get_father_id() == person.get_id():
|
||||||
|
spouse_id = family.get_mother_id()
|
||||||
else:
|
else:
|
||||||
spouse = family.get_father_id()
|
spouse_id = family.get_father_id()
|
||||||
if not spouse:
|
if not spouse_id:
|
||||||
return
|
return
|
||||||
event = family.get_marriage()
|
spouse = self.database.find_person_from_id(spouse_id)
|
||||||
|
|
||||||
|
for event_id in family.get_event_list():
|
||||||
|
if event_id:
|
||||||
|
event = self.database.find_event_from_id(event_id)
|
||||||
|
if event.get_name() == "Marriage":
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
event = None
|
||||||
|
|
||||||
if not event:
|
if not event:
|
||||||
return
|
return
|
||||||
date = event.get_date()
|
date = event.get_date()
|
||||||
place = event.get_place_name()
|
place_id = event.get_place_id()
|
||||||
|
if place_id:
|
||||||
|
place = self.database.find_place_from_id(place_id).get_title()
|
||||||
|
else:
|
||||||
|
place = ""
|
||||||
|
|
||||||
if date and place:
|
if date and place:
|
||||||
if person.get_gender() == RelLib.Person.male:
|
if person.get_gender() == RelLib.Person.male:
|
||||||
@ -1008,16 +1072,28 @@ class FtmDescendantReport(Report.Report):
|
|||||||
'endnotes' : self.endnotes(event)})
|
'endnotes' : self.endnotes(event)})
|
||||||
self.doc.write_text(' ')
|
self.doc.write_text(' ')
|
||||||
|
|
||||||
death = spouse.get_death()
|
birth_id = spouse.get_birth_id()
|
||||||
dplace = death.get_place_name()
|
bplace = ""
|
||||||
ddate = death.get_date()
|
bdate = ""
|
||||||
|
if birth_id:
|
||||||
|
birth = self.database.find_event_from_id(birth_id)
|
||||||
|
bdate = birth.get_date()
|
||||||
|
bplace_id = birth.get_place_id()
|
||||||
|
if bplace_id:
|
||||||
|
bplace = self.database.find_place_from_id(bplace_id).get_title()
|
||||||
|
|
||||||
birth = spouse.get_birth()
|
death_id = spouse.get_death_id()
|
||||||
bplace = birth.get_place_name()
|
dplace = ""
|
||||||
bdate = birth.get_date()
|
ddate = ""
|
||||||
|
if death_id:
|
||||||
|
death = self.database.find_event_from_id(death_id)
|
||||||
|
ddate = death.get_date()
|
||||||
|
dplace_id = death.get_place_id()
|
||||||
|
if dplace_id:
|
||||||
|
dplace = self.database.find_place_from_id(dplace_id).get_title()
|
||||||
|
|
||||||
death_valid = ddate != "" or dplace != ""
|
death_valid = ddate or dplace
|
||||||
birth_valid = bdate != "" or bplace != ""
|
birth_valid = bdate or bplace
|
||||||
|
|
||||||
if birth_valid or death_valid:
|
if birth_valid or death_valid:
|
||||||
if spouse.get_gender() == RelLib.Person.male:
|
if spouse.get_gender() == RelLib.Person.male:
|
||||||
@ -1303,10 +1379,19 @@ class FtmDescendantReport(Report.Report):
|
|||||||
|
|
||||||
|
|
||||||
def print_parents(self,person,dead):
|
def print_parents(self,person,dead):
|
||||||
family = person.get_main_parents_family_id()
|
family_id = person.get_main_parents_family_id()
|
||||||
if family:
|
if family_id:
|
||||||
mother = family.get_mother_id()
|
family = self.database.find_family_from_id(family_id)
|
||||||
father = family.get_father_id()
|
mother_id = family.get_mother_id()
|
||||||
|
if mother_id:
|
||||||
|
mother = self.database.find_person_from_id(mother_id)
|
||||||
|
else:
|
||||||
|
mother = None
|
||||||
|
father_id = family.get_father_id()
|
||||||
|
if father_id:
|
||||||
|
father = self.database.find_person_from_id(father_id)
|
||||||
|
else:
|
||||||
|
father = None
|
||||||
if person.get_gender() == RelLib.Person.male:
|
if person.get_gender() == RelLib.Person.male:
|
||||||
if mother and father:
|
if mother and father:
|
||||||
if dead:
|
if dead:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user