* src/EditPerson.py: Switch to Sort.py.
* src/FamilyView.py: Switch to Sort.py. * src/RelLib.py: Remove unneeded import. * src/plugins/DescendReport.py: Switch to Sort.py. * src/plugins/GraphViz.py: Convert to db. svn: r3130
This commit is contained in:
parent
50131988cc
commit
cfcd50ab02
@ -28,6 +28,13 @@
|
|||||||
* src/sort.py: Remove file (obsolete).
|
* src/sort.py: Remove file (obsolete).
|
||||||
* src/plugins/TimeLine.py: Convert to db.
|
* src/plugins/TimeLine.py: Convert to db.
|
||||||
|
|
||||||
|
* src/EditPerson.py: Switch to Sort.py.
|
||||||
|
* src/FamilyView.py: Switch to Sort.py.
|
||||||
|
* src/RelLib.py: Remove unneeded import.
|
||||||
|
* src/plugins/DescendReport.py: Switch to Sort.py.
|
||||||
|
|
||||||
|
* src/plugins/GraphViz.py: Convert to db.
|
||||||
|
|
||||||
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.
|
||||||
|
@ -79,7 +79,6 @@ class GraphVizDialog(Report.ReportDialog):
|
|||||||
report_options = {}
|
report_options = {}
|
||||||
|
|
||||||
def __init__(self,database,person):
|
def __init__(self,database,person):
|
||||||
|
|
||||||
Report.ReportDialog.__init__(self,database,person,self.report_options)
|
Report.ReportDialog.__init__(self,database,person,self.report_options)
|
||||||
|
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
@ -326,13 +325,13 @@ class GraphVizDialog(Report.ReportDialog):
|
|||||||
file = open(self.target_path,"w")
|
file = open(self.target_path,"w")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ind_list = self.filter.apply(self.db, self.db.get_person_id_map().values())
|
ind_list = self.filter.apply(self.db, self.db.get_person_keys())
|
||||||
except Errors.FilterError, msg:
|
except Errors.FilterError, msg:
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
(m1,m2) = msg.messages()
|
(m1,m2) = msg.messages()
|
||||||
ErrorDialog(m1,m2)
|
ErrorDialog(m1,m2)
|
||||||
|
|
||||||
write_dot(file, ind_list, self.orien, width, height,
|
write_dot(self.db, file, ind_list, self.orien, width, height,
|
||||||
self.tb_margin, self.lr_margin, self.hpages,
|
self.tb_margin, self.lr_margin, self.hpages,
|
||||||
self.vpages, self.includedates, self.includeurl,
|
self.vpages, self.includedates, self.includeurl,
|
||||||
self.colorize, self.adoptionsdashed, self.arrowheadstyle,
|
self.colorize, self.adoptionsdashed, self.arrowheadstyle,
|
||||||
@ -357,7 +356,7 @@ def report(database,person):
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
def write_dot(file, ind_list, orien, width, height, tb_margin,
|
def write_dot(database, file, ind_list, orien, width, height, tb_margin,
|
||||||
lr_margin, hpages, vpages, includedates, includeurl,
|
lr_margin, hpages, vpages, includedates, includeurl,
|
||||||
colorize, adoptionsdashed, arrowheadstyle, arrowtailstyle,
|
colorize, adoptionsdashed, arrowheadstyle, arrowtailstyle,
|
||||||
show_families, just_year, fontstyle):
|
show_families, just_year, fontstyle):
|
||||||
@ -375,9 +374,9 @@ def write_dot(file, ind_list, orien, width, height, tb_margin,
|
|||||||
file.write("rotate=90;\n")
|
file.write("rotate=90;\n")
|
||||||
|
|
||||||
if len(ind_list) > 1:
|
if len(ind_list) > 1:
|
||||||
dump_index(ind_list,file,includedates,includeurl,colorize,
|
dump_index(database,ind_list,file,includedates,includeurl,colorize,
|
||||||
arrowheadstyle,arrowtailstyle,show_families,just_year,fontstyle)
|
arrowheadstyle,arrowtailstyle,show_families,just_year,fontstyle)
|
||||||
dump_person(ind_list,file,adoptionsdashed,arrowheadstyle,
|
dump_person(database,ind_list,file,adoptionsdashed,arrowheadstyle,
|
||||||
arrowtailstyle,show_families)
|
arrowtailstyle,show_families)
|
||||||
|
|
||||||
file.write("}\n")
|
file.write("}\n")
|
||||||
@ -388,25 +387,27 @@ def write_dot(file, ind_list, orien, width, height, tb_margin,
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
def dump_person(person_list,file,adoptionsdashed,arrowheadstyle,
|
def dump_person(database,person_list,file,adoptionsdashed,arrowheadstyle,
|
||||||
arrowtailstyle,show_families):
|
arrowtailstyle,show_families):
|
||||||
# Hash people in a dictionary for faster inclusion checking.
|
# Hash people in a dictionary for faster inclusion checking.
|
||||||
person_dict = {}
|
person_dict = {}
|
||||||
for p in person_list:
|
for p_id in person_list:
|
||||||
person_dict[p.get_id()] = 1
|
person_dict[p_id] = 1
|
||||||
|
|
||||||
for person in person_list:
|
for person_id in person_list:
|
||||||
pid = string.replace(person.get_id(),'-','_')
|
pid = string.replace(person_id,'-','_')
|
||||||
for family, mrel, frel in person.get_parent_family_id_list():
|
person = database.find_person_from_id(person_id)
|
||||||
father = family.get_father_id()
|
for family_id, mrel, frel in person.get_parent_family_id_list():
|
||||||
mother = family.get_mother_id()
|
family = database.find_family_from_id(family_id)
|
||||||
fadopted = frel != _("Birth")
|
father_id = family.get_father_id()
|
||||||
madopted = mrel != _("Birth")
|
mother_id = family.get_mother_id()
|
||||||
|
fadopted = frel != _("Birth")
|
||||||
|
madopted = mrel != _("Birth")
|
||||||
if (show_families and
|
if (show_families and
|
||||||
(father and person_dict.has_key(father.get_id()) or
|
(father_id and person_dict.has_key(father_id) or
|
||||||
mother and person_dict.has_key(mother.get_id()))):
|
mother_id and person_dict.has_key(mother_id))):
|
||||||
# Link to the family node.
|
# Link to the family node.
|
||||||
famid = string.replace(family.get_id(),'-','_')
|
famid = string.replace(family_id,'-','_')
|
||||||
file.write('p%s -> f%s [' % (pid, famid))
|
file.write('p%s -> f%s [' % (pid, famid))
|
||||||
file.write('arrowhead=%s, arrowtail=%s, ' %
|
file.write('arrowhead=%s, arrowtail=%s, ' %
|
||||||
(arrowheadstyle, arrowtailstyle))
|
(arrowheadstyle, arrowtailstyle))
|
||||||
@ -417,8 +418,8 @@ def dump_person(person_list,file,adoptionsdashed,arrowheadstyle,
|
|||||||
file.write('];\n')
|
file.write('];\n')
|
||||||
else:
|
else:
|
||||||
# Link to the parents' nodes directly.
|
# Link to the parents' nodes directly.
|
||||||
if father and person_dict.has_key(father.get_id()):
|
if father_id and person_dict.has_key(father_id):
|
||||||
fid = string.replace(father.get_id(),'-','_')
|
fid = string.replace(father_id,'-','_')
|
||||||
file.write('p%s -> p%s [' % (pid, fid))
|
file.write('p%s -> p%s [' % (pid, fid))
|
||||||
file.write('arrowhead=%s, arrowtail=%s, ' %
|
file.write('arrowhead=%s, arrowtail=%s, ' %
|
||||||
(arrowheadstyle, arrowtailstyle))
|
(arrowheadstyle, arrowtailstyle))
|
||||||
@ -427,8 +428,8 @@ def dump_person(person_list,file,adoptionsdashed,arrowheadstyle,
|
|||||||
else:
|
else:
|
||||||
file.write('style=solid')
|
file.write('style=solid')
|
||||||
file.write('];\n')
|
file.write('];\n')
|
||||||
if mother and person_dict.has_key(mother.get_id()):
|
if mother_id and person_dict.has_key(mother.get_id()):
|
||||||
mid = string.replace(mother.get_id(),'-','_')
|
mid = string.replace(mother_id,'-','_')
|
||||||
file.write('p%s -> p%s [' % (pid, mid))
|
file.write('p%s -> p%s [' % (pid, mid))
|
||||||
file.write('arrowhead=%s, arrowtail=%s, ' %
|
file.write('arrowhead=%s, arrowtail=%s, ' %
|
||||||
(arrowheadstyle, arrowtailstyle))
|
(arrowheadstyle, arrowtailstyle))
|
||||||
@ -443,28 +444,35 @@ def dump_person(person_list,file,adoptionsdashed,arrowheadstyle,
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
def dump_index(person_list,file,includedates,includeurl,colorize,
|
def dump_index(database,person_list,file,includedates,includeurl,colorize,
|
||||||
arrowheadstyle,arrowtailstyle,show_families,just_year,font):
|
arrowheadstyle,arrowtailstyle,show_families,just_year,font):
|
||||||
# The list of families for which we have output the node, so we
|
# The list of families for which we have output the node, so we
|
||||||
# don't do it twice.
|
# don't do it twice.
|
||||||
families_done = []
|
families_done = []
|
||||||
for person in person_list:
|
for person_id in person_list:
|
||||||
|
person = database.find_person_from_id(person_id)
|
||||||
# Output the person's node.
|
# Output the person's node.
|
||||||
label = person.get_primary_name().get_name()
|
label = person.get_primary_name().get_name()
|
||||||
id = string.replace(person.get_id(),'-','_')
|
id = string.replace(person_id,'-','_')
|
||||||
if includedates:
|
if includedates:
|
||||||
if person.get_birth().get_date_object().getYearValid():
|
birth_id = person.get_birth_id()
|
||||||
if just_year:
|
if birth_id:
|
||||||
birth = '%i' % person.get_birth().get_date_object().getYear()
|
birth_event = database.find_event_from_id(birth_id)
|
||||||
else:
|
if birth_event.get_date_object().get_year_valid():
|
||||||
birth = person.get_birth().get_date()
|
if just_year:
|
||||||
|
birth = '%i' % birth_event.get_date_object().get_year()
|
||||||
|
else:
|
||||||
|
birth = birth_event.get_date()
|
||||||
else:
|
else:
|
||||||
birth = ''
|
birth = ''
|
||||||
if person.get_death().get_date_object().getYearValid():
|
death_id = person.get_death_id()
|
||||||
if just_year:
|
if death_id:
|
||||||
death = '%i' % person.get_death().get_date_object().getYear()
|
death_event = database.find_event_from_id(death_id)
|
||||||
else:
|
if death_event.get_date_object().get_year_valid():
|
||||||
death = person.get_death().get_date()
|
if just_year:
|
||||||
|
death = '%i' % death_event.get_date_object().get_year()
|
||||||
|
else:
|
||||||
|
death = death_event.get_date()
|
||||||
else:
|
else:
|
||||||
death = ''
|
death = ''
|
||||||
label = label + '\\n(%s - %s)' % (birth, death)
|
label = label + '\\n(%s - %s)' % (birth, death)
|
||||||
@ -486,19 +494,29 @@ def dump_index(person_list,file,includedates,includeurl,colorize,
|
|||||||
# Output families's nodes.
|
# Output families's nodes.
|
||||||
if show_families:
|
if show_families:
|
||||||
family_list = person.get_family_id_list()
|
family_list = person.get_family_id_list()
|
||||||
for fam in family_list:
|
for fam_id in family_list:
|
||||||
fid = string.replace(fam.get_id(),'-','_')
|
fid = string.replace(fam_id,'-','_')
|
||||||
if fam not in families_done:
|
if fam not_id in families_done:
|
||||||
families_done.append(fam)
|
families_done.append(fam_id)
|
||||||
file.write('f%s [shape=ellipse, ' % fid)
|
file.write('f%s [shape=ellipse, ' % fid)
|
||||||
marriage = ""
|
marriage = ""
|
||||||
m = fam.get_marriage()
|
fam = database.find_family_from_id(fam_id)
|
||||||
if m != None:
|
|
||||||
|
for event_id in fam.get_event_list():
|
||||||
|
if event_id:
|
||||||
|
event = database.find_event_from_id(event_id)
|
||||||
|
if event.get_name() == "Marriage":
|
||||||
|
m = event
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
m = None
|
||||||
|
|
||||||
|
if m:
|
||||||
do = m.get_date_object()
|
do = m.get_date_object()
|
||||||
if do != None:
|
if do:
|
||||||
if do.getYearValid():
|
if do.get_year_valid():
|
||||||
if just_year:
|
if just_year:
|
||||||
marriage = '%i' % do.getYear()
|
marriage = '%i' % do.get_year()
|
||||||
else:
|
else:
|
||||||
marriage = m.get_date()
|
marriage = m.get_date()
|
||||||
file.write('fontname="%s", label="%s"];\n' % (font,marriage))
|
file.write('fontname="%s", label="%s"];\n' % (font,marriage))
|
||||||
@ -508,8 +526,6 @@ def dump_index(person_list,file,includedates,includeurl,colorize,
|
|||||||
(arrowheadstyle, arrowtailstyle))
|
(arrowheadstyle, arrowtailstyle))
|
||||||
file.write('style=solid];\n')
|
file.write('style=solid];\n')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user