diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 517128467..c5d512c19 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,6 +1,9 @@ 2005-08-31 Don Allingham + * src/Report.py: Catch thrown Database error + * src/GraphLayout.py: catch database loops * src/po/de.po: fix %()s mismatches * src/po/ru.po: fix %()s mismatches + * src/po/check_po: utility to look for problems in .po files 2005-08-31 Eero Tamminen * src/po/fi.po: Translation update for 2.0.7. diff --git a/gramps2/src/GraphLayout.py b/gramps2/src/GraphLayout.py index 24bf55725..2791e18b8 100644 --- a/gramps2/src/GraphLayout.py +++ b/gramps2/src/GraphLayout.py @@ -20,6 +20,11 @@ # $Id$ + +import sets +import Errors +import NameDisplay + class GraphLayout: def __init__(self,database,plist,person_handle): @@ -44,7 +49,18 @@ class DescendLine(GraphLayout): self.space_for(self.person_handle) return (self.v,self.e[1:]) - def space_for(self,person_handle,level=1.0,pos=1.0): + def space_for(self,person_handle,level=1.0,pos=1.0, current=None): + if current == None: + current = sets.Set() + + person = self.database.get_person_from_handle(person_handle) + + if person_handle not in current: + current.add(person_handle) + else: + raise Errors.DatabaseError(_("Database error: %s is defined as his or her own ancestor") % + NameDisplay.displayer.display(person)) + last = self.elist[-1] self.elist.append((level,pos)) self.e.append((last[0],last[1],level,pos)) @@ -54,11 +70,10 @@ class DescendLine(GraphLayout): if pos > self.maxy: self.maxy = pos - person = self.database.get_person_from_handle(person_handle) for family_handle in person.get_family_handle_list(): family = self.database.get_family_from_handle(family_handle) for child_handle in family.get_child_handle_list(): - self.space_for(child_handle,level+1.0,pos) + self.space_for(child_handle,level+1.0,pos,current) pos = pos + max(self.depth(child_handle),1) if pos > self.maxy: self.maxy = pos diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index c3e7a0930..20c61e8dc 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -1804,6 +1804,8 @@ def report(database,person,report_class,options_class,translated_name,name,categ except Errors.ReportError, msg: (m1,m2) = msg.messages() ErrorDialog(m1,m2) + except Errors.DatabaseError,msg: + ErrorDialog(_("Report could not be created"),str(msg)) except: import DisplayTrace DisplayTrace.DisplayTrace()