diff --git a/ChangeLog b/ChangeLog index 8d78da871..ebe4f6698 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-04-13 Don Allingham + * 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 * src/DataViews/_PedigreeView.py: Adapt to changes in RelLib * src/plugins/TestcaseGenerator.py: Adapt to changes in RelLib diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index 13b1e4a6e..682536674 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -1232,8 +1232,8 @@ class PersonRefEmbedList(EmbeddedList): except Errors.WindowActiveError: pass - def add_callback(self, name): - self.get_data().append(name) + def add_callback(self, obj): + self.get_data().append(obj) self.rebuild() def edit_button_clicked(self, obj): @@ -1247,10 +1247,9 @@ class PersonRefEmbedList(EmbeddedList): except Errors.WindowActiveError: pass - def edit_callback(self, name): + def edit_callback(self, obj): self.rebuild() - #------------------------------------------------------------------------- # # @@ -1869,7 +1868,6 @@ class ChildModel(gtk.ListStore): self.db = db index = 1 for child_ref in self.get_data(): - print child_ref, child_ref.ref child = db.get_person_from_handle(child_ref.ref) self.append(row=[index, child.get_gramps_id(), diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index 85bdaeac1..d742f110b 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -493,10 +493,10 @@ class EditFamily(EditPrimary): GalleryTab(self.dbstate, self.uistate, self.track, self.obj.get_media_list())) - self.pref_list = self._add_tab( - notebook, - PersonRefEmbedList(self.dbstate, self.uistate, self.track, - self.obj.child_ref_list)) +# self.pref_list = self._add_tab( +# notebook, +# PersonRefEmbedList(self.dbstate, self.uistate, self.track, +# self.obj.child_ref_list)) self.lds_list = self._add_tab( notebook, diff --git a/src/Editors/_EditPersonRef.py b/src/Editors/_EditPersonRef.py index 7a8ec7bb3..1324948d9 100644 --- a/src/Editors/_EditPersonRef.py +++ b/src/Editors/_EditPersonRef.py @@ -78,6 +78,10 @@ class EditPersonRef(EditSecondary): 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.top.get_widget("relationship"), self.obj.set_relation, @@ -135,8 +139,6 @@ class EditPersonRef(EditSecondary): form and updates the Address data structure. """ - print self, self.obj, self.obj.ref - if self.obj.ref: if self.callback: self.callback(self.obj) diff --git a/src/GrampsDb/_WriteXML.py b/src/GrampsDb/_WriteXML.py index bf02db837..ec7b15d02 100644 --- a/src/GrampsDb/_WriteXML.py +++ b/src/GrampsDb/_WriteXML.py @@ -413,19 +413,29 @@ class XmlWriter: self.write_attribute_list(person.get_attribute_list()) self.write_url_list(person.get_url_list(),index+1) - for alt in person.get_parent_family_handle_list(): - if alt[1][0] != RelLib.ChildRef.CHILD_BIRTH: + for family_handle in person.get_parent_family_handle_list(): + + 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( - _ConstXML.child_relations,alt[1]) + _ConstXML.child_relations,mval) else: mrel='' - if alt[2][0] != RelLib.ChildRef.CHILD_BIRTH: + if fval[0] != RelLib.ChildRef.CHILD_BIRTH: frel=' frel="%s"' % _ConstXML.str_for_xml( - _ConstXML.child_relations,alt[2]) + _ConstXML.child_relations,fval) else: frel='' self.g.write(' %s\n' % \ - (sp,alt[0], mrel, frel)) + (sp,family_handle, mrel, frel)) for family_handle in person.get_family_handle_list(): self.write_ref("parentin",family_handle,index+1) @@ -451,9 +461,9 @@ class XmlWriter: self.write_media_list(family.get_media_list(),index+1) - if len(family.get_child_handle_list()) > 0: - for person_handle in family.get_child_handle_list(): - self.write_ref("child",person_handle,index+1) + if len(family.get_child_ref_list()) > 0: + for child_ref in family.get_child_ref_list(): + self.write_ref("child",child_ref.ref,index+1) self.write_attribute_list(family.get_attribute_list()) self.write_note("note",family.get_note_object(),index+1) for s in family.get_source_references(): diff --git a/src/plugins/Check.py b/src/plugins/Check.py index 5b698fc35..9158cfd87 100644 --- a/src/plugins/Check.py +++ b/src/plugins/Check.py @@ -288,7 +288,8 @@ class CheckIntegrity: self.broken_parent_links.append((mother_handle,family_handle)) mother.add_family_handle(family_handle) 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) if child: if family_handle == child.get_main_parents_family_handle(): @@ -298,12 +299,12 @@ class CheckIntegrity: break else: # 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.broken_links.append((child_handle,family_handle)) else: # 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.broken_links.append((child_handle,family_handle)) self.progress.step() @@ -317,7 +318,7 @@ class CheckIntegrity: person.remove_parent_family_handle(family_type[0]) self.db.commit_person(person,self.trans) 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: break else: @@ -456,14 +457,14 @@ class CheckIntegrity: self.empty_family.append(family_handle) self.delete_empty_family(family_handle) 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.remove_family_handle(family_handle) self.db.commit_person(person,self.trans) self.db.remove_family(family_handle,self.trans) self.empty_family.append(family_handle) 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.remove_family_handle(family_handle) self.db.commit_person(person,self.trans)