diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 236854ddd..6066b5ddc 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -12,6 +12,14 @@ * src/GrampsBSDDB.py (upgrade_2): Use proper constants. * src/RelLib.py: Move constants out to const.py.in. + * src/ChooseParents.py: Fix constants. + * src/FamilyView.py: Fix constants. + * src/PedView.py: Fix constants. + * src/ReadGedcom.py: Fix constants. + * src/ReadXML.py: Fix constants. + * src/SelectChild.py: Fix constants. + * src/WriteXML.py: Fix constants. + 2005-05-27 Richard Taylor * src/EditRepository.py: polish Repository Ref UI * src/RelLib.py: merge minor changes from HEAD diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index 238ad0f44..5cae04db6 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -147,8 +147,8 @@ class ChooseParents: frel = fr break else: - mrel = RelLib.Person.CHILD_REL_BIRTH - frel = RelLib.Person.CHILD_REL_BIRTH + mrel = const.CHILD_BIRTH + frel = const.CHILD_BIRTH if self.family: self.type = self.family.get_relationship() @@ -455,12 +455,12 @@ class ChooseParents: try: mother_rel = self.mcombo.get_active() except KeyError: - mother_rel = RelLib.Person.CHILD_REL_BIRTH + mother_rel = const.CHILD_BIRTH try: father_rel = self.fcombo.get_active() except KeyError: - father_rel = RelLib.Person.CHILD_REL_BIRTH + father_rel = const.CHILD_BIRTH trans = self.db.transaction_begin() if self.father or self.mother: @@ -630,8 +630,8 @@ class ModifyParents: self.fcombo = self.glade.get_widget('fcombo') self.mcombo = self.glade.get_widget('mcombo') - self.orig_mrel = RelLib.Person.CHILD_REL_BIRTH - self.orig_frel = RelLib.Person.CHILD_REL_BIRTH + self.orig_mrel = const.CHILD_BIRTH + self.orig_frel = const.CHILD_BIRTH for (f,mr,fr) in self.person.get_parent_family_handle_list(): if f == self.family.get_handle(): self.orig_mrel = mr diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index db0727174..cb18296c4 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -685,10 +685,10 @@ class FamilyView: if not self.person: return person = RelLib.Person() - if self.person.get_gender() == RelLib.Person.MALE: - person.set_gender(RelLib.Person.FEMALE) + if self.person.get_gender() == const.MALE: + person.set_gender(const.FEMALE) else: - person.set_gender(RelLib.Person.MALE) + person.set_gender(const.MALE) try: EditPerson.EditPerson(self.parent, person, self.parent.db, self.new_spouse_after_edit) @@ -712,7 +712,7 @@ class FamilyView: old_person.add_family_handle(fhandle) new_person.add_family_handle(fhandle) - if self.person.get_gender() == RelLib.Person.MALE: + if self.person.get_gender() == const.MALE: family.set_mother_handle(epo.person.get_handle()) family.set_father_handle(self.person.get_handle()) else: @@ -761,7 +761,7 @@ class FamilyView: self.family = RelLib.Family() self.parent.db.add_family(self.family,trans) person.add_family_handle(self.family.get_handle()) - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: self.family.set_father_handle(person) else: self.family.set_mother_handle(person) @@ -783,7 +783,7 @@ class FamilyView: family = RelLib.Family() self.parent.db.add_family(family,trans) person.add_family_handle(family.get_handle()) - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: family.set_father_handle(person.get_handle()) else: family.set_mother_handle(person.get_handle()) @@ -792,8 +792,8 @@ class FamilyView: family.add_child_handle(new_person.get_handle()) new_person.add_parent_family_handle(family.get_handle(), - RelLib.Person.CHILD_REL_BIRTH, - RelLib.Person.CHILD_REL_BIRTH) + const.CHILD_BIRTH, + const.CHILD_BIRTH) self.parent.db.commit_person(new_person,trans) self.parent.db.commit_family(family,trans) self.parent.db.transaction_commit(trans,_("Add Child to Family")) @@ -1434,7 +1434,7 @@ class FamilyView: family = RelLib.Family() self.parent.db.add_family(family,trans) person.add_family_handle(family.get_handle()) - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: family.set_father_handle(person.get_handle()) else: family.set_mother_handle(person.get_handle()) @@ -1443,8 +1443,8 @@ class FamilyView: family.add_child_handle(new_person.get_handle()) new_person.add_parent_family_handle(family.get_handle(), - RelLib.Person.CHILD_REL_BIRTH, - RelLib.Person.CHILD_REL_BIRTH) + const.CHILD_BIRTH, + const.CHILD_BIRTH) self.parent.db.commit_person(new_person,trans) self.parent.db.commit_family(family,trans) self.parent.db.transaction_commit(trans,_("Add Child to Family")) @@ -1546,7 +1546,7 @@ class FamilyView: sel_data.set(sel_data.target, bits_per, data) def north_american(self,val): - if self.person.get_gender() == RelLib.Person.MALE: + if self.person.get_gender() == const.MALE: pname = self.person.get_primary_name() return (pname.get_surname_prefix(),pname.get_surname()) elif self.family: @@ -1579,7 +1579,7 @@ class FamilyView: def icelandic(self,val): fname = "" - if self.person.get_gender() == RelLib.Person.MALE: + if self.person.get_gender() == const.MALE: fname = self.person.get_primary_name().get_first_name() elif self.family: f = self.family.get_father_handle() diff --git a/gramps2/src/PedView.py b/gramps2/src/PedView.py index ef8afe0c8..8bb0fbd04 100644 --- a/gramps2/src/PedView.py +++ b/gramps2/src/PedView.py @@ -280,9 +280,9 @@ class PedigreeView: tooltip.set_tip(text, self.format_person(lst[i][0], 11)) text.set_alignment(0.0,0.0) gender = lst[i][0].get_gender() - if gender == RelLib.Person.MALE: + if gender == const.MALE: text.modify_bg( gtk.STATE_NORMAL, text.get_colormap().alloc_color("#F5FFFF")) - elif gender == RelLib.Person.FEMALE: + elif gender == const.FEMALE: text.modify_bg( gtk.STATE_NORMAL, text.get_colormap().alloc_color("#FFF5FF")) else: text.modify_bg( gtk.STATE_NORMAL, text.get_colormap().alloc_color("#FFFFF5")) @@ -423,8 +423,8 @@ class PedigreeView: else: return if family_handle: - mrel = m != RelLib.Person.CHILD_REL_BIRTH - frel = f != RelLib.Person.CHILD_REL_BIRTH + mrel = m != const.CHILD_BIRTH + frel = f != const.CHILD_BIRTH family = self.db.get_family_from_handle(family_handle) if family != None: diff --git a/gramps2/src/ReadGedcom.py b/gramps2/src/ReadGedcom.py index 3c570b67a..ac8153e5b 100644 --- a/gramps2/src/ReadGedcom.py +++ b/gramps2/src/ReadGedcom.py @@ -83,15 +83,15 @@ file_systems = { "SMBFS" : _('Networked Windows file system') } -rel_types = (RelLib.Person.CHILD_REL_BIRTH, - RelLib.Person.CHILD_REL_UNKWN, - RelLib.Person.CHILD_REL_NONE) +rel_types = (const.CHILD_BIRTH, + const.CHILD_UNKNOWN, + const.CHILD_NONE) pedi_type = { - 'birth' : RelLib.Person.CHILD_REL_BIRTH, - 'natural': RelLib.Person.CHILD_REL_BIRTH, - 'adopted': RelLib.Person.CHILD_REL_ADOPT, - 'foster' : RelLib.Person.CHILD_REL_FOST, + 'birth' : const.CHILD_BIRTH, + 'natural': const.CHILD_BIRTH, + 'adopted': const.CHILD_ADOPTED, + 'foster' : const.CHILD_FOSTER, } #------------------------------------------------------------------------- @@ -781,8 +781,8 @@ class GedcomParser: self.barf(level+1) def parse_ftw_relations(self,level): - mrel = RelLib.Person.CHILD_REL_BIRTH - frel = RelLib.Person.CHILD_REL_BIRTH + mrel = const.CHILD_BIRTH + frel = const.CHILD_BIRTH while 1: matches = self.get_next() @@ -791,17 +791,17 @@ class GedcomParser: return (mrel,frel) # FTW elif matches[1] == "_FREL": - frel = pedi_type.get(matches[2].lower(),RelLib.Person.CHILD_REL_BIRTH) + frel = pedi_type.get(matches[2].lower(),const.CHILD_BIRTH) # FTW elif matches[1] == "_MREL": - mrel = pedi_type.get(matches[2].lower(),RelLib.Person.CHILD_REL_BIRTH) + mrel = pedi_type.get(matches[2].lower(),const.CHILD_BIRTH) elif matches[1] == "ADOP": - mrel = RelLib.Person.CHILD_REL_ADOPT - frel = RelLib.Person.CHILD_REL_ADOPT + mrel = const.CHILD_ADOPTED + frel = const.CHILD_ADOPTED # Legacy elif matches[1] == "_STAT": - mrel = RelLib.Person.CHILD_REL_BIRTH - frel = RelLib.Person.CHILD_REL_BIRTH + mrel = const.CHILD_BIRTH + frel = const.CHILD_BIRTH #mrel = matches[2] #frel = matches[2] # Legacy _PREF @@ -972,11 +972,11 @@ class GedcomParser: note = self.parse_note(matches,self.person,1,note) elif matches[1] == "SEX": if matches[2] == '': - self.person.set_gender(RelLib.Person.UNKNOWN) + self.person.set_gender(const.UNKNOWN) elif matches[2][0] == "M": - self.person.set_gender(RelLib.Person.MALE) + self.person.set_gender(const.MALE) else: - self.person.set_gender(RelLib.Person.FEMALE) + self.person.set_gender(const.FEMALE) elif matches[1] in [ "BAPL", "ENDL", "SLGC" ]: lds_ord = RelLib.LdsOrd() if matches[1] == "BAPL": @@ -1003,8 +1003,7 @@ class GedcomParser: else: if ftype in rel_types: self.person.add_parent_family_handle( - handle, RelLib.Person.CHILD_REL_BIRTH, - RelLib.Person.CHILD_REL_BIRTH) + handle, const.CHILD_BIRTH, const.CHILD_BIRTH) else: if self.person.get_main_parents_family_handle() == handle: self.person.set_main_parent_family_handle(None) @@ -1130,7 +1129,7 @@ class GedcomParser: return None def parse_famc_type(self,level): - ftype = RelLib.Person.CHILD_REL_BIRTH + ftype = const.CHILD_BIRTH note = "" while 1: matches = self.get_next() @@ -1478,8 +1477,8 @@ class GedcomParser: self.barf(level+1) def parse_adopt_famc(self,level): - mrel = RelLib.Person.CHILD_REL_ADOPT - frel = RelLib.Person.CHILD_REL_ADOPT + mrel = const.CHILD_ADOPTED + frel = const.CHILD_ADOPTED while 1: matches = self.get_next() if int(matches[0]) < level: @@ -1487,9 +1486,9 @@ class GedcomParser: return (mrel,frel) elif matches[1] == "ADOP": if matches[2] == "HUSB": - mrel = RelLib.Person.CHILD_REL_BIRTH + mrel = const.CHILD_BIRTH elif matches[2] == "WIFE": - frel = RelLib.Person.CHILD_REL_BIRTH + frel = const.CHILD_BIRTH else: self.barf(level+1) return None diff --git a/gramps2/src/ReadXML.py b/gramps2/src/ReadXML.py index c1b8193ae..d4bacae55 100644 --- a/gramps2/src/ReadXML.py +++ b/gramps2/src/ReadXML.py @@ -808,16 +808,16 @@ class GrampsParser: try: mrel = const.child_rel_notrans.index(attrs["mrel"]) except: - mrel = RelLib.Person.CHILD_REL_NONE + mrel = const.CHILD_NONE else: - mrel = RelLib.Person.CHILD_REL_BIRTH + mrel = const.CHILD_BIRTH if attrs.has_key("frel"): try: frel = const.child_rel_notrans.index(attrs["frel"]) except: - frel = RelLib.Person.CHILD_REL_NONE + frel = const.CHILD_NONE else: - frel = RelLib.Person.CHILD_REL_BIRTH + frel = const.CHILD_BIRTH self.person.add_parent_family_handle(family.get_handle(),mrel,frel) def start_parentin(self,attrs): @@ -1242,11 +1242,11 @@ class GrampsParser: def stop_gender(self,tag): t = tag if t == "M": - self.person.set_gender (RelLib.Person.MALE) + self.person.set_gender (const.MALE) elif t == "F": - self.person.set_gender (RelLib.Person.FEMALE) + self.person.set_gender (const.FEMALE) else: - self.person.set_gender (RelLib.Person.UNKNOWN) + self.person.set_gender (const.UNKNOWN) def stop_stitle(self,tag): self.source.set_title(tag) diff --git a/gramps2/src/SelectChild.py b/gramps2/src/SelectChild.py index cdc3553c4..d3e707d87 100644 --- a/gramps2/src/SelectChild.py +++ b/gramps2/src/SelectChild.py @@ -2,7 +2,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -89,14 +89,14 @@ class SelectChild: self.mrel = self.xml.get_widget("mrel_combo") self.frel = self.xml.get_widget("frel_combo") - self.build_list(self.mrel,RelLib.Person.CHILD_REL_BIRTH) - self.build_list(self.frel,RelLib.Person.CHILD_REL_BIRTH) + self.build_list(self.mrel,const.CHILD_BIRTH) + self.build_list(self.frel,const.CHILD_BIRTH) if self.family: father = self.db.get_person_from_handle(self.family.get_father_handle()) mother = self.db.get_person_from_handle(self.family.get_mother_handle()) else: - if self.person.get_gender() == RelLib.Person.MALE: + if self.person.get_gender() == const.MALE: self.mrel.set_sensitive(False) else: self.frel.set_sensitive(False) @@ -237,9 +237,9 @@ class SelectChild: for idval in person_list: person = self.db.get_person_from_handle(idval) name = NameDisplay.displayer.display(person) - if person.gender == RelLib.Person.MALE: + if person.gender == const.MALE: gender = _("male") - elif person.gender == RelLib.Person.FEMALE: + elif person.gender == const.FEMALE: gender = _("female") else: gender = _("unknown") @@ -296,7 +296,7 @@ class SelectChild: self.db.add_family(self.family,trans) self.person.add_family_handle(self.family.get_handle()) self.db.commit_person(self.person,trans) - if self.person.get_gender() == RelLib.Person.MALE: + if self.person.get_gender() == const.MALE: self.family.set_father_handle(self.person.get_handle()) else: self.family.set_mother_handle(self.person.get_handle()) @@ -312,15 +312,15 @@ class SelectChild: mrel = self.mrel.get_active() mother = self.db.get_person_from_handle(self.family.get_mother_handle()) - if mother and mother.get_gender() != RelLib.Person.FEMALE: - if mrel == RelLib.Person.CHILD_REL_BIRTH: - mrel = RelLib.Person.CHILD_REL_UNKWN + if mother and mother.get_gender() != const.FEMALE: + if mrel == const.CHILD_BIRTH: + mrel = const.CHILD_UNKNOWN frel = self.frel.get_active() father = self.db.get_person_from_handle(self.family.get_father_handle()) - if father and father.get_gender() !=RelLib.Person.MALE: - if frel == RelLib.Person.CHILD_REL_BIRTH: - frel = RelLib.Person.CHILD_REL_UNKWN + if father and father.get_gender() != const.MALE: + if frel == const.CHILD_BIRTH: + frel = const.CHILD_UNKNOWN select_child.add_parent_family_handle(self.family.get_handle(), mrel,frel) @@ -336,7 +336,7 @@ class SelectChild: self.redraw_child_list(not obj.get_active()) def north_american(self,val): - if self.person.get_gender() == RelLib.Person.MALE: + if self.person.get_gender() == const.MALE: return self.person.get_primary_name().get_surname() elif self.family: f = self.family.get_father_handle() @@ -367,7 +367,7 @@ class SelectChild: def icelandic(self,val): fname = "" - if self.person.get_gender() == RelLib.Person.MALE: + if self.person.get_gender() == const.MALE: fname = self.person.get_primary_name().get_first_name() elif self.family: f = self.family.get_father_handle() diff --git a/gramps2/src/WriteXML.py b/gramps2/src/WriteXML.py index 9a973dacb..c51b7d74c 100644 --- a/gramps2/src/WriteXML.py +++ b/gramps2/src/WriteXML.py @@ -253,9 +253,9 @@ class XmlWriter: count += 1 self.write_id("person",person,2) - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: self.write_line("gender","M",3) - elif person.get_gender() == RelLib.Person.FEMALE: + elif person.get_gender() == const.FEMALE: self.write_line("gender","F",3) else: self.write_line("gender","U",3) @@ -298,11 +298,11 @@ class XmlWriter: self.write_url_list(person.get_url_list()) for alt in person.get_parent_family_handle_list(): - if alt[1] != RelLib.Person.CHILD_REL_BIRTH: + if alt[1] != const.CHILD_BIRTH: mrel=' mrel="%s"' % const.child_rel_notrans[alt[1]] else: mrel='' - if alt[2] != RelLib.Person.CHILD_REL_BIRTH: + if alt[2] != const.CHILD_BIRTH: frel=' frel="%s"' % const.child_rel_notrans[alt[2]] else: frel=''