Updates to use ChildRef
svn: r6335
This commit is contained in:
parent
7cd6ee2739
commit
b733444af0
@ -1,3 +1,7 @@
|
|||||||
|
2006-04-13 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
|
* src/DataViews/_PedigreeView.py: Adapt to changes in RelLib
|
||||||
|
* src/plugins/TestcaseGenerator.py: Adapt to changes in RelLib
|
||||||
|
|
||||||
2006-04-13 Don Allingham <don@gramps-project.org>
|
2006-04-13 Don Allingham <don@gramps-project.org>
|
||||||
* src/DataViews/_FamilyView.py: remove bad tab
|
* src/DataViews/_FamilyView.py: remove bad tab
|
||||||
|
|
||||||
|
@ -1117,24 +1117,28 @@ class PedigreeView(PageView.PersonNavView):
|
|||||||
|
|
||||||
parent_families = person.get_parent_family_handle_list()
|
parent_families = person.get_parent_family_handle_list()
|
||||||
if parent_families:
|
if parent_families:
|
||||||
(family_handle,m,f) = parent_families[0]
|
family_handle = parent_families[0]
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
if family_handle:
|
|
||||||
mrel = m != RelLib.ChildRef.CHILD_BIRTH
|
|
||||||
frel = f != RelLib.ChildRef.CHILD_BIRTH
|
|
||||||
|
|
||||||
|
mrel = True
|
||||||
|
frel = True
|
||||||
family = self.db.get_family_from_handle(family_handle)
|
family = self.db.get_family_from_handle(family_handle)
|
||||||
if family != None:
|
if family != None:
|
||||||
lst[index] = (person,val,family)
|
for child_ref in family.get_child_ref_list():
|
||||||
father_handle = family.get_father_handle()
|
if child_ref.ref == person.handle:
|
||||||
if father_handle != None:
|
mrel = child_ref.mrel != RelLib.ChildRef.CHILD_BIRTH
|
||||||
father = self.db.get_person_from_handle(father_handle)
|
frel = child_ref.frel != RelLib.ChildRef.CHILD_BIRTH
|
||||||
self.find_tree(father,(2*index)+1,depth+1,lst,frel)
|
|
||||||
mother_handle = family.get_mother_handle()
|
lst[index] = (person,val,family)
|
||||||
if mother_handle != None:
|
father_handle = family.get_father_handle()
|
||||||
mother = self.db.get_person_from_handle(mother_handle)
|
if father_handle != None:
|
||||||
self.find_tree(mother,(2*index)+2,depth+1,lst,mrel)
|
father = self.db.get_person_from_handle(father_handle)
|
||||||
|
self.find_tree(father,(2*index)+1,depth+1,lst,frel)
|
||||||
|
mother_handle = family.get_mother_handle()
|
||||||
|
if mother_handle != None:
|
||||||
|
mother = self.db.get_person_from_handle(mother_handle)
|
||||||
|
self.find_tree(mother,(2*index)+2,depth+1,lst,mrel)
|
||||||
|
|
||||||
def add_nav_portion_to_menu(self,menu):
|
def add_nav_portion_to_menu(self,menu):
|
||||||
"""
|
"""
|
||||||
@ -1329,10 +1333,11 @@ class PedigreeView(PageView.PersonNavView):
|
|||||||
item = gtk.MenuItem(_("Siblings"))
|
item = gtk.MenuItem(_("Siblings"))
|
||||||
pfam_list = person.get_parent_family_handle_list()
|
pfam_list = person.get_parent_family_handle_list()
|
||||||
no_siblings = 1
|
no_siblings = 1
|
||||||
for (f,mrel,frel) in pfam_list:
|
for f in pfam_list:
|
||||||
fam = self.db.get_family_from_handle(f)
|
fam = self.db.get_family_from_handle(f)
|
||||||
sib_list = fam.get_child_handle_list()
|
sib_list = fam.get_child_ref_list()
|
||||||
for sib_id in sib_list:
|
for sib_ref in sib_list:
|
||||||
|
sib_id = sib_ref.ref
|
||||||
if sib_id == person.get_handle():
|
if sib_id == person.get_handle():
|
||||||
continue
|
continue
|
||||||
sib = self.db.get_person_from_handle(sib_id)
|
sib = self.db.get_person_from_handle(sib_id)
|
||||||
@ -1501,8 +1506,8 @@ def find_children(db,p):
|
|||||||
childlist = []
|
childlist = []
|
||||||
for family_handle in p.get_family_handle_list():
|
for family_handle in p.get_family_handle_list():
|
||||||
family = db.get_family_from_handle(family_handle)
|
family = db.get_family_from_handle(family_handle)
|
||||||
for child_handle in family.get_child_handle_list():
|
for child_ref in family.get_child_ref_list():
|
||||||
childlist.append(child_handle)
|
childlist.append(child_ref.ref)
|
||||||
return childlist
|
return childlist
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -1515,7 +1520,7 @@ def find_parents(db,p):
|
|||||||
Returns the unique list of all parents' IDs for a person.
|
Returns the unique list of all parents' IDs for a person.
|
||||||
"""
|
"""
|
||||||
parentlist = []
|
parentlist = []
|
||||||
for (f,mrel,frel) in p.get_parent_family_handle_list():
|
for f in p.get_parent_family_handle_list():
|
||||||
family = db.get_family_from_handle(f)
|
family = db.get_family_from_handle(f)
|
||||||
father_handle = family.get_father_handle()
|
father_handle = family.get_father_handle()
|
||||||
mother_handle = family.get_mother_handle()
|
mother_handle = family.get_mother_handle()
|
||||||
|
@ -818,12 +818,13 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
np.set_birth_ref(eref)
|
np.set_birth_ref(eref)
|
||||||
|
|
||||||
# some shared events
|
# some shared events
|
||||||
while randint(0,5) == 1:
|
if self.generated_events:
|
||||||
e_h = choice(self.generated_events)
|
while randint(0,5) == 1:
|
||||||
ref = RelLib.EventRef()
|
e_h = choice(self.generated_events)
|
||||||
self.fill_object( ref)
|
ref = RelLib.EventRef()
|
||||||
ref.set_reference_handle(e_h)
|
self.fill_object( ref)
|
||||||
ref.set_role( self.rand_type(Utils.event_roles))
|
ref.set_reference_handle(e_h)
|
||||||
|
ref.set_role( self.rand_type(Utils.event_roles))
|
||||||
|
|
||||||
person_handle = self.db.add_person(np,self.trans)
|
person_handle = self.db.add_person(np,self.trans)
|
||||||
|
|
||||||
@ -898,16 +899,13 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
(born,died) = self.person_dates[child_h]
|
(born,died) = self.person_dates[child_h]
|
||||||
alive_in_year = born
|
alive_in_year = born
|
||||||
fam = self.db.get_family_from_handle(fam_h)
|
fam = self.db.get_family_from_handle(fam_h)
|
||||||
fam.add_child_handle(child_h)
|
child_ref = RelLib.ChildRef()
|
||||||
|
child_ref.set_reference_handle(child_h)
|
||||||
|
self.fill_object(child_ref)
|
||||||
|
fam.add_child_ref(child_ref)
|
||||||
self.db.commit_family(fam,self.trans)
|
self.db.commit_family(fam,self.trans)
|
||||||
child = self.db.get_person_from_handle(child_h)
|
child = self.db.get_person_from_handle(child_h)
|
||||||
rel1 = (RelLib.ChildRef.CHILD_BIRTH,'')
|
child.add_parent_family_handle(fam_h)
|
||||||
if randint(0,2) == 1:
|
|
||||||
rel1 = self.rand_type(Utils.child_relations)
|
|
||||||
rel2 = (RelLib.ChildRef.CHILD_BIRTH,'')
|
|
||||||
if randint(0,2) == 1:
|
|
||||||
rel2 = self.rand_type(Utils.child_relations)
|
|
||||||
child.add_parent_family_handle(fam_h, rel1, rel2)
|
|
||||||
self.db.commit_person(child,self.trans)
|
self.db.commit_person(child,self.trans)
|
||||||
if randint(0,3) > 0:
|
if randint(0,3) > 0:
|
||||||
self.persons_todo.append(child_h)
|
self.persons_todo.append(child_h)
|
||||||
@ -942,7 +940,10 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
fam.set_relationship( self.rand_type(Utils.family_relations))
|
fam.set_relationship( self.rand_type(Utils.family_relations))
|
||||||
else:
|
else:
|
||||||
fam.set_relationship( (RelLib.Family.MARRIED,'') )
|
fam.set_relationship( (RelLib.Family.MARRIED,'') )
|
||||||
fam.add_child_handle(child_h)
|
child_ref = RelLib.ChildRef()
|
||||||
|
child_ref.set_reference_handle(child_h)
|
||||||
|
self.fill_object(child_ref)
|
||||||
|
fam.add_child_ref(child_ref)
|
||||||
fam_h = self.db.add_family(fam,self.trans)
|
fam_h = self.db.add_family(fam,self.trans)
|
||||||
self.generated_families.append(fam_h)
|
self.generated_families.append(fam_h)
|
||||||
fam = self.db.commit_family(fam,self.trans)
|
fam = self.db.commit_family(fam,self.trans)
|
||||||
@ -952,13 +953,7 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
person2 = self.db.get_person_from_handle(person2_h)
|
person2 = self.db.get_person_from_handle(person2_h)
|
||||||
person2.add_family_handle(fam_h)
|
person2.add_family_handle(fam_h)
|
||||||
self.db.commit_person(person2,self.trans)
|
self.db.commit_person(person2,self.trans)
|
||||||
rel1 = (RelLib.ChildRef.CHILD_BIRTH,'')
|
child.add_parent_family_handle(fam_h)
|
||||||
if randint(0,2) == 1:
|
|
||||||
rel1 = self.rand_type(Utils.child_relations)
|
|
||||||
rel2 = (RelLib.ChildRef.CHILD_BIRTH,'')
|
|
||||||
if randint(0,2) == 1:
|
|
||||||
rel2 = self.rand_type(Utils.child_relations)
|
|
||||||
child.add_parent_family_handle(fam_h, rel1, rel2)
|
|
||||||
self.db.commit_person(child,self.trans)
|
self.db.commit_person(child,self.trans)
|
||||||
self.commit_transaction() # COMMIT TRANSACTION STEP
|
self.commit_transaction() # COMMIT TRANSACTION STEP
|
||||||
|
|
||||||
@ -1053,6 +1048,12 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
self.fill_object(a)
|
self.fill_object(a)
|
||||||
o.add_attribute( a)
|
o.add_attribute( a)
|
||||||
|
|
||||||
|
if isinstance(o,RelLib.ChildRef):
|
||||||
|
if randint(0,3) == 1:
|
||||||
|
o.set_mother_relation( self.rand_type( Utils.child_relations))
|
||||||
|
if randint(0,3) == 1:
|
||||||
|
o.set_father_relation( self.rand_type( Utils.child_relations))
|
||||||
|
|
||||||
if issubclass(o.__class__,RelLib._DateBase.DateBase):
|
if issubclass(o.__class__,RelLib._DateBase.DateBase):
|
||||||
if randint(0,1) == 1:
|
if randint(0,1) == 1:
|
||||||
(y,d) = self.rand_date()
|
(y,d) = self.rand_date()
|
||||||
@ -1162,7 +1163,7 @@ class TestcaseGenerator(Tool.Tool):
|
|||||||
self.fill_object(r)
|
self.fill_object(r)
|
||||||
o.add_repo_reference( r)
|
o.add_repo_reference( r)
|
||||||
|
|
||||||
if issubclass(o.__class__,RelLib._SourceNote.SourceNote):
|
if issubclass(o.__class__,RelLib._SourceBase.SourceBase):
|
||||||
while randint(0,1) == 1:
|
while randint(0,1) == 1:
|
||||||
s = RelLib.SourceRef()
|
s = RelLib.SourceRef()
|
||||||
self.fill_object(s)
|
self.fill_object(s)
|
||||||
|
Loading…
Reference in New Issue
Block a user