From 30168ace63c19054af743d4c61b8dc839ee3dc48 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 8 Jun 2005 21:17:18 +0000 Subject: [PATCH] * src/EditPerson.py: Commit events, since there may be changes made no in the editor. * src/EventEdit.py: Use combined mapping for all events. * src/FamilyView.py: Proper display of child relations. * src/Marriage.py: Commit events; properly call common event/ref editor. * src/Utils.py: Minor. svn: r4813 --- gramps2/ChangeLog | 8 ++++++++ gramps2/src/EditPerson.py | 4 ++-- gramps2/src/EventEdit.py | 14 ++++++++++++-- gramps2/src/FamilyView.py | 21 +++++++++++++++------ gramps2/src/Marriage.py | 16 +++++++++------- gramps2/src/Utils.py | 2 +- 6 files changed, 47 insertions(+), 18 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index bde3e9d35..055416214 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -21,6 +21,14 @@ * src/EditPerson.py (on_apply_person_clicked): Do not commit event, as this is done in the editor. + * src/EditPerson.py: Commit events, since there may be changes + made no in the editor. + * src/EventEdit.py: Use combined mapping for all events. + * src/FamilyView.py: Proper display of child relations. + * src/Marriage.py: Commit events; properly call common event/ref + editor. + * src/Utils.py: Minor. + 2005-06-08 Martin Hawlisch * src/EventView.py (column_names): Add missing column * src/RepositoryView.py (column_names): Add missing columns diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index f18613776..8195c6bdf 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -1039,8 +1039,8 @@ class EditPerson: self.db.commit_person(self.person, trans) n = self.person.get_primary_name().get_regular_name() - #for (event_ref,event) in self.event_box.get_changed_objects(): - # self.db.commit_event(event,trans) + for (event_ref,event) in self.event_box.get_changed_objects(): + self.db.commit_event(event,trans) self.db.transaction_commit(trans,_("Edit Person (%s)") % n) if self.callback: diff --git a/gramps2/src/EventEdit.py b/gramps2/src/EventEdit.py index 73c09d012..0eee1fdde 100644 --- a/gramps2/src/EventEdit.py +++ b/gramps2/src/EventEdit.py @@ -53,6 +53,16 @@ import ImageSelect import DateEdit from QuestionDialog import WarningDialog, ErrorDialog +#------------------------------------------------------------------------- +# +# Constants +# +#------------------------------------------------------------------------- +total_events = dict(Utils.personal_events) +for event_type in Utils.family_events.keys(): + if not total_events.has_key(event_type): + total_events[event_type] = Utils.family_events[event_type] + #------------------------------------------------------------------------- # # helper function @@ -178,7 +188,7 @@ class EventEditor: defval = None self.type_selector = AutoComp.StandardCustomSelector( - Utils.personal_events, self.event_menu, + total_events, self.event_menu, RelLib.Event.CUSTOM, defval) AutoComp.fill_entry(self.place_field,self.pmap.keys()) @@ -270,7 +280,7 @@ class EventEditor: if val == RelLib.Event.CUSTOM: label = strval else: - label = Utils.personal_events[val] + label = total_events[val] if not label.strip(): label = _("New Event") label = "%s: %s" % (_('Event'),label) diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index e21ca0034..e435fd344 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -1108,11 +1108,20 @@ class FamilyView: mother_handle = fam.get_mother_handle() f = self.parent.db.get_person_from_handle(father_handle) m = self.parent.db.get_person_from_handle(mother_handle) + if frel[0] == RelLib.Person.CHILD_CUSTOM \ + or not Utils.child_relations.has_key(frel[0]): + frel_name = frel[1] + else: + frel_name = Utils.child_relations[frel[0]] + if mrel[0] == RelLib.Person.CHILD_CUSTOM \ + or not Utils.child_relations.has_key(mrel[0]): + mrel_name = mrel[1] + else: + mrel_name = Utils.child_relations[mrel[0]] - father = self.nameof(_("Father"),f, - Utils.child_relations[frel]) - mother = self.nameof(_("Mother"),m, - Utils.child_relations[mrel]) + + father = self.nameof(_("Father"),f,frel_name) + mother = self.nameof(_("Mother"),m,mrel_name) node = model.append() if not sel: @@ -1125,11 +1134,11 @@ class FamilyView: else: selection.set_mode(gtk.SELECTION_NONE) - def nameof(self,l,p,mode): + def nameof(self,l,p,rel_name): if p: n = NameDisplay.displayer.display(p) pid = p.get_gramps_id() - return _("%s: %s [%s]\n\tRelationship: %s") % (l,n,pid,_(mode)) + return _("%s: %s [%s]\n\tRelationship: %s") % (l,n,pid,rel_name) else: return _("%s: unknown") % (l) diff --git a/gramps2/src/Marriage.py b/gramps2/src/Marriage.py index b30d327ee..10d609ddc 100644 --- a/gramps2/src/Marriage.py +++ b/gramps2/src/Marriage.py @@ -722,23 +722,25 @@ class Marriage: self.family.set_source_reference_list(self.srcreflist) self.update_lists() + + for (event_ref,event) in self.event_box.get_changed_objects(): + self.db.commit_event(event,trans) + self.db.commit_family(self.family,trans) self.db.transaction_commit(trans,_("Edit Marriage")) self.close() - def event_edit_callback(self,event): + def event_edit_callback(self,data): """Birth and death events may not be in the map""" - self.redraw_event_list() - try: - self.etree.select_iter(self.emap[str(event)]) - except: - pass + self.event_box.edit_callback(data) def on_add_clicked(self,*obj): import EventEdit + EventEdit.EventRefEditor(None,None,self.family,self.db, + self.event_box.edit_callback,self) #name = Utils.family_name(self.family,self.db) - EventEdit.EventRefEditor(None,self.family, self.db,None,self) + #EventEdit.EventRefEditor(None,self.family, self.db,None,self) #self,name, Utils.family_events, #None, None, 0, self.event_edit_callback, #RelLib.Event.MARRIAGE, self.db.readonly) diff --git a/gramps2/src/Utils.py b/gramps2/src/Utils.py index 4ad92675e..3c2be71a7 100644 --- a/gramps2/src/Utils.py +++ b/gramps2/src/Utils.py @@ -153,7 +153,7 @@ personal_attributes = { family_attributes = { RelLib.Attribute.UNKNOWN : _("Unknown"), RelLib.Attribute.CUSTOM : _("Custom"), - RelLib.Attribute.NUM_CHILD : _("Number of Children"), + RelLib.Attribute.NUM_CHILD : _("Number of Children"), } family_relations = {