Fix family/child refs
svn: r6337
This commit is contained in:
parent
db27730b91
commit
deaca6ea3c
@ -1,3 +1,10 @@
|
|||||||
|
2006-04-13 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/GrampsDb/_WriteXML.py: write old style XML.
|
||||||
|
* src/Editors/_EditPersonRef.py: display person correctly in label
|
||||||
|
* src/Editors/_EditFamily.py: comment out unused tab
|
||||||
|
* src/plugins/Check.py: get working with childrefs
|
||||||
|
* src/DisplayTabs.py: remove debug
|
||||||
|
|
||||||
2006-04-13 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
2006-04-13 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
* src/DataViews/_PedigreeView.py: Adapt to changes in RelLib
|
* src/DataViews/_PedigreeView.py: Adapt to changes in RelLib
|
||||||
* src/plugins/TestcaseGenerator.py: Adapt to changes in RelLib
|
* src/plugins/TestcaseGenerator.py: Adapt to changes in RelLib
|
||||||
|
@ -1232,8 +1232,8 @@ class PersonRefEmbedList(EmbeddedList):
|
|||||||
except Errors.WindowActiveError:
|
except Errors.WindowActiveError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def add_callback(self, name):
|
def add_callback(self, obj):
|
||||||
self.get_data().append(name)
|
self.get_data().append(obj)
|
||||||
self.rebuild()
|
self.rebuild()
|
||||||
|
|
||||||
def edit_button_clicked(self, obj):
|
def edit_button_clicked(self, obj):
|
||||||
@ -1247,10 +1247,9 @@ class PersonRefEmbedList(EmbeddedList):
|
|||||||
except Errors.WindowActiveError:
|
except Errors.WindowActiveError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def edit_callback(self, name):
|
def edit_callback(self, obj):
|
||||||
self.rebuild()
|
self.rebuild()
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -1869,7 +1868,6 @@ class ChildModel(gtk.ListStore):
|
|||||||
self.db = db
|
self.db = db
|
||||||
index = 1
|
index = 1
|
||||||
for child_ref in self.get_data():
|
for child_ref in self.get_data():
|
||||||
print child_ref, child_ref.ref
|
|
||||||
child = db.get_person_from_handle(child_ref.ref)
|
child = db.get_person_from_handle(child_ref.ref)
|
||||||
self.append(row=[index,
|
self.append(row=[index,
|
||||||
child.get_gramps_id(),
|
child.get_gramps_id(),
|
||||||
|
@ -493,10 +493,10 @@ class EditFamily(EditPrimary):
|
|||||||
GalleryTab(self.dbstate, self.uistate, self.track,
|
GalleryTab(self.dbstate, self.uistate, self.track,
|
||||||
self.obj.get_media_list()))
|
self.obj.get_media_list()))
|
||||||
|
|
||||||
self.pref_list = self._add_tab(
|
# self.pref_list = self._add_tab(
|
||||||
notebook,
|
# notebook,
|
||||||
PersonRefEmbedList(self.dbstate, self.uistate, self.track,
|
# PersonRefEmbedList(self.dbstate, self.uistate, self.track,
|
||||||
self.obj.child_ref_list))
|
# self.obj.child_ref_list))
|
||||||
|
|
||||||
self.lds_list = self._add_tab(
|
self.lds_list = self._add_tab(
|
||||||
notebook,
|
notebook,
|
||||||
|
@ -78,6 +78,10 @@ class EditPersonRef(EditSecondary):
|
|||||||
|
|
||||||
def _setup_fields(self):
|
def _setup_fields(self):
|
||||||
|
|
||||||
|
if self.obj.ref:
|
||||||
|
p = self.dbstate.db.get_person_from_handle(self.obj.ref)
|
||||||
|
self.person_label.set_text(NameDisplay.displayer.display(p))
|
||||||
|
|
||||||
self.street = MonitoredEntry(
|
self.street = MonitoredEntry(
|
||||||
self.top.get_widget("relationship"),
|
self.top.get_widget("relationship"),
|
||||||
self.obj.set_relation,
|
self.obj.set_relation,
|
||||||
@ -135,8 +139,6 @@ class EditPersonRef(EditSecondary):
|
|||||||
form and updates the Address data structure.
|
form and updates the Address data structure.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
print self, self.obj, self.obj.ref
|
|
||||||
|
|
||||||
if self.obj.ref:
|
if self.obj.ref:
|
||||||
if self.callback:
|
if self.callback:
|
||||||
self.callback(self.obj)
|
self.callback(self.obj)
|
||||||
|
@ -413,19 +413,29 @@ class XmlWriter:
|
|||||||
self.write_attribute_list(person.get_attribute_list())
|
self.write_attribute_list(person.get_attribute_list())
|
||||||
self.write_url_list(person.get_url_list(),index+1)
|
self.write_url_list(person.get_url_list(),index+1)
|
||||||
|
|
||||||
for alt in person.get_parent_family_handle_list():
|
for family_handle in person.get_parent_family_handle_list():
|
||||||
if alt[1][0] != RelLib.ChildRef.CHILD_BIRTH:
|
|
||||||
|
family = self.db.get_family_from_handle(family_handle)
|
||||||
|
for child_ref in family.get_child_ref_list():
|
||||||
|
if child_ref.ref == person.handle:
|
||||||
|
mval = child_ref.get_mother_relation()
|
||||||
|
fval = child_ref.get_father_relation()
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if mval[0] != RelLib.ChildRef.CHILD_BIRTH:
|
||||||
mrel=' mrel="%s"' % _ConstXML.str_for_xml(
|
mrel=' mrel="%s"' % _ConstXML.str_for_xml(
|
||||||
_ConstXML.child_relations,alt[1])
|
_ConstXML.child_relations,mval)
|
||||||
else:
|
else:
|
||||||
mrel=''
|
mrel=''
|
||||||
if alt[2][0] != RelLib.ChildRef.CHILD_BIRTH:
|
if fval[0] != RelLib.ChildRef.CHILD_BIRTH:
|
||||||
frel=' frel="%s"' % _ConstXML.str_for_xml(
|
frel=' frel="%s"' % _ConstXML.str_for_xml(
|
||||||
_ConstXML.child_relations,alt[2])
|
_ConstXML.child_relations,fval)
|
||||||
else:
|
else:
|
||||||
frel=''
|
frel=''
|
||||||
self.g.write(' %s<childof hlink="_%s"%s%s/>\n' % \
|
self.g.write(' %s<childof hlink="_%s"%s%s/>\n' % \
|
||||||
(sp,alt[0], mrel, frel))
|
(sp,family_handle, mrel, frel))
|
||||||
|
|
||||||
for family_handle in person.get_family_handle_list():
|
for family_handle in person.get_family_handle_list():
|
||||||
self.write_ref("parentin",family_handle,index+1)
|
self.write_ref("parentin",family_handle,index+1)
|
||||||
@ -451,9 +461,9 @@ class XmlWriter:
|
|||||||
|
|
||||||
self.write_media_list(family.get_media_list(),index+1)
|
self.write_media_list(family.get_media_list(),index+1)
|
||||||
|
|
||||||
if len(family.get_child_handle_list()) > 0:
|
if len(family.get_child_ref_list()) > 0:
|
||||||
for person_handle in family.get_child_handle_list():
|
for child_ref in family.get_child_ref_list():
|
||||||
self.write_ref("child",person_handle,index+1)
|
self.write_ref("child",child_ref.ref,index+1)
|
||||||
self.write_attribute_list(family.get_attribute_list())
|
self.write_attribute_list(family.get_attribute_list())
|
||||||
self.write_note("note",family.get_note_object(),index+1)
|
self.write_note("note",family.get_note_object(),index+1)
|
||||||
for s in family.get_source_references():
|
for s in family.get_source_references():
|
||||||
|
@ -288,7 +288,8 @@ class CheckIntegrity:
|
|||||||
self.broken_parent_links.append((mother_handle,family_handle))
|
self.broken_parent_links.append((mother_handle,family_handle))
|
||||||
mother.add_family_handle(family_handle)
|
mother.add_family_handle(family_handle)
|
||||||
self.db.commit_person(mother,self.trans)
|
self.db.commit_person(mother,self.trans)
|
||||||
for child_handle in family.get_child_handle_list():
|
for child_ref in family.get_child_ref_list():
|
||||||
|
child_handle = child_ref.ref
|
||||||
child = self.db.get_person_from_handle(child_handle)
|
child = self.db.get_person_from_handle(child_handle)
|
||||||
if child:
|
if child:
|
||||||
if family_handle == child.get_main_parents_family_handle():
|
if family_handle == child.get_main_parents_family_handle():
|
||||||
@ -298,12 +299,12 @@ class CheckIntegrity:
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# The referenced child has no reference back to the family
|
# The referenced child has no reference back to the family
|
||||||
family.remove_child_handle(child_handle)
|
family.remove_child_ref(child_ref)
|
||||||
self.db.commit_family(family,self.trans)
|
self.db.commit_family(family,self.trans)
|
||||||
self.broken_links.append((child_handle,family_handle))
|
self.broken_links.append((child_handle,family_handle))
|
||||||
else:
|
else:
|
||||||
# The person referenced by the child handle does not exist in the database
|
# The person referenced by the child handle does not exist in the database
|
||||||
family.remove_child_handle(child_handle)
|
family.remove_child_ref(child_ref)
|
||||||
self.db.commit_family(family,self.trans)
|
self.db.commit_family(family,self.trans)
|
||||||
self.broken_links.append((child_handle,family_handle))
|
self.broken_links.append((child_handle,family_handle))
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -317,7 +318,7 @@ class CheckIntegrity:
|
|||||||
person.remove_parent_family_handle(family_type[0])
|
person.remove_parent_family_handle(family_type[0])
|
||||||
self.db.commit_person(person,self.trans)
|
self.db.commit_person(person,self.trans)
|
||||||
continue
|
continue
|
||||||
for child_handle in family.get_child_handle_list():
|
for child_handle in [x.ref for x in family.get_child_ref_list()]:
|
||||||
if child_handle == person_handle:
|
if child_handle == person_handle:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
@ -456,14 +457,14 @@ class CheckIntegrity:
|
|||||||
self.empty_family.append(family_handle)
|
self.empty_family.append(family_handle)
|
||||||
self.delete_empty_family(family_handle)
|
self.delete_empty_family(family_handle)
|
||||||
continue
|
continue
|
||||||
elif not father_handle and len(family.get_child_handle_list()) == 0:
|
elif not father_handle and len(family.get_child_ref_list()) == 0:
|
||||||
person = self.db.get_person_from_handle(mother_handle)
|
person = self.db.get_person_from_handle(mother_handle)
|
||||||
person.remove_family_handle(family_handle)
|
person.remove_family_handle(family_handle)
|
||||||
self.db.commit_person(person,self.trans)
|
self.db.commit_person(person,self.trans)
|
||||||
self.db.remove_family(family_handle,self.trans)
|
self.db.remove_family(family_handle,self.trans)
|
||||||
self.empty_family.append(family_handle)
|
self.empty_family.append(family_handle)
|
||||||
continue
|
continue
|
||||||
elif not mother_handle and len(family.get_child_handle_list()) == 0:
|
elif not mother_handle and len(family.get_child_ref_list()) == 0:
|
||||||
person = self.db.get_person_from_handle(father_handle)
|
person = self.db.get_person_from_handle(father_handle)
|
||||||
person.remove_family_handle(family_handle)
|
person.remove_family_handle(family_handle)
|
||||||
self.db.commit_person(person,self.trans)
|
self.db.commit_person(person,self.trans)
|
||||||
|
Loading…
Reference in New Issue
Block a user