* src/FamilyView.py (load_family): Enable translation for family

relation.
* src/const.py.in: Add new functions: display_event(), save_event(),
display_attr(), and save_attr() which work for either personal or
family events/attributes. Correct silly typo.
* src/WriteXML.py (dump_my_event): Call const.save_event() before
saving; (write_family_id): Call const.save_frel() before saving;
(write_attribute_list): Call const.save_attr() before saving.
* src/Marriage.py (redraw_event_list): Call const.display_fevent()
before saving; (on_add_clicked): change const.save_fevent() to
const.display_fevent(); (on_event_update_clicked): Likewise.
* src/EventEdit.py (EventEditor.__init__): Call self.trans() before
displaying event name.


svn: r1964
This commit is contained in:
Alex Roitman 2003-08-07 03:54:10 +00:00
parent 2c5f966e10
commit 3a7293dd47
6 changed files with 71 additions and 9 deletions

View File

@ -1,3 +1,18 @@
2003-08-06 Alex Roitman <shura@alex.neuro.umn.edu>
* src/FamilyView.py (load_family): Enable translation for family
relation.
* src/const.py.in: Add new functions: display_event(), save_event(),
display_attr(), and save_attr() which work for either personal or
family events/attributes. Correct silly typo.
* src/WriteXML.py (dump_my_event): Call const.save_event() before
saving; (write_family_id): Call const.save_frel() before saving;
(write_attribute_list): Call const.save_attr() before saving.
* src/Marriage.py (redraw_event_list): Call const.display_fevent()
before saving; (on_add_clicked): change const.save_fevent() to
const.display_fevent(); (on_event_update_clicked): Likewise.
* src/EventEdit.py (EventEditor.__init__): Call self.trans() before
displaying event name.
2003-08-05 Tim Waugh <twaugh@redhat.com>
* src/Report.py, src/TextDoc.py, src/DrawDoc.py: Adjusted the way
that 'Print Report' is handled.

View File

@ -130,7 +130,7 @@ class EventEditor:
AutoComp.AutoEntry(self.place_field,self.pmap.keys())
if event != None:
self.name_field.set_text(event.getName())
self.name_field.set_text(self.trans(event.getName()))
if (def_placename):
self.place_field.set_text(def_placename)
else:

View File

@ -520,7 +520,8 @@ class FamilyView:
else:
mdate = ""
v = "%s\n\t%s%s" % (GrampsCfg.nameof(sp),
f.getRelationship(),mdate)
const.display_frel(f.getRelationship()),
mdate)
self.spouse_model.set(iter,0,v)
else:
self.spouse_model.set(iter,0,"unknown\n")

View File

@ -357,7 +357,7 @@ class Marriage:
self.etree.clear()
self.emap = {}
for data in self.elist:
iter = self.etree.add([data.getName(),data.getQuoteDate(),data.getPlaceName()],data)
iter = self.etree.add([const.display_fevent(data.getName()),data.getQuoteDate(),data.getPlaceName()],data)
self.emap[str(data)] = iter
if self.elist:
self.etree.select_row(0)
@ -522,7 +522,7 @@ class Marriage:
import EventEdit
name = Utils.family_name(self.family)
EventEdit.EventEditor(self,name,const.marriageEvents,
const.save_pevent,None,None,0,self.event_edit_callback,
const.display_fevent,None,None,0,self.event_edit_callback,
const.defaultMarriageEvent)
def on_event_update_clicked(self,obj):
@ -533,7 +533,7 @@ class Marriage:
event = self.etree.get_object(iter)
name = Utils.family_name(self.family)
EventEdit.EventEditor(self,name,const.marriageEvents,
const.save_pevent,event,None,0,self.event_edit_callback)
const.display_fevent,event,None,0,self.event_edit_callback)
def on_delete_clicked(self,obj):
if Utils.delete_selected(obj,self.elist):

View File

@ -396,6 +396,7 @@ class XmlWriter:
return
sp = " " * index
name = const.save_event(name)
self.g.write('%s<event type="%s"%s>\n' % (sp,self.fix(name),conf_priv(event)))
self.write_date(event.getDateObj(),index+1)
@ -469,7 +470,7 @@ class XmlWriter:
sp = " " * index
self.g.write('%s<family id="%s"' % (sp,family.getId()))
if rel != "":
self.g.write(' type="%s">\n' % rel)
self.g.write(' type="%s">\n' % const.save_frel(rel))
else:
self.g.write('>\n')
@ -596,7 +597,8 @@ class XmlWriter:
sp = ' ' * indent
for attr in list:
self.g.write('%s<attribute%s type="%s" value="%s"' % \
(sp,conf_priv(attr),attr.getType(),self.fix(attr.getValue())))
(sp,conf_priv(attr),const.save_attr(attr.getType()),
self.fix(attr.getValue())))
slist = attr.getSourceRefList()
note = attr.getNote()
if note == "" and len(slist) == 0:

View File

@ -348,6 +348,28 @@ def save_pevent(st):
else:
return st
#-------------------------------------------------------------------------
#
# Merged functions for events: personal, family, whatever else
# there might be in the future.
#
#-------------------------------------------------------------------------
def display_event(st):
if _pe_e2l.has_key(st):
return _pe_e2l[st]
elif _fe_e2l.has_key(st):
return _fe_e2l[st]
else:
return st
def save_event(st):
if _pe_l2e.has_key(st):
return _pe_l2e[st]
elif _fe_l2e.has_key(st):
return _fe_l2e[st]
else:
return st
#-------------------------------------------------------------------------
#
#
@ -434,6 +456,28 @@ def save_fattr(st):
else:
return st
#-------------------------------------------------------------------------
#
# Merged functions for attributes: personal, family, whatever else
# there might be in the future.
#
#-------------------------------------------------------------------------
def display_attr(st):
if _pa_e2l.has_key(st):
return _pa_e2l[st]
elif _fa_e2l.has_key(st):
return _fa_e2l[st]
else:
return st
def save_attr(st):
if _pa_l2e.has_key(st):
return _pa_l2e[st]
elif _fa_l2e.has_key(st):
return _fa_l2e[st]
else:
return st
#-------------------------------------------------------------------------
#
#
@ -457,8 +501,8 @@ _fr_e2l = {
}
_fr_l2e = {}
for a in _fa_e2l.keys():
_fa_l2e[_fa_e2l[a]] = a
for r in _fr_e2l.keys():
_fr_l2e[_fr_e2l[r]] = r
#-------------------------------------------------------------------------
#