* src/const.py.in: convert Alternate Birth and Alternate Death to

Birth and Death


svn: r4448
This commit is contained in:
Don Allingham 2005-05-01 04:22:08 +00:00
parent 5351dad9bc
commit ccbf79cc5c
5 changed files with 120 additions and 72 deletions

View File

@ -4,7 +4,9 @@
elsewhere
* src/ListModel.py: Add support for table callback functions
to update data after inline editing
* src/const.py.in: convert Alternate Birth and Alternate Death to
Birth and Death
2005-04-29 Alex Roitman <shura@gramps-project.org>
* src/edit_person.glade: Compact name edit button.

View File

@ -1404,20 +1404,29 @@ class ReorderListBox(ListBox):
self.data.remove(obj)
self.data.insert(dest,obj)
class AttrListBox(ListBox):
titles = [
# Title Sort Col, Size, Type
(_('Attribute'), NOSORT, 200, TEXT),
(_('Value'), NOSORT, 350, TEXT),
(_('Source'), NOSORT, 50, TOGGLE),
(_('Note'), NOSORT, 50, TOGGLE),
]
class AttrListBox(ReorderListBox):
def __init__(self, parent, person, obj, label, button_list):
attrlist = const.personalAttributes
titles = [
# Title Sort Col, Size, Type
(_('Attribute'), NOSORT, 200, COMBO, attrlist, self.set_type),
(_('Value'), NOSORT, 350, TEXT, None, self.set_value),
(_('Source'), NOSORT, 50, TOGGLE, None, None),
(_('Note'), NOSORT, 50, TOGGLE, None, None),
]
self.data = person.get_attribute_list()[:]
ListBox.__init__(self, parent, person, obj, label,
button_list, self.titles)
button_list, titles)
def set_type(self,index,value):
self.data[index].set_type(value)
def set_value(self,index,value):
self.data[index].set_value(value)
def add(self,obj):
"""Brings up the AttributeEditor for a new attribute"""
@ -1457,14 +1466,16 @@ class EventListBox(ReorderListBox):
for val in person.get_event_list():
self.data.append(parent.db.get_event_from_handle(val))
eventnames = const.personalEvents
evalues = [
# Title Sort Col Size, Type Argument
(_('Event'), NOSORT, 100, COMBO, const.personalEvents, self.set_name),
(_('Description'), NOSORT, 140, TEXT, None, self.set_description),
(_('Date'), NOSORT, 100, TEXT, None, self.set_date),
(_('Place'), NOSORT, 100, TEXT, None, self.set_place),
(_('Source'), NOSORT, 50, TOGGLE),
(_('Note'), NOSORT, 50, TOGGLE),
(_('Event'), NOSORT, 100, COMBO, eventnames, self.set_name),
(_('Description'), NOSORT, 140, TEXT, None, self.set_description),
(_('Date'), NOSORT, 100, TEXT, None, self.set_date),
(_('Place'), NOSORT, 100, TEXT, None, self.set_place),
(_('Source'), NOSORT, 50, TOGGLE, None, None),
(_('Note'), NOSORT, 50, TOGGLE, None, None),
]
ReorderListBox.__init__(self, parent, person, obj, label,
@ -1524,21 +1535,42 @@ class EventListBox(ReorderListBox):
class NameListBox(ReorderListBox):
titles = [
# Title Sort Col Size, Type
(_('Family Name'), NOSORT, 225, TEXT),
(_('Prefix'), NOSORT, 50, TEXT),
(_('Given Name'), NOSORT, 200, TEXT),
(_('Suffix'), NOSORT, 50, TEXT),
(_('Type'), NOSORT, 100, TEXT),
(_('Source'), NOSORT, 50, TOGGLE),
(_('Note'), NOSORT, 50, TOGGLE),
]
def __init__(self,parent,person,obj,label,button_list):
surnames = parent.db.get_surname_list()
types = const.NameTypesMap.get_values()
types.sort()
titles = [
# Title Sort Col Size, Type
(_('Family Name'), NOSORT, 150, COMBO, surnames, self.set_name),
(_('Prefix'), NOSORT, 50, TEXT, None, self.set_prefix),
(_('Given Name'), NOSORT, 200, TEXT, None, self.set_given),
(_('Suffix'), NOSORT, 50, TEXT, None, self.set_suffix),
(_('Type'), NOSORT, 150, COMBO, types, self.set_type),
(_('Source'), NOSORT, 50, TOGGLE, None, None),
(_('Note'), NOSORT, 50, TOGGLE, None, None),
]
self.data = person.get_alternate_names()[:]
ReorderListBox.__init__(self, parent, person, obj, label,
button_list, self.titles, DdTargets.NAME)
button_list, titles, DdTargets.NAME)
def set_name(self,index,value):
self.data[index].set_surname(value)
def set_prefix(self,index,value):
self.data[index].set_surname_prefix(value)
def set_given(self,index,value):
self.data[index].set_first_name(value)
def set_suffix(self,index,value):
self.data[index].set_suffix(value)
def set_type(self,index,value):
ntype = const.NameTypesMap.find_value(value)
self.data[index].set_type(value)
def add(self,obj):
NameEdit.NameEditor(self.parent, None, self.edit_callback,
@ -1567,21 +1599,37 @@ class NameListBox(ReorderListBox):
class AddressListBox(ReorderListBox):
titles = [
# Title Sort Col Size, Type
(_('Date'), NOSORT, 175, TEXT),
(_('Address'), NOSORT, 150, TEXT),
(_('City'), NOSORT, 100, TEXT),
(_('State/Province'),NOSORT, 75, TEXT),
(_('Country'), NOSORT, 100, TEXT),
(_('Source'), NOSORT, 50, TOGGLE),
(_('Note'), NOSORT, 50, TOGGLE),
]
def __init__(self,parent,person,obj,label,button_list):
titles = [
# Title Sort Col Size, Type
(_('Date'), NOSORT, 175, TEXT, None, self.set_date),
(_('Address'), NOSORT, 150, TEXT, None, self.set_addr),
(_('City'), NOSORT, 100, TEXT, None, self.set_city),
(_('State/Province'),NOSORT, 75, TEXT, None, self.set_state),
(_('Country'), NOSORT, 100, TEXT, None, self.set_country),
(_('Source'), NOSORT, 50, TOGGLE, None, None),
(_('Note'), NOSORT, 50, TOGGLE, None, None),
]
self.data = person.get_address_list()[:]
ReorderListBox.__init__(self, parent, person, obj, label,
button_list, self.titles, DdTargets.ADDRESS)
button_list, titles, DdTargets.ADDRESS)
def set_date(self,index,value):
self.data[index].set_date(value)
def set_addr(self,index,value):
self.data[index].set_street(value)
def set_city(self,index,value):
self.data[index].set_city(value)
def set_state(self,index,value):
self.data[index].set_state(value)
def set_country(self,index,value):
self.data[index].set_country(value)
def add(self,obj):
AddrEdit.AddressEditor(self.parent, None, self.edit_callback,
@ -1611,16 +1659,23 @@ class AddressListBox(ReorderListBox):
class UrlListBox(ReorderListBox):
titles = [
# Title Sort Col Size, Type
(_('Path'), NOSORT, 250, TEXT),
(_('Description'), NOSORT, 100, TEXT),
]
def __init__(self,parent,person,obj,label,button_list):
titles = [
# Title Sort Col Size, Type
(_('Path'), NOSORT, 250, TEXT, None, self.set_path),
(_('Description'), NOSORT, 100, TEXT, None, self.set_description),
]
self.data = person.get_url_list()[:]
ReorderListBox.__init__(self, parent, person, obj, label,
button_list, self.titles, DdTargets.URL)
button_list, titles, DdTargets.URL)
def set_path(self,index,value):
self.data[index].set_path(value)
def set_description(self,index,value):
self.data[index].set_description(value)
def add(self,obj):
UrlEdit.UrlEditor(self.parent, self.name, None,

View File

@ -301,7 +301,7 @@ class EventEditor:
"""Display the relevant portion of GRAMPS manual"""
gnome.help_display('gramps-manual','gramps-edit-complete')
def get_place(self,field,trans):
def get_place(self,field):
text = unicode(field.get_text().strip())
if text:
if self.pmap.has_key(text):
@ -309,7 +309,9 @@ class EventEditor:
else:
place = RelLib.Place()
place.set_title(text)
trans = self.db.transaction_begin()
self.db.add_place(place,trans)
self.db.transaction_commit(trans,_("Add Place"))
return place
else:
return None
@ -326,7 +328,7 @@ class EventEditor:
#self.date = self.dp.parse(unicode(self.date_field.get_text()))
ecause = unicode(self.cause_field.get_text())
eplace_obj = self.get_place(self.place_field,trans)
eplace_obj = self.get_place(self.place_field)
buf = self.note_field.get_buffer()
start = buf.get_start_iter()
@ -336,7 +338,7 @@ class EventEditor:
edesc = unicode(self.descr_field.get_text())
epriv = self.priv.get_active()
if ename not in self.elist + [_("Birth") , _("Death")]:
if ename not in self.elist:
WarningDialog(
_('New event type created'),
_('The "%s" event type has been added to this database.\n'
@ -348,19 +350,18 @@ class EventEditor:
if self.event == None:
self.event = RelLib.Event()
self.event.set_handle(Utils.create_id())
self.db.add_event(self.event,trans)
self.event.set_source_reference_list(self.srcreflist)
self.event.set_witness_list(self.witnesslist)
just_added = True
self.update_event(ename,self.date,eplace_obj,edesc,enote,eformat,
epriv,ecause,trans)
epriv,ecause)
self.close(obj)
if self.callback:
self.callback(self.event)
def update_event(self,name,date,place,desc,note,format,priv,cause,trans):
def update_event(self,name,date,place,desc,note,format,priv,cause):
if place:
if self.event.get_place_handle() != place.get_handle():
self.event.set_place_handle(place.get_handle())
@ -402,11 +403,12 @@ class EventEditor:
if self.event.get_privacy() != priv:
self.event.set_privacy(priv)
self.parent.lists_changed = 1
self.db.commit_event(self.event,trans)
def on_switch_page(self,obj,a,page):
buf = self.note_field.get_buffer()
text = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),False))
start = buf.get_start_iter()
stop = buf.get_end_iter()
text = unicode(buf.get_text(start,stop,False))
if text:
Utils.bold_label(self.notes_label)
else:

