* 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
This commit is contained in:
Alex Roitman 2005-06-08 21:17:18 +00:00
parent 7f76c26a59
commit 30168ace63
6 changed files with 47 additions and 18 deletions

View File

@ -21,6 +21,14 @@
* src/EditPerson.py (on_apply_person_clicked): Do not commit * src/EditPerson.py (on_apply_person_clicked): Do not commit
event, as this is done in the editor. 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 <Martin.Hawlisch@gmx.de> 2005-06-08 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/EventView.py (column_names): Add missing column * src/EventView.py (column_names): Add missing column
* src/RepositoryView.py (column_names): Add missing columns * src/RepositoryView.py (column_names): Add missing columns

View File

@ -1039,8 +1039,8 @@ class EditPerson:
self.db.commit_person(self.person, trans) self.db.commit_person(self.person, trans)
n = self.person.get_primary_name().get_regular_name() n = self.person.get_primary_name().get_regular_name()
#for (event_ref,event) in self.event_box.get_changed_objects(): for (event_ref,event) in self.event_box.get_changed_objects():
# self.db.commit_event(event,trans) self.db.commit_event(event,trans)
self.db.transaction_commit(trans,_("Edit Person (%s)") % n) self.db.transaction_commit(trans,_("Edit Person (%s)") % n)
if self.callback: if self.callback:

View File

@ -53,6 +53,16 @@ import ImageSelect
import DateEdit import DateEdit
from QuestionDialog import WarningDialog, ErrorDialog 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 # helper function
@ -178,7 +188,7 @@ class EventEditor:
defval = None defval = None
self.type_selector = AutoComp.StandardCustomSelector( self.type_selector = AutoComp.StandardCustomSelector(
Utils.personal_events, self.event_menu, total_events, self.event_menu,
RelLib.Event.CUSTOM, defval) RelLib.Event.CUSTOM, defval)
AutoComp.fill_entry(self.place_field,self.pmap.keys()) AutoComp.fill_entry(self.place_field,self.pmap.keys())
@ -270,7 +280,7 @@ class EventEditor:
if val == RelLib.Event.CUSTOM: if val == RelLib.Event.CUSTOM:
label = strval label = strval
else: else:
label = Utils.personal_events[val] label = total_events[val]
if not label.strip(): if not label.strip():
label = _("New Event") label = _("New Event")
label = "%s: %s" % (_('Event'),label) label = "%s: %s" % (_('Event'),label)

View File

@ -1108,11 +1108,20 @@ class FamilyView:
mother_handle = fam.get_mother_handle() mother_handle = fam.get_mother_handle()
f = self.parent.db.get_person_from_handle(father_handle) f = self.parent.db.get_person_from_handle(father_handle)
m = self.parent.db.get_person_from_handle(mother_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]) father = self.nameof(_("Father"),f,frel_name)
mother = self.nameof(_("Mother"),m, mother = self.nameof(_("Mother"),m,mrel_name)
Utils.child_relations[mrel])
node = model.append() node = model.append()
if not sel: if not sel:
@ -1125,11 +1134,11 @@ class FamilyView:
else: else:
selection.set_mode(gtk.SELECTION_NONE) selection.set_mode(gtk.SELECTION_NONE)
def nameof(self,l,p,mode): def nameof(self,l,p,rel_name):
if p: if p:
n = NameDisplay.displayer.display(p) n = NameDisplay.displayer.display(p)
pid = p.get_gramps_id() 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: else:
return _("%s: unknown") % (l) return _("%s: unknown") % (l)

View File

@ -722,23 +722,25 @@ class Marriage:
self.family.set_source_reference_list(self.srcreflist) self.family.set_source_reference_list(self.srcreflist)
self.update_lists() 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.commit_family(self.family,trans)
self.db.transaction_commit(trans,_("Edit Marriage")) self.db.transaction_commit(trans,_("Edit Marriage"))
self.close() self.close()
def event_edit_callback(self,event): def event_edit_callback(self,data):
"""Birth and death events may not be in the map""" """Birth and death events may not be in the map"""
self.redraw_event_list() self.event_box.edit_callback(data)
try:
self.etree.select_iter(self.emap[str(event)])
except:
pass
def on_add_clicked(self,*obj): def on_add_clicked(self,*obj):
import EventEdit import EventEdit
EventEdit.EventRefEditor(None,None,self.family,self.db,
self.event_box.edit_callback,self)
#name = Utils.family_name(self.family,self.db) #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, #self,name, Utils.family_events,
#None, None, 0, self.event_edit_callback, #None, None, 0, self.event_edit_callback,
#RelLib.Event.MARRIAGE, self.db.readonly) #RelLib.Event.MARRIAGE, self.db.readonly)

View File

@ -153,7 +153,7 @@ personal_attributes = {
family_attributes = { family_attributes = {
RelLib.Attribute.UNKNOWN : _("Unknown"), RelLib.Attribute.UNKNOWN : _("Unknown"),
RelLib.Attribute.CUSTOM : _("Custom"), RelLib.Attribute.CUSTOM : _("Custom"),
RelLib.Attribute.NUM_CHILD : _("Number of Children"), RelLib.Attribute.NUM_CHILD : _("Number of Children"),
} }
family_relations = { family_relations = {