diff --git a/src/AddSpouse.py b/src/AddSpouse.py index 1356bd7b6..67f435e04 100644 --- a/src/AddSpouse.py +++ b/src/AddSpouse.py @@ -127,7 +127,7 @@ class AddSpouse: "destroy_passed_object" : Utils.destroy_passed_object }) - self.rel_combo.set_active(RelLib.Family.MARRIED) + self.rel_combo.set_active(const.MARRIED) self.update_data() def build_all(self): @@ -140,7 +140,7 @@ class AddSpouse: death_handle = self.person.get_death_handle() filt = GenericFilter.GenericFilter() - if gender == RelLib.Person.MALE: + if gender == const.MALE: filt.add_rule(GenericFilter.IsFemale([])) else: filt.add_rule(GenericFilter.IsMale([])) @@ -204,15 +204,15 @@ class AddSpouse: import EditPerson relation = self.rel_combo.get_active() - if relation == RelLib.Family.CIVIL_UNION: - if self.person.get_gender() == RelLib.Person.MALE: - gen = RelLib.Person.MALE + if relation == const.FAMILY_CIVIL_UNION: + if self.person.get_gender() == const.MALE: + gen = const.MALE else: - gen = RelLib.Person.FEMALE - elif self.person.get_gender() == RelLib.Person.MALE: - gen = RelLib.Person.FEMALE + gen = const.FEMALE + elif self.person.get_gender() == const.MALE: + gen = const.FEMALE else: - gen = RelLib.Person.MALE + gen = const.MALE person = RelLib.Person() person.set_gender(gen) @@ -302,7 +302,7 @@ class AddSpouse: spouse.add_family_handle(self.active_family.get_handle()) self.db.commit_person(spouse,trans) - if self.person.get_gender() == RelLib.Person.MALE: + if self.person.get_gender() == const.MALE: self.active_family.set_mother_handle(spouse.get_handle()) self.active_family.set_father_handle(self.person.get_handle()) else: @@ -373,16 +373,16 @@ class AddSpouse: return 1 def set_gender(self): - if self.rel_combo.get_active() == RelLib.Family.CIVIL_UNION: - if self.gender == RelLib.Person.MALE: - self.sgender = RelLib.Person.FEMALE + if self.rel_combo.get_active() == const.FAMILY_CIVIL_UNION: + if self.gender == const.MALE: + self.sgender = const.FEMALE else: - self.sgender = RelLib.Person.MALE + self.sgender = const.MALE else: - if self.gender == RelLib.Person.MALE: - self.sgender = RelLib.Person.MALE + if self.gender == const.MALE: + self.sgender = const.MALE else: - self.sgender = RelLib.Person.FEMALE + self.sgender = const.FEMALE def update_data(self,person = None): """ diff --git a/src/ChooseParents.py b/src/ChooseParents.py index 5cae04db6..2c62f5648 100644 --- a/src/ChooseParents.py +++ b/src/ChooseParents.py @@ -153,7 +153,7 @@ class ChooseParents: if self.family: self.type = self.family.get_relationship() else: - self.type = RelLib.Family.MARRIED + self.type = const.FAMILY_MARRIED self.prel.set_active(self.type) self.redrawm() @@ -300,7 +300,7 @@ class ChooseParents: self.father_model = PeopleModel.PeopleModel(self.db,self.father_filter) self.father_list.set_model(self.father_model) - if self.type == RelLib.Family.CIVIL_UNION: + if self.type == const.FAMILY_CIVIL_UNION: self.flabel.set_label("%s" % _("Par_ent")) else: self.flabel.set_label("%s" % _("Fath_er")) @@ -310,7 +310,7 @@ class ChooseParents: self.mother_model = PeopleModel.PeopleModel(self.db,self.mother_filter) self.mother_list.set_model(self.mother_model) - if self.type == RelLib.Family.CIVIL_UNION: + if self.type == const.FAMILY_CIVIL_UNION: self.mlabel.set_label("%s" % _("Pa_rent")) else: self.mlabel.set_label("%s" % _("Mothe_r")) @@ -319,8 +319,8 @@ class ChooseParents: """Called everytime the parent relationship information is changed""" self.old_type = self.type self.type = self.prel.get_active() - if (self.old_type == RelLib.Family.CIVIL_UNION or - self.type == RelLib.Family.CIVIL_UNION): + if (self.old_type == const.FAMILY_CIVIL_UNION or + self.type == const.FAMILY_CIVIL_UNION): self.redrawf() self.redrawm() @@ -465,7 +465,7 @@ class ChooseParents: trans = self.db.transaction_begin() if self.father or self.mother: if self.mother and not self.father: - if self.mother.get_gender() == RelLib.Person.MALE: + if self.mother.get_gender() == const.MALE: self.father = self.mother father_handle = self.father.get_handle() self.mother = None @@ -474,7 +474,7 @@ class ChooseParents: mother_handle = self.mother.get_handle() father_handle = None elif self.father and not self.mother: - if self.father.get_gender() == RelLib.Person.FEMALE: + if self.father.get_gender() == const.FEMALE: self.mother = self.father self.father = None mother_handle = self.mother.get_handle() @@ -485,7 +485,7 @@ class ChooseParents: elif self.mother.get_gender() != self.father.get_gender(): if self.type == "Partners": self.type = "Unknown" - if self.father.get_gender() == RelLib.Person.FEMALE: + if self.father.get_gender() == const.FEMALE: self.father, self.mother = self.mother, self.father father_handle = self.father.get_handle() mother_handle = self.mother.get_handle() @@ -519,9 +519,9 @@ class ChooseParents: name = person.get_primary_name().get_surname() self.type = self.prel.get_active() - if self.type == RelLib.Family.CIVIL_UNION: + if self.type == const.FAMILY_CIVIL_UNION: self.parent_relation_changed(self.prel) - elif person.get_gender() == RelLib.Person.MALE: + elif person.get_gender() == const.MALE: try: path = self.father_model.on_get_path(handle) top_path = self.father_model.on_get_path(name) @@ -553,7 +553,7 @@ class ChooseParents: class to create a new person.""" person = RelLib.Person() - person.set_gender(RelLib.Person.MALE) + person.set_gender(const.MALE) try: import EditPerson @@ -643,7 +643,7 @@ class ModifyParents: self.title.set_use_markup(True) - if self.family.get_relationship() == RelLib.Family.CIVIL_UNION: + if self.family.get_relationship() == const.FAMILY_CIVIL_UNION: self.mlabel.set_label("%s" % _("Pa_rent")) self.flabel.set_label("%s" % _("Par_ent")) else: diff --git a/src/EditPerson.py b/src/EditPerson.py index 6a1e4167b..23fec39a1 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -114,7 +114,7 @@ class EditPerson: self.name_display = NameDisplay.displayer self.should_guess_gender = (person.get_gramps_id() == '' and person.get_gender () == - RelLib.Person.UNKNOWN) + const.UNKNOWN) for key in db.get_place_handles(): p = db.get_place_from_handle(key).get_display_info() @@ -761,11 +761,11 @@ class EditPerson: (female,male,unknown) = _select_gender[self.gender.get_active()] - if male and self.person.get_gender() != RelLib.Person.MALE: + if male and self.person.get_gender() != const.MALE: changed = True - elif female and self.person.get_gender() != RelLib.Person.FEMALE: + elif female and self.person.get_gender() != const.FEMALE: changed = True - elif unknown and self.person.get_gender() != RelLib.Person.UNKNOWN: + elif unknown and self.person.get_gender() != const.UNKNOWN: changed = True if text != self.person.get_note(): changed = True @@ -865,7 +865,7 @@ class EditPerson: def on_apply_person_clicked(self,obj): - if self.gender.get_active() == RelLib.Person.UNKNOWN: + if self.gender.get_active() == const.UNKNOWN: dialog = QuestionDialog2( _("Unknown gender specified"), _("The gender of the person is currently unknown. " @@ -956,8 +956,8 @@ class EditPerson: error = False (female,male,unknown) = _select_gender[self.gender.get_active()] - if male and self.person.get_gender() != RelLib.Person.MALE: - self.person.set_gender(RelLib.Person.MALE) + if male and self.person.get_gender() != const.MALE: + self.person.set_gender(const.MALE) for temp_family_handle in self.person.get_family_handle_list(): temp_family = self.db.get_family_from_handle(temp_family_handle) if self.person == temp_family.get_mother_handle(): @@ -966,8 +966,8 @@ class EditPerson: else: temp_family.set_mother_handle(None) temp_family.set_father_handle(self.person) - elif female and self.person.get_gender() != RelLib.Person.FEMALE: - self.person.set_gender(RelLib.Person.FEMALE) + elif female and self.person.get_gender() != const.FEMALE: + self.person.set_gender(const.FEMALE) for temp_family_handle in self.person.get_family_handle_list(): temp_family = self.db.get_family_from_handle(temp_family_handle) if self.person == temp_family.get_father_handle(): @@ -976,8 +976,8 @@ class EditPerson: else: temp_family.set_father_handle(None) temp_family.set_mother_handle(self.person) - elif unknown and self.person.get_gender() != RelLib.Person.UNKNOWN: - self.person.set_gender(RelLib.Person.UNKNOWN) + elif unknown and self.person.get_gender() != const.UNKNOWN: + self.person.set_gender(const.UNKNOWN) for temp_family_handle in self.person.get_family_handle_list(): temp_family = self.db.get_family_from_handle(temp_family_handle) if self.person == temp_family.get_father_handle(): diff --git a/src/GenericFilter.py b/src/GenericFilter.py index 0b38e18f6..48c7f5c32 100644 --- a/src/GenericFilter.py +++ b/src/GenericFilter.py @@ -328,7 +328,7 @@ class IsFemale(Rule): description = _('Matches all females') def apply(self,db,handle): - return db.get_person_from_handle(handle).get_gender() == RelLib.Person.FEMALE + return db.get_person_from_handle(handle).get_gender() == const.FEMALE #------------------------------------------------------------------------- # @@ -343,7 +343,7 @@ class HasUnknownGender(Rule): description = _('Matches all people with unknown gender') def apply(self,db,handle): - return db.get_person_from_handle(handle).get_gender() == RelLib.Person.UNKNOWN + return db.get_person_from_handle(handle).get_gender() == const.UNKNOWN #------------------------------------------------------------------------- # @@ -970,7 +970,7 @@ class IsMale(Rule): description = _('Matches all males') def apply(self,db,handle): - return db.get_person_from_handle(handle).get_gender() == RelLib.Person.MALE + return db.get_person_from_handle(handle).get_gender() == const.MALE #------------------------------------------------------------------------- # @@ -1415,7 +1415,7 @@ class HaveAltFamilies(Rule): def apply(self,db,handle): p = db.get_person_from_handle(handle) for (fam,rel1,rel2) in p.get_parent_family_handle_list(): - if rel1 == RelLib.Person.CHILD_REL_ADOPT or rel2 == RelLib.Person.CHILD_REL_ADOPT: + if rel1 == const.CHILD_ADOPTED or rel2 == const.CHILD_ADOPTED: return 1 return 0 diff --git a/src/ReadGedcom.py b/src/ReadGedcom.py index ac8153e5b..1a1a15c1d 100644 --- a/src/ReadGedcom.py +++ b/src/ReadGedcom.py @@ -884,7 +884,7 @@ class GedcomParser: except: event.set_name(matches[1]) if event.get_name() == "Marriage": - self.family.set_relationship(RelLib.Family.MARRIED) + self.family.set_relationship(const.FAMILY_MARRIED) self.db.add_event(event,self.trans) self.family.add_event_handle(event.get_handle()) self.parse_family_event(event,2) @@ -1138,7 +1138,7 @@ class GedcomParser: self.backup() return (ftype,note) elif matches[1] == "PEDI": - ftype = pedi_type.get(matches[2],RelLib.Person.UNKNOWN) + ftype = pedi_type.get(matches[2],const.UNKNOWN) elif matches[1] == "SOUR": source_ref = self.handle_source(matches,level+1) self.person.get_primary_name().add_source_reference(source_ref) diff --git a/src/ReadXML.py b/src/ReadXML.py index d4bacae55..6a3fad77f 100644 --- a/src/ReadXML.py +++ b/src/ReadXML.py @@ -792,7 +792,7 @@ class GrampsParser: if attrs.has_key("type"): self.family.set_relationship( _FAMILY_TRANS.get(attrs["type"], - RelLib.Family.UNKNOWN)) + const.FAMILY_UNKNOWN)) if attrs.has_key("complete"): self.family.set_complete_flag(int(attrs['complete'])) else: diff --git a/src/Relationship.py b/src/Relationship.py index 6386d0f12..0297769a3 100644 --- a/src/Relationship.py +++ b/src/Relationship.py @@ -322,22 +322,22 @@ class RelationshipCalculator: if firstRel == 0: if secondRel == 0: return ('',common) - elif other_person.get_gender() == RelLib.Person.MALE: + elif other_person.get_gender() == const.MALE: return (self.get_father(secondRel),common) else: return (self.get_mother(secondRel),common) elif secondRel == 0: - if other_person.get_gender() == RelLib.Person.MALE: + if other_person.get_gender() == const.MALE: return (self.get_son(firstRel),common) else: return (self.get_daughter(firstRel),common) elif firstRel == 1: - if other_person.get_gender() == RelLib.Person.MALE: + if other_person.get_gender() == const.MALE: return (self.get_uncle(secondRel),common) else: return (self.get_aunt(secondRel),common) elif secondRel == 1: - if other_person.get_gender() == RelLib.Person.MALE: + if other_person.get_gender() == const.MALE: return (self.get_nephew(firstRel-1),common) else: return (self.get_niece(firstRel-1),common) diff --git a/src/ReportUtils.py b/src/ReportUtils.py index ea281f636..7582b7fdf 100644 --- a/src/ReportUtils.py +++ b/src/ReportUtils.py @@ -499,7 +499,7 @@ def born_died_str(database,person,endnotes=None,name_object=None,person_name=Non if person_name == None: person_name = _nd.display_name(name_object) elif person_name == 0: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: person_name = _('He') else: person_name = _('She') @@ -510,7 +510,7 @@ def born_died_str(database,person,endnotes=None,name_object=None,person_name=Non birth = database.get_event_from_handle(person.get_birth_handle()) death = database.get_event_from_handle(person.get_death_handle()) - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: if bdate: if bplace: if ddate: @@ -817,7 +817,7 @@ def married_str(database,person,spouse,event,endnotes=None, text = "" if is_first: if date and place: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: text = _('He married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { 'spouse' : spouse_name, 'endnotes' : endnotes(event), @@ -830,7 +830,7 @@ def married_str(database,person,spouse,event,endnotes=None, 'endnotes' : endnotes(event), 'place' : place} elif date: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: text = _('He married %(spouse)s %(date)s%(endnotes)s.') % { 'spouse' : spouse_name, 'endnotes' : endnotes(event), @@ -841,7 +841,7 @@ def married_str(database,person,spouse,event,endnotes=None, 'endnotes' : endnotes(event), 'place' : place,} elif place: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: text = _('He married %(spouse)s in %(place)s%(endnotes)s.') % { 'spouse' : spouse_name, 'endnotes' : endnotes(event), @@ -852,7 +852,7 @@ def married_str(database,person,spouse,event,endnotes=None, 'endnotes' : endnotes(event), 'place' : place} else: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: text = _('He married %(spouse)s%(endnotes)s.') % { 'spouse' : spouse_name, 'endnotes' : endnotes(event) } @@ -862,7 +862,7 @@ def married_str(database,person,spouse,event,endnotes=None, 'endnotes' : endnotes(event)} else: if date and place: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: text = _('He also married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { 'spouse' : spouse_name, 'endnotes' : endnotes(event), @@ -875,7 +875,7 @@ def married_str(database,person,spouse,event,endnotes=None, 'endnotes' : endnotes(event), 'place' : place} elif date: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: text = _('He also married %(spouse)s %(date)s%(endnotes)s.') % { 'spouse' : spouse_name, 'endnotes' : endnotes(event), @@ -886,7 +886,7 @@ def married_str(database,person,spouse,event,endnotes=None, 'endnotes' : endnotes(event), 'place' : place,} elif place: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: text = _('He also married %(spouse)s in %(place)s%(endnotes)s.') % { 'spouse' : spouse_name, 'endnotes' : endnotes(event), @@ -897,7 +897,7 @@ def married_str(database,person,spouse,event,endnotes=None, 'endnotes' : endnotes(event), 'place' : place} else: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: text = _('He also married %(spouse)s%(endnotes)s.') % { 'spouse' : spouse_name, 'endnotes' : endnotes(event) } @@ -921,26 +921,26 @@ def married_rel_str(database,person,family,is_first=True): spouse_name = _nd.display(spouse) if is_first: - if family.get_relationship() == RelLib.Family.MARRIED: - if person.get_gender() == RelLib.Person.MALE: + if family.get_relationship() == const.FAMILY_MARRIED: + if person.get_gender() == const.MALE: text = _('He married %(spouse)s.') % { 'spouse' : spouse_name } else: text = _('She married %(spouse)s.') % { 'spouse' : spouse_name } else: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: text = _('He had relationship with %(spouse)s.') % { 'spouse' : spouse_name } else: text = _('She had relationship with %(spouse)s.') % { 'spouse' : spouse_name } else: - if family.get_relationship() == RelLib.Family.MARRIED: - if person.get_gender() == RelLib.Person.MALE: + if family.get_relationship() == const.FAMILY_MARRIED: + if person.get_gender() == const.MALE: text = _('He also married %(spouse)s.') % { 'spouse' : spouse_name } else: text = _('She also married %(spouse)s.') % { 'spouse' : spouse_name } else: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: text = _('He also had relationship with %(spouse)s.') % { 'spouse' : spouse_name } else: @@ -972,7 +972,7 @@ def child_str(person,father_name="",mother_name="",dead=0): text = "" - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: if mother_name and father_name: if dead: text = _("He was the son of %(father)s and %(mother)s.") % { @@ -1053,7 +1053,7 @@ def born_str(database,person,person_name=None,empty_date="",empty_place=""): if person_name == None: person_name = _nd.display_name(person.get_primary_name()) elif person_name == 0: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: person_name = _('He') else: person_name = _('She') @@ -1063,7 +1063,7 @@ def born_str(database,person,person_name=None,empty_date="",empty_place=""): bdate,bplace,bdate_full,ddate,dplace,ddate_full = \ get_birth_death_strings(database,person,empty_date,empty_place) - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: if bdate and bdate_full: if bplace: #male, date, place text = _("%(male_name)s " @@ -1151,7 +1151,7 @@ def died_str(database,person,person_name=None,empty_date="",empty_place="", if person_name == None: person_name = _nd.display_name(person.get_primary_name()) elif person_name == 0: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: person_name = _('He') else: person_name = _('She') @@ -1161,7 +1161,7 @@ def died_str(database,person,person_name=None,empty_date="",empty_place="", bdate,bplace,bdate_full,ddate,dplace,ddate_full = \ get_birth_death_strings(database,person,empty_date,empty_place) - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: if ddate and ddate_full: if dplace: if not age_units: #male, date, place, no age @@ -1442,7 +1442,7 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""): if person_name == None: person_name = _nd.display_name(person.get_primary_name()) elif person_name == 0: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: person_name = _('He') else: person_name = _('She') @@ -1470,7 +1470,7 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""): else: return text - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: if bdate and bdate_full: if bplace: #male, date, place text = _("%(male_name)s " @@ -1535,7 +1535,7 @@ def list_person_str(database,person,person_name=None,empty_date="",empty_place=" if person_name == None: person_name = _nd.display_name(person.get_primary_name()) elif person_name == 0: - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: person_name = _('He') else: person_name = _('She') @@ -1545,7 +1545,7 @@ def list_person_str(database,person,person_name=None,empty_date="",empty_place=" text = "" - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: if bdate: if bplace: if ddate: @@ -1750,11 +1750,11 @@ def list_person_str(database,person,person_name=None,empty_date="",empty_place=" _rtype = { - RelLib.Family.MARRIED : _("Married"), - RelLib.Family.UNMARRIED : _("Unmarried"), - RelLib.Family.CIVIL_UNION : _("Civil Union"), - RelLib.Family.UNKNOWN : _("Unknown"), - RelLib.Family.OTHER : _("Other"), + const.FAMILY_MARRIED : _("Married"), + const.FAMILY_UNMARRIED : _("Unmarried"), + const.FAMILY_CIVIL_UNION : _("Civil Union"), + const.FAMILY_UNKNOWN : _("Unknown"), + const.FAMILY_CUSTOM : _("Other"), } def relationship_name(rtype): diff --git a/src/WriteGedcom.py b/src/WriteGedcom.py index 094c0abb4..88c0f6c5a 100644 --- a/src/WriteGedcom.py +++ b/src/WriteGedcom.py @@ -789,9 +789,9 @@ class GedcomWriter: for name in person.get_alternate_names(): self.write_person_name(name,"") - if person.get_gender() == RelLib.Person.MALE: + if person.get_gender() == const.MALE: self.writeln("1 SEX M") - elif person.get_gender() == RelLib.Person.FEMALE: + elif person.get_gender() == const.FEMALE: self.writeln("1 SEX F") if not restricted: @@ -843,8 +843,8 @@ class GedcomWriter: for f in person.get_parent_family_handle_list(): mrel = f[1] frel = f[2] - if (mrel == RelLib.Person.CHILD_REL_ADOPT or - frel == RelLib.Person.CHILD_REL_ADOPT): + if (mrel == const.CHILD_ADOPTED or + frel == const.CHILD_ADOPTED): fam = f[0] break if fam: @@ -870,8 +870,8 @@ class GedcomWriter: for f in person.get_parent_family_handle_list(): mrel = f[1] frel = f[2] - if (mrel == RelLib.Person.CHILD_REL_ADOPT or - frel == RelLib.Person.CHILD_REL_ADOPT): + if (mrel == const.CHILD_ADOPTED or + frel == const.CHILD_ADOPTED): fam = f[0] break if fam: @@ -973,7 +973,7 @@ class GedcomWriter: if self.flist.has_key(family[0]): self.writeln("1 FAMC @%s@" % self.fid(family[0])) if self.adopt == GedcomInfo.ADOPT_PEDI: - if family[1] == RelLib.Person.CHILD_REL_ADOPT: + if family[1] == const.CHILD_ADOPTED: self.writeln("2 PEDI Adopted") for family_handle in person.get_family_handle_list():