* src/Report.py: Catch thrown Database error
* src/GraphLayout.py: catch database loops * src/po/check_po: utility to look for problems in .po files svn: r5160
This commit is contained in:
parent
cbf80d0547
commit
0ff17e104b
@ -1,6 +1,9 @@
|
||||
2005-08-31 Don Allingham <don@gramps-project.org>
|
||||
* 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 <eerot@sf>
|
||||
* src/po/fi.po: Translation update for 2.0.7.
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user