View File

@ -42,7 +42,7 @@ class ListModel:
self.mylist = []
self.data_index = 0
for l in dlist:
if len(l) == 4 and l[3] == TOGGLE:
if l[3] == TOGGLE:
self.mylist.append(TYPE_BOOLEAN)
else:
self.mylist.append(TYPE_STRING)
@ -60,17 +60,6 @@ class ListModel:
self.cids = []
self.idmap = {}
store = gtk.ListStore(str)
events = const.personalConstantEvents.keys()
events.append('Birth')
events.append('Death')
events.sort()
model = gtk.ListStore(str,TYPE_OBJECT)
for val in events:
model.append((val,store))
cnum = 0
for name in dlist:
if len(name) == 3:

View File

@ -308,8 +308,8 @@ def display_fevent(st):
personalConstantEvents = {
"Adopted" : "ADOP",
"Adult Christening" : "CHRA",
"Alternate Birth" : "BIRT",
"Alternate Death" : "DEAT",
"Birth" : "BIRT",
"Death" : "DEAT",
"Baptism" : "BAPM",
"Bar Mitzvah" : "BARM",
"Bas Mitzvah" : "BASM",
@ -351,8 +351,8 @@ personalConstantEvents = {
personal_events = TransTable({
"Adopted" : _("Adopted"),
"Alternate Birth" : _("Alternate Birth"),
"Alternate Death" : _("Alternate Death"),
"Birth" : _("Birth"),
"Death" : _("Death"),
"Adult Christening" : _("Adult Christening"),
"Baptism" : _("Baptism"),
"Bar Mitzvah" : _("Bar Mitzvah"),