* src/ChooseParents.py: fix father/mother relationship

* src/FamilyView.py: fix update of child pointers after add
* src/PeopleView.py: unselect previous entry on new goto_active_person
* src/MediaView.py: pass handle instead of GRAMPS ID during drag-n-drop


svn: r4296
This commit is contained in:
Don Allingham 2005-04-05 00:58:37 +00:00
parent 641f13da22
commit e5cd5c0e3d
4 changed files with 39 additions and 31 deletions

View File

@ -1,5 +1,8 @@
2005-04-04 Don Allingham <don@gramps-project.org> 2005-04-04 Don Allingham <don@gramps-project.org>
* src/MedaiView.py: pass handle instead of GRAMPS ID during drag-n-drop * src/ChooseParents.py: fix father/mother relationship
* src/FamilyView.py: fix update of child pointers after add
* src/PeopleView.py: unselect previous entry on new goto_active_person
* src/MediaView.py: pass handle instead of GRAMPS ID during drag-n-drop
* src/GrampsBSDDB.py: remove transaction.batch in favor of signal suppression * src/GrampsBSDDB.py: remove transaction.batch in favor of signal suppression
* src/GrampsDbBase.py: remove transaction.batch in favor of signal suppression * src/GrampsDbBase.py: remove transaction.batch in favor of signal suppression
* src/GrampsInMemDB.py: remove transaction.batch in favor of signal suppression * src/GrampsInMemDB.py: remove transaction.batch in favor of signal suppression

View File

