From 5f2138f7e28150b35fef1a4f981c4d6c2d970d28 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 7 Oct 2004 17:48:29 +0000 Subject: [PATCH] * src/NameEdit.py: integrate patches from Julio Sanchez to fix surname prefix * src/FamilyView.py: Handle add person post processing properly svn: r3604 --- gramps2/ChangeLog | 5 +++++ gramps2/src/FamilyView.py | 25 +++++++++++++------------ gramps2/src/NameEdit.py | 10 +++++++++- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index e9784522d..e157a9a49 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2004-10-07 Don Allingham + * src/NameEdit.py: integrate patches from Julio Sanchez to + fix surname prefix + * src/FamilyView.py: Handle add person post processing properly + 2004-10-07 Alex Roitman * src/EventEdit.py (update_event): Typo. diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index 032d5224f..33ef6d015 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -624,21 +624,23 @@ class FamilyView: except: DisplayTrace.DisplayTrace() - def spouse_after_edit(self,epo,trans): + def spouse_after_edit(self,epo,val): ap = self.parent.active_person if epo: - self.parent.db.commit_person(epo.person,trans) - n = epo.person.get_primary_name().get_regular_name() - self.parent.db.transaction_commit(trans,_("Add Person (%s)") % n) + #trans = self.parent.db.transaction_begin() + #self.parent.db.commit_person(epo.person,trans) + #n = epo.person.get_primary_name().get_regular_name() + #self.parent.db.transaction_commit(trans,_("Add Spouse (%s)") % n) self.parent.people_view.remove_from_person_list(epo.person) self.parent.people_view.redisplay_person_list(epo.person) self.parent.active_person = ap self.load_family(self.family) - def new_spouse_after_edit(self,epo,trans): + def new_spouse_after_edit(self,epo,val): - self.parent.db.add_person(epo.person,trans) + #self.parent.db.add_person(epo.person,trans) + trans = self.parent.db.transaction_begin() self.family = RelLib.Family() self.parent.db.add_family(self.family,trans) @@ -658,7 +660,8 @@ class FamilyView: self.parent.db.commit_family(self.family,trans) self.load_family(self.family) - + + self.parent.db.transaction_commit(trans,_("Add Spouse")) m = Marriage.Marriage(self.parent,self.family,self.parent.db, self.parent.new_after_edit, self.load_family) @@ -708,11 +711,8 @@ class FamilyView: self.parent.db.commit_family(self.family,trans) self.parent.db.transaction_commit(trans,_("Modify family")) - def new_child_after_edit(self,epo,trans): - - self.parent.db.add_person(epo.person,trans) - self.parent.people_view.add_to_person_list(epo.person,0) - + def new_child_after_edit(self,epo,value): + trans = self.parent.db.transaction_begin() if not self.family: self.family = RelLib.Family() self.parent.db.add_family(self.family,trans) @@ -726,6 +726,7 @@ class FamilyView: epo.person.add_parent_family_handle(self.family.get_handle(),"Birth","Birth") self.parent.db.commit_person(epo.person,trans) self.parent.db.commit_family(self.family,trans) + self.parent.db.transaction_commit(trans,_("Add Child to Family")) self.display_marriage(self.family) def select_child_clicked(self,obj): diff --git a/gramps2/src/NameEdit.py b/gramps2/src/NameEdit.py index 968c48221..34d5a54c4 100644 --- a/gramps2/src/NameEdit.py +++ b/gramps2/src/NameEdit.py @@ -74,6 +74,7 @@ class NameEditor: AutoComp.fill_combo(self.combo,self.parent.db.get_surname_list()) self.surname_field = self.combo.get_child() + self.prefix_field = self.top.get_widget("alt_prefix") self.type_combo = self.top.get_widget("name_type") self.note_field = self.top.get_widget("alt_note") @@ -128,6 +129,7 @@ class NameEditor: self.surname_field.set_text(name.get_surname()) self.title_field.set_text(name.get_title()) self.suffix_field.set_text(name.get_suffix()) + self.prefix_field.set_text(name.get_surname_prefix()) self.type_field.set_text(_(name.get_type())) self.priv.set_active(name.get_privacy()) if name.get_note(): @@ -221,6 +223,7 @@ class NameEditor: first = unicode(self.given_field.get_text()) last = unicode(self.surname_field.get_text()) title = unicode(self.title_field.get_text()) + prefix = unicode(self.prefix_field.get_text()) suffix = unicode(self.suffix_field.get_text()) note = unicode(self.note_buffer.get_text(self.note_buffer.get_start_iter(), self.note_buffer.get_end_iter(),gtk.FALSE)) @@ -246,7 +249,12 @@ class NameEditor: if self.name.get_display_as() != self.display_as.get_active(): self.name.set_display_as(self.display_as.get_active()) self.parent.lists_changed = 1 - + + prefix = unicode(self.prefix_field.get_text()) + if self.name.get_surname_prefix() != prefix: + self.name.set_surname_prefix(prefix) + self.parent.lists_changed = 1 + if self.name.get_sort_as() != self.sort_as.get_active(): self.name.set_sort_as(self.sort_as.get_active()) self.parent.lists_changed = 1