diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py index 67353e1a2..5dd102ec8 100644 --- a/gramps/src/EditPerson.py +++ b/gramps/src/EditPerson.py @@ -193,7 +193,7 @@ class EditPerson: self.get_widget("user_label").set_text(Config.attr_name) val = "" for attr in self.person.getAttributeList(): - if attr.getType() == Config.attr_name: + if attr.getType() == const.save_pattr(Config.attr_name): val = attr.getValue() break self.get_widget("user_data").set_text(val) @@ -338,7 +338,8 @@ class EditPerson: detail = "N" if attr.getSourceRef().getBase(): detail = detail + "S" - self.attr_list.append([attr.getType(),attr.getValue(),detail]) + self.attr_list.append([const.display_pattr(attr.getType()),\ + attr.getValue(),detail]) self.attr_list.set_row_data(self.attr_index,attr) self.attr_index = self.attr_index + 1 @@ -509,7 +510,7 @@ def on_attr_list_select_row(obj,row,b,c): edit_person_obj = obj.get_data(EDITPERSON) attr = obj.get_row_data(row) - edit_person_obj.attr_type.set_text(attr.getType()) + edit_person_obj.attr_type.set_text(const.display_pattr(attr.getType())) edit_person_obj.attr_value.set_text(attr.getValue()) #------------------------------------------------------------------------- @@ -581,7 +582,7 @@ def on_update_attr_clicked(obj): edit_person_obj = obj.get_data(EDITPERSON) attr = obj.get_row_data(row) - attr.setType(edit_person_obj.attr_type.get_text()) + attr.setType(const.set_pattr(edit_person_obj.attr_type.get_text())) attr.setValue(edit_person_obj.attr_value.get_text()) edit_person_obj.redraw_attr_list() @@ -733,7 +734,7 @@ def on_add_attr_clicked(obj): attr = Attribute() name = edit_person_obj.attr_type.get_text() - attr.setType(name) + attr.setType(const.set_pattr(name)) attr.setValue(edit_person_obj.attr_value.get_text()) if name not in const.personalAttributes: diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index fd060f847..37b195050 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -881,6 +881,13 @@ class RelDataBase: map[attr.getType()] = 1 return map.keys() + def getFamilyEventTypes(self): + map = {} + for family in self.familyMap.values(): + for attr in family.getEventList(): + map[attr.getName()] = 1 + return map.keys() + def getFamilyRelationTypes(self): map = {} for family in self.familyMap.values(): diff --git a/gramps/src/const.py b/gramps/src/const.py index 6d88f0b54..22bead2f2 100644 --- a/gramps/src/const.py +++ b/gramps/src/const.py @@ -96,7 +96,6 @@ thumbScale = 100.0 indexFile = "data.gramps" male = _("male") female = _("female") -helpMenu = "contents.html" #------------------------------------------------------------------------- # @@ -233,22 +232,6 @@ _pe_l2e = {} for a in _pe_e2l.keys(): _pe_l2e[_pe_e2l[a]] = a -personalConstantAttributes = { - "Description" : "DSCR", - "Identification Number": "IDNO", - "Social Security Number": "SSN" - } - -familyConstantAttributes = { - } - -familyConstantRelations = [ - "Married", - "Common Law", - "Partners", - "Unknown" -] - #------------------------------------------------------------------------- # # @@ -271,16 +254,100 @@ def save_pevent(st): else: return st -personalEvents = personalConstantEvents.keys() -personalEvents.sort() +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +personalConstantAttributes = { + "Description" : "DSCR", + "Identification Number" : "IDNO", + "Social Security Number": "SSN" + } -personalAttributes = personalConstantAttributes.keys() -personalAttributes.sort() +_pa_e2l = { + "Description" : _("Description"), + "Identification Number" : _("Identification Number"), + "Social Security Number": _("Social Security Number") + } + +_pa_l2e = {} +for a in _pa_e2l.keys(): + _pa_l2e[_pa_e2l[a]] = a + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def display_pattr(st): + if _pa_e2l.has_key(st): + return _pa_e2l[st] + else: + return st + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def save_pattr(st): + if _pa_l2e.has_key(st): + return _pa_l2e[st] + else: + return st + +familyConstantAttributes = { + } + +familyConstantRelations = [ + "Married", + "Common Law", + "Partners", + "Unknown" +] + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def initialize_personal_event_list(): + p = [] + for event in personalConstantEvents.keys(): + p.append(_pe_e2l[event]) + p.sort() + return p + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def initialize_marriage_event_list(): + p = [] + for event in familyConstantEvents.keys(): + p.append(_fe_e2l[event]) + p.sort() + return p + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def initialize_personal_attribute_list(): + p = [] + for event in personalConstantAttributes.keys(): + p.append(_pa_e2l[event]) + p.sort() + return p + +personalEvents = initialize_personal_event_list() +personalAttributes = initialize_personal_attribute_list() +marriageEvents = initialize_marriage_event_list() familyAttributes = familyConstantAttributes.keys() familyAttributes.sort() -marriageEvents = familyConstantEvents.keys() -marriageEvents.sort() - familyRelations = familyConstantRelations