diff --git a/gramps/src/Marriage.py b/gramps/src/Marriage.py index 1aa833b8b..80888f8d1 100644 --- a/gramps/src/Marriage.py +++ b/gramps/src/Marriage.py @@ -120,7 +120,7 @@ class Marriage: self.load_images() self.type_field.set_popdown_strings(const.familyRelations) - self.type_field.entry.set_text(family.getRelationship()) + self.type_field.entry.set_text(const.display_frel(family.getRelationship())) # stored object data top_window.set_data(MARRIAGE,self) @@ -159,7 +159,8 @@ class Marriage: detail = "N" if attr.getSourceRef(): detail = detail + "S" - self.attr_list.append([attr.getType(),attr.getValue(),details]) + self.attr_list.append([const.display_fattr(attr.getType()),\ + attr.getValue(),details]) self.attr_list.set_row_data(self.attr_index,attr) self.attr_index = self.attr_index + 1 @@ -276,8 +277,8 @@ def on_close_marriage_editor(obj): family_obj = obj.get_data(MARRIAGE) relation = family_obj.type_field.entry.get_text() - if relation != family_obj.family.getRelationship(): - family_obj.family.setRelationship(relation) + if const.save_frel(relation) != family_obj.family.getRelationship(): + family_obj.family.setRelationship(const.save_frel(relation)) utils.modified() text = family_obj.notes_field.get_chars(0,-1) @@ -671,7 +672,7 @@ def on_attr_list_select_row(obj,row,b,c): family_obj = obj.get_data(MARRIAGE) attr = obj.get_row_data(row) - family_obj.attr_type.set_text(attr.getType()) + family_obj.attr_type.set_text(const.display_fattr(attr.getType())) family_obj.attr_value.set_text(attr.getValue()) #------------------------------------------------------------------------- @@ -686,7 +687,7 @@ def on_update_attr_clicked(obj): family_obj = obj.get_data(MARRIAGE) attr = obj.get_row_data(row) - attr.setType(family_obj.attr_type.get_text()) + attr.setType(const.save_fattr(family_obj.attr_type.get_text())) attr.setValue(family_obj.attr_value.get_text()) family_obj.redraw_attr_list() @@ -721,7 +722,7 @@ def on_add_attr_clicked(obj): attr = Attribute() name = family_obj.attr_type.get_text() - attr.setType(name) + attr.setType(const.save_fattr(name)) attr.setValue(family_obj.attr_value.get_text()) if name not in const.familyAttributes: diff --git a/gramps/src/config.glade b/gramps/src/config.glade index eb7fa53cc..e5cbf5fad 100644 --- a/gramps/src/config.glade +++ b/gramps/src/config.glade @@ -1663,7 +1663,7 @@ AbiWord GtkEntry GnomeEntry:entry entry2 - The default directory for the output of the Web Site report generators + The default directory for the output of the Web Site report generators True changed diff --git a/gramps/src/const.py b/gramps/src/const.py index 22bead2f2..c7db67949 100644 --- a/gramps/src/const.py +++ b/gramps/src/const.py @@ -219,7 +219,7 @@ _pe_e2l = { "Elected" : _("Elected"), "Emigration" : _("Emigration"), "Graduation" : _("Graduation"), - "Military Service" : _("_MILT"), + "Military Service" : _("Military Service"), "Naturalization" : _("Naturalization"), "Occupation" : _("Occupation"), "Probate" : _("Probate"), @@ -297,15 +297,81 @@ def save_pattr(st): else: return st +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- familyConstantAttributes = { } -familyConstantRelations = [ - "Married", - "Common Law", - "Partners", - "Unknown" -] +_fa_e2l = { + } + +_fa_l2e = {} +for a in _fa_e2l.keys(): + _fa_l2e[_fa_e2l[a]] = a + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def display_fattr(st): + if _fa_e2l.has_key(st): + return _fa_e2l[st] + else: + return st + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def save_fattr(st): + if _fa_l2e.has_key(st): + return _fa_l2e[st] + else: + return st + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- + +_fr_e2l = { + "Married" : _("Married"), + "Common Law" : _("Common Law"), + "Partners" : _("Partners"), + "Unknown" : _("Unknown") +} + +_fr_l2e = {} +for a in _fa_e2l.keys(): + _fa_l2e[_fa_e2l[a]] = a + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def display_frel(st): + if _fr_e2l.has_key(st): + return _fr_e2l[st] + else: + return st + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def save_frel(st): + if _fr_l2e.has_key(st): + return _fr_l2e[st] + else: + return st #------------------------------------------------------------------------- # @@ -343,11 +409,32 @@ def initialize_personal_attribute_list(): p.sort() return p +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def initialize_family_attribute_list(): + p = [] + for event in familyConstantAttributes.keys(): + p.append(_fa_e2l[event]) + p.sort() + return p + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def initialize_family_relation_list(): + p = [] + for event in _fr_e2l.keys(): + p.append(_fr_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() - -familyRelations = familyConstantRelations +familyAttributes = initialize_family_attribute_list() +familyRelations = initialize_family_relation_list() diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 1e3af62ac..5c30f39d9 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -555,13 +555,11 @@ def new_database_response(val): if val == 1: return - const.personalEvents = const.personalConstantEvents.keys() - const.personalEvents.sort() - const.personalAttributes = const.personalConstantAttributes.keys() - const.personalAttributes.sort() - const.familyAttributes = const.familyConstantAttributes.keys() - const.familyAttributes.sort() - const.familyRelations = const.familyConstantRelations + const.personalEvents = const.initialize_personal_event_list() + const.personalAttributes = const.initialize_personal_attribute_list() + const.marriageEvents = const.initialize_marriage_event_list() + const.familyAttributes = const.initialize_family_attribute_list() + const.familyRelations = const.initialize_family_relation_list() database.new() topWindow.set_title("Gramps") active_person = None @@ -1372,19 +1370,11 @@ def on_revert_activate(obj): #------------------------------------------------------------------------- def revert_query(value): if value == 0: - const.personalEvents = const.personalConstantEvents.keys() - const.personalEvents.sort() - - const.personalAttributes = const.personalConstantAttributes.keys() - const.personalAttributes.sort() - - const.familyAttributes = const.familyConstantAttributes.keys() - const.familyAttributes.sort() - - const.marriageEvents = const.familyConstantEvents.keys() - const.marriageEvents.sort() - - const.familyRelations = const.familyConstantRelations + const.personalEvents = const.initialize_personal_event_list() + const.personalAttributes = const.initialize_personal_attribute_list() + const.marriageEvents = const.initialize_marriage_event_list() + const.familyAttributes = const.initialize_family_attribute_list() + const.familyRelations = const.initialize_family_relation_list() file = database.getSavePath() database.new() @@ -1946,13 +1936,21 @@ def load_database(name): mylist = database.getPersonEventTypes() for type in mylist: - if type not in const.personalEvents: - const.personalEvents.append(type) + ntype = const.display_pevent(type) + if ntype not in const.personalEvents: + const.personalEvents.append(ntype) + + mylist = database.getFamilyEventTypes() + for type in mylist: + ntype = const.display_fevent(type) + if ntype not in const.marriageEvents: + const.marriageEvents.append(ntype) mylist = database.getPersonAttributeTypes() for type in mylist: - if type not in const.personalAttributes: - const.personalAttributes.append(type) + ntype = const.display_pattr(type) + if ntype not in const.personalAttributes: + const.personalAttributes.append(ntype) mylist = database.getFamilyAttributeTypes() for type in mylist: