diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 604317a91..b14ac77e6 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2006-04-15 Don Allingham + * src/DisplayTabs.py: handle child type callback + * src/Editors/_EditFamily.py: handle child type callback + 2006-04-14 Alex Roitman * src/DisplayTabs.py (edit_button_clicked): Proceed only if selection exists. diff --git a/gramps2/src/DisplayTabs.py b/gramps2/src/DisplayTabs.py index a92952cc1..27272f018 100644 --- a/gramps2/src/DisplayTabs.py +++ b/gramps2/src/DisplayTabs.py @@ -1869,32 +1869,27 @@ class ChildModel(gtk.ListStore): index = 1 for child_ref in self.get_data(): child = db.get_person_from_handle(child_ref.ref) - self.append(row=[index, - child.get_gramps_id(), - NameDisplay.displayer.display(child), - Utils.gender[child.get_gender()], - self.column_father_rel(child_ref), - self.column_mother_rel(child_ref), - self.column_birth_day(child), - self.column_death_day(child), - self.column_birth_place(child), - self.column_death_place(child), - child.get_handle(), - NameDisplay.displayer.sort_string(child.primary_name), - self.column_birth_sort(child), - self.column_death_sort(child), - ]) + self.append(row=[ + index, + child.get_gramps_id(), + NameDisplay.displayer.display(child), + Utils.gender[child.get_gender()], + str(child_ref.get_father_relation()), + str(child_ref.get_mother_relation()), + self.column_birth_day(child), + self.column_death_day(child), + self.column_birth_place(child), + self.column_death_place(child), + child.get_handle(), + NameDisplay.displayer.sort_string(child.primary_name), + self.column_birth_sort(child), + self.column_death_sort(child), + ]) index += 1 def get_data(self): return self.family.get_child_ref_list() - def column_father_rel(self, data): - return str(data.get_father_relation()) - - def column_mother_rel(self, data): - return str(data.get_mother_relation()) - def column_birth_day(self, data): event_ref = data.get_birth_ref() if event_ref and event_ref.ref: diff --git a/gramps2/src/Editors/_EditFamily.py b/gramps2/src/Editors/_EditFamily.py index 8a11a692d..b4bb84c7f 100644 --- a/gramps2/src/Editors/_EditFamily.py +++ b/gramps2/src/Editors/_EditFamily.py @@ -185,15 +185,18 @@ class ChildEmbedList(EmbeddedList): return len(self.family.get_child_ref_list()) == 0 def mrel_edited(self, renderer, index, value): - ref = self.family.get_child_ref_list()[int(index)] - new_type = RelLib.ChildRefType(value) - print "Before", str(new_type) - ref.set_mother_relation(new_type) - print "After", str(ref.get_mother_relation()) + row = int(index) + ref = self.family.get_child_ref_list()[row] + ref.set_mother_relation(RelLib.ChildRefType(value)) + node = self.model.get_iter((row,)) + self.model.set_value(node, 5, value) def frel_edited(self, renderer, index, value): - ref = self.family.get_child_ref_list()[int(index)] + row = int(index) + ref = self.family.get_child_ref_list()[row] ref.set_father_relation(RelLib.ChildRefType(value)) + node = self.model.get_iter((row,)) + self.model.set_value(node, 4, value) def get_data(self): """ @@ -856,19 +859,15 @@ class EditFamily(EditPrimary): new_set = set(self.obj.get_child_ref_list()) # remove the family from children which have been removed - for handle in orig_set.difference(new_set): - person = self.db.get_person_from_handle(handle) + for ref in orig_set.difference(new_set): + person = self.db.get_person_from_handle(ref.ref) person.remove_parent_family_handle(self.obj.handle) self.db.commit_person(person,trans) # add the family from children which have been addedna - for handle in new_set.difference(orig_set): - person = self.db.get_person_from_handle(handle) - person.add_parent_family_handle( - self.obj.handle, - RelLib.ChildRefType(), - RelLib.ChildRefType(), - ) + for ref in new_set.difference(orig_set): + person = self.db.get_person_from_handle(ref.ref) + person.add_parent_family_handle(self.obj.handle) self.db.commit_person(person,trans) if self.object_is_empty():