@ -163,8 +163,6 @@ class ChooseParents:
self.glade.signal_autoconnect({ self.glade.signal_autoconnect({
"on_add_parent_clicked" : self.add_parent_clicked, "on_add_parent_clicked" : self.add_parent_clicked,
"on_prel_changed" : self.parent_relation_changed, "on_prel_changed" : self.parent_relation_changed,
#"on_showallf_toggled" : self.showallf_toggled,
#"on_showallm_toggled" : self.showallm_toggled,
"destroy_passed_object" : self.close, "destroy_passed_object" : self.close,
"on_save_parents_clicked" : self.save_parents_clicked, "on_save_parents_clicked" : self.save_parents_clicked,
"on_help_familyDialog_clicked" : self.on_help_clicked, "on_help_familyDialog_clicked" : self.on_help_clicked,
@ -287,7 +285,8 @@ class ChooseParents:
"""Called everytime the parent relationship information is changed""" """Called everytime the parent relationship information is changed"""
self.old_type = self.type self.old_type = self.type
self.type = self.prel.get_active() self.type = self.prel.get_active()
if self.old_type == RelLib.Family.CIVIL_UNION or self.type == RelLib.Family.CIVIL_UNION: if (self.old_type == RelLib.Family.CIVIL_UNION or
self.type == RelLib.Family.CIVIL_UNION):
self.redrawf() self.redrawf()
self.redrawm() self.redrawm()
@ -315,11 +314,13 @@ class ChooseParents:
for family_handle in self.db.get_family_handles(): for family_handle in self.db.get_family_handles():
family = self.db.get_family_from_handle(family_handle) family = self.db.get_family_from_handle(family_handle)
if family.get_father_handle() == father_handle and family.get_mother_handle() == mother_handle: if (family.get_father_handle() == father_handle and
family.get_mother_handle() == mother_handle):
family.add_child_handle(self.person.get_handle()) family.add_child_handle(self.person.get_handle())
self.db.commit_family(family,trans) self.db.commit_family(family,trans)
return family return family
elif family.get_father_handle() == mother_handle and family.get_mother_handle() == father_handle: elif (family.get_father_handle() == mother_handle and
family.get_mother_handle() == father_handle):
family.add_child_handle(self.person.get_handle()) family.add_child_handle(self.person.get_handle())
self.db.commit_family(family,trans) self.db.commit_family(family,trans)
return family return family
@ -379,12 +380,12 @@ class ChooseParents:
family_handle_list = self.father.get_family_handle_list() family_handle_list = self.father.get_family_handle_list()
if len(family_handle_list) >= 1: if len(family_handle_list) >= 1:
family = self.db.get_family_from_handle(family_handle_list[0]) family = self.db.get_family_from_handle(family_handle_list[0])
mother_handle = family.get_mother_handle() handle = family.get_mother_handle()
mother = self.db.get_person_from_handle(mother_handle) mother = self.db.get_person_from_handle(handle)
sname = mother.get_primary_name().get_surname() sname = mother.get_primary_name().get_surname()
tpath = self.mother_model.on_get_path(sname) tpath = self.mother_model.on_get_path(sname)
self.mother_list.expand_row(tpath,0) self.mother_list.expand_row(tpath,0)
path = self.mother_model.on_get_path(mother_handle) path = self.mother_model.on_get_path(handle)
self.mother_selection.select_path(path) self.mother_selection.select_path(path)
self.mother_list.scroll_to_cell(path,None,1,0.5,0) self.mother_list.scroll_to_cell(path,None,1,0.5,0)
@ -403,12 +404,12 @@ class ChooseParents:
family_handle_list = self.mother.get_family_handle_list() family_handle_list = self.mother.get_family_handle_list()
if len(family_handle_list) >= 1: if len(family_handle_list) >= 1:
family = self.db.get_family_from_handle(family_handle_list[0]) family = self.db.get_family_from_handle(family_handle_list[0])
father_handle = family.get_mother_handle() handle = family.get_father_handle()
father = self.db.get_person_from_handle(father_handle) father = self.db.get_person_from_handle(handle)
sname = father.get_primary_name().get_surname() sname = father.get_primary_name().get_surname()
tpath = self.father_model.on_get_path(sname) tpath = self.father_model.on_get_path(sname)
self.father_list.expand_row(tpath,0) self.father_list.expand_row(tpath,0)
path = self.father_model.on_get_path(father_handle) path = self.father_model.on_get_path(handle)
self.father_selection.select_path(path) self.father_selection.select_path(path)
self.father_list.scroll_to_cell(path,None,1,0.5,0) self.father_list.scroll_to_cell(path,None,1,0.5,0)
@ -529,10 +530,12 @@ class ChooseParents:
return return
if mother_rel != fam[1] or father_rel != fam[2]: if mother_rel != fam[1] or father_rel != fam[2]:
self.person.remove_parent_family_handle(family_handle) self.person.remove_parent_family_handle(family_handle)
self.person.add_parent_family_handle(family_handle,mother_rel,father_rel) self.person.add_parent_family_handle(family_handle,
mother_rel,father_rel)
break break
else: else:
self.person.add_parent_family_handle(family_handle,mother_rel,father_rel) self.person.add_parent_family_handle(family_handle,
mother_rel,father_rel)
trans = self.db.transaction_begin() trans = self.db.transaction_begin()
self.db.commit_person(self.person,trans) self.db.commit_person(self.person,trans)

View File

@ -768,30 +768,31 @@ class FamilyView:
self.parent.db.transaction_commit(trans,_("Modify family")) self.parent.db.transaction_commit(trans,_("Modify family"))
def new_child_after_edit(self,epo,value): def new_child_after_edit(self,epo,value):
if not self.family: family = self.family
person = self.person
new_person = epo.person
trans = self.parent.db.transaction_begin()
if not family:
# Add family to active person, # Add family to active person,
# if it does not exist yet (child with no spouse) # if it does not exist yet (child with no spouse)
trans = self.parent.db.transaction_begin() family = RelLib.Family()
self.family = RelLib.Family() self.parent.db.add_family(family,trans)
self.parent.db.add_family(self.family,trans) person.add_family_handle(family.get_handle())
self.person.add_family_handle(self.family.get_handle()) if person.get_gender() == RelLib.Person.MALE:
if self.person.get_gender() == RelLib.Person.MALE: family.set_father_handle(person.get_handle())
self.family.set_father_handle(self.person.get_handle())
else: else:
self.family.set_mother_handle(self.person.get_handle()) family.set_mother_handle(person.get_handle())
self.parent.db.commit_family(self.family,trans) self.parent.db.commit_family(family,trans)
self.parent.db.commit_person(self.person,trans) self.parent.db.commit_person(person,trans)
self.parent.db.transaction_commit(trans,_("Add Family"))
trans = self.parent.db.transaction_begin() family.add_child_handle(new_person.get_handle())
self.family.add_child_handle(epo.person.get_handle()) new_person.add_parent_family_handle(family.get_handle(),
epo.person.add_parent_family_handle(self.family.get_handle(),
RelLib.Person.CHILD_REL_BIRTH, RelLib.Person.CHILD_REL_BIRTH,
RelLib.Person.CHILD_REL_BIRTH) RelLib.Person.CHILD_REL_BIRTH)
self.parent.db.commit_person(epo.person,trans) self.parent.db.commit_person(new_person,trans)
self.parent.db.commit_family(self.family,trans) self.parent.db.commit_family(family,trans)
self.parent.db.transaction_commit(trans,_("Add Child to Family")) self.parent.db.transaction_commit(trans,_("Add Child to Family"))
self.display_marriage(self.family) self.display_marriage(family)
def select_child_clicked(self,obj): def select_child_clicked(self,obj):
if not self.person: if not self.person:

View File

@ -218,6 +218,7 @@ class PeopleView:
top_name = self.parent.db.get_name_group_mapping(group_name) top_name = self.parent.db.get_name_group_mapping(group_name)
top_path = self.person_model.on_get_path(top_name) top_path = self.person_model.on_get_path(top_name)
self.person_tree.expand_row(top_path,0) self.person_tree.expand_row(top_path,0)
self.person_selection.unselect_all()
self.person_selection.select_path(path) self.person_selection.select_path(path)
self.person_tree.scroll_to_cell(path,None,1,0.5,0) self.person_tree.scroll_to_cell(path,None,1,0.5,0)
except KeyError: except KeyError: