* 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 f1bdbd1ebd
commit f844fb5bf1
5 changed files with 120 additions and 72 deletions

View File

@ -4,6 +4,8 @@
elsewhere elsewhere
* src/ListModel.py: Add support for table callback functions * src/ListModel.py: Add support for table callback functions
to update data after inline editing 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> 2005-04-29 Alex Roitman <shura@gramps-project.org>
* src/edit_person.glade: Compact name edit button. * src/edit_person.glade: Compact name edit button.

View File

@ -1404,20 +1404,29 @@ class ReorderListBox(ListBox):
self.data.remove(obj) self.data.remove(obj)
self.data.insert(dest,obj) self.data.insert(dest,obj)
class AttrListBox(ListBox): class AttrListBox(ReorderListBox):
titles = [
# Title Sort Col, Size, Type
(_('Attribute'), NOSORT, 200, TEXT),
(_('Value'), NOSORT, 350, TEXT),
(_('Source'), NOSORT, 50, TOGGLE),
(_('Note'), NOSORT, 50, TOGGLE),
]
def __init__(self, parent, person, obj, label, button_list): 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()[:] self.data = person.get_attribute_list()[:]
ListBox.__init__(self, parent, person, obj, label, 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): def add(self,obj):
"""Brings up the AttributeEditor for a new attribute""" """Brings up the AttributeEditor for a new attribute"""
@ -1457,14 +1466,16 @@ class EventListBox(ReorderListBox):
for val in person.get_event_list(): for val in person.get_event_list():
self.data.append(parent.db.get_event_from_handle(val)) self.data.append(parent.db.get_event_from_handle(val))
eventnames = const.personalEvents
evalues = [ evalues = [
# Title Sort Col Size, Type Argument # Title Sort Col Size, Type Argument
(_('Event'), NOSORT, 100, COMBO, const.personalEvents, self.set_name), (_('Event'), NOSORT, 100, COMBO, eventnames, self.set_name),
(_('Description'), NOSORT, 140, TEXT, None, self.set_description), (_('Description'), NOSORT, 140, TEXT, None, self.set_description),
(_('Date'), NOSORT, 100, TEXT, None, self.set_date), (_('Date'), NOSORT, 100, TEXT, None, self.set_date),
(_('Place'), NOSORT, 100, TEXT, None, self.set_place), (_('Place'), NOSORT, 100, TEXT, None, self.set_place),
(_('Source'), NOSORT, 50, TOGGLE), (_('Source'), NOSORT, 50, TOGGLE, None, None),
(_('Note'), NOSORT, 50, TOGGLE), (_('Note'), NOSORT, 50, TOGGLE, None, None),
] ]
ReorderListBox.__init__(self, parent, person, obj, label, ReorderListBox.__init__(self, parent, person, obj, label,
@ -1524,21 +1535,42 @@ class EventListBox(ReorderListBox):
class NameListBox(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): 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()[:] self.data = person.get_alternate_names()[:]
ReorderListBox.__init__(self, parent, person, obj, label, 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): def add(self,obj):
NameEdit.NameEditor(self.parent, None, self.edit_callback, NameEdit.NameEditor(self.parent, None, self.edit_callback,
@ -1567,21 +1599,37 @@ class NameListBox(ReorderListBox):
class AddressListBox(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): 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()[:] self.data = person.get_address_list()[:]
ReorderListBox.__init__(self, parent, person, obj, label, 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): def add(self,obj):
AddrEdit.AddressEditor(self.parent, None, self.edit_callback, AddrEdit.AddressEditor(self.parent, None, self.edit_callback,
@ -1611,16 +1659,23 @@ class AddressListBox(ReorderListBox):
class UrlListBox(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): 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()[:] self.data = person.get_url_list()[:]
ReorderListBox.__init__(self, parent, person, obj, label, 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): def add(self,obj):
UrlEdit.UrlEditor(self.parent, self.name, None, UrlEdit.UrlEditor(self.parent, self.name, None,

View File

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

View File

@ -42,7 +42,7 @@ class ListModel:
self.mylist = [] self.mylist = []
self.data_index = 0 self.data_index = 0
for l in dlist: for l in dlist:
if len(l) == 4 and l[3] == TOGGLE: if l[3] == TOGGLE:
self.mylist.append(TYPE_BOOLEAN) self.mylist.append(TYPE_BOOLEAN)
else: else:
self.mylist.append(TYPE_STRING) self.mylist.append(TYPE_STRING)
@ -60,17 +60,6 @@ class ListModel:
self.cids = [] self.cids = []
self.idmap = {} 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 cnum = 0
for name in dlist: for name in dlist:
if len(name) == 3: if len(name) == 3:

View File

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