Fix constants

svn: r4724
This commit is contained in:
Alex Roitman 2005-05-28 02:55:21 +00:00
parent bb50c0f5df
commit 5fda37f10f
9 changed files with 88 additions and 88 deletions

View File

@ -127,7 +127,7 @@ class AddSpouse:
"destroy_passed_object" : Utils.destroy_passed_object "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() self.update_data()
def build_all(self): def build_all(self):
@ -140,7 +140,7 @@ class AddSpouse:
death_handle = self.person.get_death_handle() death_handle = self.person.get_death_handle()
filt = GenericFilter.GenericFilter() filt = GenericFilter.GenericFilter()
if gender == RelLib.Person.MALE: if gender == const.MALE:
filt.add_rule(GenericFilter.IsFemale([])) filt.add_rule(GenericFilter.IsFemale([]))
else: else:
filt.add_rule(GenericFilter.IsMale([])) filt.add_rule(GenericFilter.IsMale([]))
@ -204,15 +204,15 @@ class AddSpouse:
import EditPerson import EditPerson
relation = self.rel_combo.get_active() relation = self.rel_combo.get_active()
if relation == RelLib.Family.CIVIL_UNION: if relation == const.FAMILY_CIVIL_UNION:
if self.person.get_gender() == RelLib.Person.MALE: if self.person.get_gender() == const.MALE:
gen = RelLib.Person.MALE gen = const.MALE
else: else:
gen = RelLib.Person.FEMALE gen = const.FEMALE
elif self.person.get_gender() == RelLib.Person.MALE: elif self.person.get_gender() == const.MALE:
gen = RelLib.Person.FEMALE gen = const.FEMALE
else: else:
gen = RelLib.Person.MALE gen = const.MALE
person = RelLib.Person() person = RelLib.Person()
person.set_gender(gen) person.set_gender(gen)
@ -302,7 +302,7 @@ class AddSpouse:
spouse.add_family_handle(self.active_family.get_handle()) spouse.add_family_handle(self.active_family.get_handle())
self.db.commit_person(spouse,trans) 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_mother_handle(spouse.get_handle())
self.active_family.set_father_handle(self.person.get_handle()) self.active_family.set_father_handle(self.person.get_handle())
else: else:
@ -373,16 +373,16 @@ class AddSpouse:
return 1 return 1
def set_gender(self): def set_gender(self):
if self.rel_combo.get_active() == RelLib.Family.CIVIL_UNION: if self.rel_combo.get_active() == const.FAMILY_CIVIL_UNION:
if self.gender == RelLib.Person.MALE: if self.gender == const.MALE:
self.sgender = RelLib.Person.FEMALE self.sgender = const.FEMALE
else: else:
self.sgender = RelLib.Person.MALE self.sgender = const.MALE
else: else:
if self.gender == RelLib.Person.MALE: if self.gender == const.MALE:
self.sgender = RelLib.Person.MALE self.sgender = const.MALE
else: else:
self.sgender = RelLib.Person.FEMALE self.sgender = const.FEMALE
def update_data(self,person = None): def update_data(self,person = None):
""" """

View File

@ -153,7 +153,7 @@ class ChooseParents:
if self.family: if self.family:
self.type = self.family.get_relationship() self.type = self.family.get_relationship()
else: else:
self.type = RelLib.Family.MARRIED self.type = const.FAMILY_MARRIED
self.prel.set_active(self.type) self.prel.set_active(self.type)
self.redrawm() self.redrawm()
@ -300,7 +300,7 @@ class ChooseParents:
self.father_model = PeopleModel.PeopleModel(self.db,self.father_filter) self.father_model = PeopleModel.PeopleModel(self.db,self.father_filter)
self.father_list.set_model(self.father_model) 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("<b>%s</b>" % _("Par_ent")) self.flabel.set_label("<b>%s</b>" % _("Par_ent"))
else: else:
self.flabel.set_label("<b>%s</b>" % _("Fath_er")) self.flabel.set_label("<b>%s</b>" % _("Fath_er"))
@ -310,7 +310,7 @@ class ChooseParents:
self.mother_model = PeopleModel.PeopleModel(self.db,self.mother_filter) self.mother_model = PeopleModel.PeopleModel(self.db,self.mother_filter)
self.mother_list.set_model(self.mother_model) 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("<b>%s</b>" % _("Pa_rent")) self.mlabel.set_label("<b>%s</b>" % _("Pa_rent"))
else: else:
self.mlabel.set_label("<b>%s</b>" % _("Mothe_r")) self.mlabel.set_label("<b>%s</b>" % _("Mothe_r"))
@ -319,8 +319,8 @@ class ChooseParents:
"""Called everytime the parent relationship information is changed""" """Called everytime the parent relationship information is changed"""
self.old_type = self.type self.old_type = self.type
self.type = self.prel.get_active() self.type = self.prel.get_active()
if (self.old_type == RelLib.Family.CIVIL_UNION or if (self.old_type == const.FAMILY_CIVIL_UNION or
self.type == RelLib.Family.CIVIL_UNION): self.type == const.FAMILY_CIVIL_UNION):
self.redrawf() self.redrawf()
self.redrawm() self.redrawm()
@ -465,7 +465,7 @@ class ChooseParents:
trans = self.db.transaction_begin() trans = self.db.transaction_begin()
if self.father or self.mother: if self.father or self.mother:
if self.mother and not self.father: 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 self.father = self.mother
father_handle = self.father.get_handle() father_handle = self.father.get_handle()
self.mother = None self.mother = None
@ -474,7 +474,7 @@ class ChooseParents:
mother_handle = self.mother.get_handle() mother_handle = self.mother.get_handle()
father_handle = None father_handle = None
elif self.father and not self.mother: 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.mother = self.father
self.father = None self.father = None
mother_handle = self.mother.get_handle() mother_handle = self.mother.get_handle()
@ -485,7 +485,7 @@ class ChooseParents:
elif self.mother.get_gender() != self.father.get_gender(): elif self.mother.get_gender() != self.father.get_gender():
if self.type == "Partners": if self.type == "Partners":
self.type = "Unknown" 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 self.father, self.mother = self.mother, self.father
father_handle = self.father.get_handle() father_handle = self.father.get_handle()
mother_handle = self.mother.get_handle() mother_handle = self.mother.get_handle()
@ -519,9 +519,9 @@ class ChooseParents:
name = person.get_primary_name().get_surname() name = person.get_primary_name().get_surname()
self.type = self.prel.get_active() 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) self.parent_relation_changed(self.prel)
elif person.get_gender() == RelLib.Person.MALE: elif person.get_gender() == const.MALE:
try: try:
path = self.father_model.on_get_path(handle) path = self.father_model.on_get_path(handle)
top_path = self.father_model.on_get_path(name) top_path = self.father_model.on_get_path(name)
@ -553,7 +553,7 @@ class ChooseParents:
class to create a new person.""" class to create a new person."""
person = RelLib.Person() person = RelLib.Person()
person.set_gender(RelLib.Person.MALE) person.set_gender(const.MALE)
try: try:
import EditPerson import EditPerson
@ -643,7 +643,7 @@ class ModifyParents:
self.title.set_use_markup(True) 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("<b>%s</b>" % _("Pa_rent")) self.mlabel.set_label("<b>%s</b>" % _("Pa_rent"))
self.flabel.set_label("<b>%s</b>" % _("Par_ent")) self.flabel.set_label("<b>%s</b>" % _("Par_ent"))
else: else:

View File

@ -114,7 +114,7 @@ class EditPerson:
self.name_display = NameDisplay.displayer self.name_display = NameDisplay.displayer
self.should_guess_gender = (person.get_gramps_id() == '' and self.should_guess_gender = (person.get_gramps_id() == '' and
person.get_gender () == person.get_gender () ==
RelLib.Person.UNKNOWN) const.UNKNOWN)
for key in db.get_place_handles(): for key in db.get_place_handles():
p = db.get_place_from_handle(key).get_display_info() 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()] (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 changed = True
elif female and self.person.get_gender() != RelLib.Person.FEMALE: elif female and self.person.get_gender() != const.FEMALE:
changed = True changed = True
elif unknown and self.person.get_gender() != RelLib.Person.UNKNOWN: elif unknown and self.person.get_gender() != const.UNKNOWN:
changed = True changed = True
if text != self.person.get_note(): if text != self.person.get_note():
changed = True changed = True
@ -865,7 +865,7 @@ class EditPerson:
def on_apply_person_clicked(self,obj): def on_apply_person_clicked(self,obj):
if self.gender.get_active() == RelLib.Person.UNKNOWN: if self.gender.get_active() == const.UNKNOWN:
dialog = QuestionDialog2( dialog = QuestionDialog2(
_("Unknown gender specified"), _("Unknown gender specified"),
_("The gender of the person is currently unknown. " _("The gender of the person is currently unknown. "
@ -956,8 +956,8 @@ class EditPerson:
error = False error = False
(female,male,unknown) = _select_gender[self.gender.get_active()] (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:
self.person.set_gender(RelLib.Person.MALE) self.person.set_gender(const.MALE)
for temp_family_handle in self.person.get_family_handle_list(): for temp_family_handle in self.person.get_family_handle_list():
temp_family = self.db.get_family_from_handle(temp_family_handle) temp_family = self.db.get_family_from_handle(temp_family_handle)
if self.person == temp_family.get_mother_handle(): if self.person == temp_family.get_mother_handle():
@ -966,8 +966,8 @@ class EditPerson:
else: else:
temp_family.set_mother_handle(None) temp_family.set_mother_handle(None)
temp_family.set_father_handle(self.person) temp_family.set_father_handle(self.person)
elif female and self.person.get_gender() != RelLib.Person.FEMALE: elif female and self.person.get_gender() != const.FEMALE:
self.person.set_gender(RelLib.Person.FEMALE) self.person.set_gender(const.FEMALE)
for temp_family_handle in self.person.get_family_handle_list(): for temp_family_handle in self.person.get_family_handle_list():
temp_family = self.db.get_family_from_handle(temp_family_handle) temp_family = self.db.get_family_from_handle(temp_family_handle)
if self.person == temp_family.get_father_handle(): if self.person == temp_family.get_father_handle():
@ -976,8 +976,8 @@ class EditPerson:
else: else:
temp_family.set_father_handle(None) temp_family.set_father_handle(None)
temp_family.set_mother_handle(self.person) temp_family.set_mother_handle(self.person)
elif unknown and self.person.get_gender() != RelLib.Person.UNKNOWN: elif unknown and self.person.get_gender() != const.UNKNOWN:
self.person.set_gender(RelLib.Person.UNKNOWN) self.person.set_gender(const.UNKNOWN)
for temp_family_handle in self.person.get_family_handle_list(): for temp_family_handle in self.person.get_family_handle_list():
temp_family = self.db.get_family_from_handle(temp_family_handle) temp_family = self.db.get_family_from_handle(temp_family_handle)
if self.person == temp_family.get_father_handle(): if self.person == temp_family.get_father_handle():

View File

@ -328,7 +328,7 @@ class IsFemale(Rule):
description = _('Matches all females') description = _('Matches all females')
def apply(self,db,handle): 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') description = _('Matches all people with unknown gender')
def apply(self,db,handle): 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') description = _('Matches all males')
def apply(self,db,handle): 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): def apply(self,db,handle):
p = db.get_person_from_handle(handle) p = db.get_person_from_handle(handle)
for (fam,rel1,rel2) in p.get_parent_family_handle_list(): 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 1
return 0 return 0

View File

@ -884,7 +884,7 @@ class GedcomParser:
except: except:
event.set_name(matches[1]) event.set_name(matches[1])
if event.get_name() == "Marriage": 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.db.add_event(event,self.trans)
self.family.add_event_handle(event.get_handle()) self.family.add_event_handle(event.get_handle())
self.parse_family_event(event,2) self.parse_family_event(event,2)
@ -1138,7 +1138,7 @@ class GedcomParser:
self.backup() self.backup()
return (ftype,note) return (ftype,note)
elif matches[1] == "PEDI": 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": elif matches[1] == "SOUR":
source_ref = self.handle_source(matches,level+1) source_ref = self.handle_source(matches,level+1)
self.person.get_primary_name().add_source_reference(source_ref) self.person.get_primary_name().add_source_reference(source_ref)

View File

@ -792,7 +792,7 @@ class GrampsParser:
if attrs.has_key("type"): if attrs.has_key("type"):
self.family.set_relationship( self.family.set_relationship(
_FAMILY_TRANS.get(attrs["type"], _FAMILY_TRANS.get(attrs["type"],
RelLib.Family.UNKNOWN)) const.FAMILY_UNKNOWN))
if attrs.has_key("complete"): if attrs.has_key("complete"):
self.family.set_complete_flag(int(attrs['complete'])) self.family.set_complete_flag(int(attrs['complete']))
else: else:

View File

@ -322,22 +322,22 @@ class RelationshipCalculator:
if firstRel == 0: if firstRel == 0:
if secondRel == 0: if secondRel == 0:
return ('',common) return ('',common)
elif other_person.get_gender() == RelLib.Person.MALE: elif other_person.get_gender() == const.MALE:
return (self.get_father(secondRel),common) return (self.get_father(secondRel),common)
else: else:
return (self.get_mother(secondRel),common) return (self.get_mother(secondRel),common)
elif secondRel == 0: elif secondRel == 0:
if other_person.get_gender() == RelLib.Person.MALE: if other_person.get_gender() == const.MALE:
return (self.get_son(firstRel),common) return (self.get_son(firstRel),common)
else: else:
return (self.get_daughter(firstRel),common) return (self.get_daughter(firstRel),common)
elif firstRel == 1: elif firstRel == 1:
if other_person.get_gender() == RelLib.Person.MALE: if other_person.get_gender() == const.MALE:
return (self.get_uncle(secondRel),common) return (self.get_uncle(secondRel),common)
else: else:
return (self.get_aunt(secondRel),common) return (self.get_aunt(secondRel),common)
elif secondRel == 1: 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) return (self.get_nephew(firstRel-1),common)
else: else:
return (self.get_niece(firstRel-1),common) return (self.get_niece(firstRel-1),common)

View File

@ -499,7 +499,7 @@ def born_died_str(database,person,endnotes=None,name_object=None,person_name=Non
if person_name == None: if person_name == None:
person_name = _nd.display_name(name_object) person_name = _nd.display_name(name_object)
elif person_name == 0: elif person_name == 0:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
person_name = _('He') person_name = _('He')
else: else:
person_name = _('She') 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()) birth = database.get_event_from_handle(person.get_birth_handle())
death = database.get_event_from_handle(person.get_death_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 bdate:
if bplace: if bplace:
if ddate: if ddate:
@ -817,7 +817,7 @@ def married_str(database,person,spouse,event,endnotes=None,
text = "" text = ""
if is_first: if is_first:
if date and place: 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.') % { text = _('He married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % {
'spouse' : spouse_name, 'spouse' : spouse_name,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
@ -830,7 +830,7 @@ def married_str(database,person,spouse,event,endnotes=None,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
'place' : place} 'place' : place}
elif date: elif date:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
text = _('He married %(spouse)s %(date)s%(endnotes)s.') % { text = _('He married %(spouse)s %(date)s%(endnotes)s.') % {
'spouse' : spouse_name, 'spouse' : spouse_name,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
@ -841,7 +841,7 @@ def married_str(database,person,spouse,event,endnotes=None,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
'place' : place,} 'place' : place,}
elif 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.') % { text = _('He married %(spouse)s in %(place)s%(endnotes)s.') % {
'spouse' : spouse_name, 'spouse' : spouse_name,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
@ -852,7 +852,7 @@ def married_str(database,person,spouse,event,endnotes=None,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
'place' : place} 'place' : place}
else: else:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
text = _('He married %(spouse)s%(endnotes)s.') % { text = _('He married %(spouse)s%(endnotes)s.') % {
'spouse' : spouse_name, 'spouse' : spouse_name,
'endnotes' : endnotes(event) } 'endnotes' : endnotes(event) }
@ -862,7 +862,7 @@ def married_str(database,person,spouse,event,endnotes=None,
'endnotes' : endnotes(event)} 'endnotes' : endnotes(event)}
else: else:
if date and place: 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.') % { text = _('He also married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % {
'spouse' : spouse_name, 'spouse' : spouse_name,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
@ -875,7 +875,7 @@ def married_str(database,person,spouse,event,endnotes=None,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
'place' : place} 'place' : place}
elif date: 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.') % { text = _('He also married %(spouse)s %(date)s%(endnotes)s.') % {
'spouse' : spouse_name, 'spouse' : spouse_name,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
@ -886,7 +886,7 @@ def married_str(database,person,spouse,event,endnotes=None,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
'place' : place,} 'place' : place,}
elif 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.') % { text = _('He also married %(spouse)s in %(place)s%(endnotes)s.') % {
'spouse' : spouse_name, 'spouse' : spouse_name,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
@ -897,7 +897,7 @@ def married_str(database,person,spouse,event,endnotes=None,
'endnotes' : endnotes(event), 'endnotes' : endnotes(event),
'place' : place} 'place' : place}
else: else:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
text = _('He also married %(spouse)s%(endnotes)s.') % { text = _('He also married %(spouse)s%(endnotes)s.') % {
'spouse' : spouse_name, 'spouse' : spouse_name,
'endnotes' : endnotes(event) } 'endnotes' : endnotes(event) }
@ -921,26 +921,26 @@ def married_rel_str(database,person,family,is_first=True):
spouse_name = _nd.display(spouse) spouse_name = _nd.display(spouse)
if is_first: if is_first:
if family.get_relationship() == RelLib.Family.MARRIED: if family.get_relationship() == const.FAMILY_MARRIED:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
text = _('He married %(spouse)s.') % { 'spouse' : spouse_name } text = _('He married %(spouse)s.') % { 'spouse' : spouse_name }
else: else:
text = _('She married %(spouse)s.') % { 'spouse' : spouse_name } text = _('She married %(spouse)s.') % { 'spouse' : spouse_name }
else: else:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
text = _('He had relationship with %(spouse)s.') % { text = _('He had relationship with %(spouse)s.') % {
'spouse' : spouse_name } 'spouse' : spouse_name }
else: else:
text = _('She had relationship with %(spouse)s.') % { text = _('She had relationship with %(spouse)s.') % {
'spouse' : spouse_name } 'spouse' : spouse_name }
else: else:
if family.get_relationship() == RelLib.Family.MARRIED: if family.get_relationship() == const.FAMILY_MARRIED:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
text = _('He also married %(spouse)s.') % { 'spouse' : spouse_name } text = _('He also married %(spouse)s.') % { 'spouse' : spouse_name }
else: else:
text = _('She also married %(spouse)s.') % { 'spouse' : spouse_name } text = _('She also married %(spouse)s.') % { 'spouse' : spouse_name }
else: else:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
text = _('He also had relationship with %(spouse)s.') % { text = _('He also had relationship with %(spouse)s.') % {
'spouse' : spouse_name } 'spouse' : spouse_name }
else: else:
@ -972,7 +972,7 @@ def child_str(person,father_name="",mother_name="",dead=0):
text = "" text = ""
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
if mother_name and father_name: if mother_name and father_name:
if dead: if dead:
text = _("He was the son of %(father)s and %(mother)s.") % { 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: if person_name == None:
person_name = _nd.display_name(person.get_primary_name()) person_name = _nd.display_name(person.get_primary_name())
elif person_name == 0: elif person_name == 0:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
person_name = _('He') person_name = _('He')
else: else:
person_name = _('She') 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 = \ bdate,bplace,bdate_full,ddate,dplace,ddate_full = \
get_birth_death_strings(database,person,empty_date,empty_place) 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 bdate and bdate_full:
if bplace: #male, date, place if bplace: #male, date, place
text = _("%(male_name)s " text = _("%(male_name)s "
@ -1151,7 +1151,7 @@ def died_str(database,person,person_name=None,empty_date="",empty_place="",
if person_name == None: if person_name == None:
person_name = _nd.display_name(person.get_primary_name()) person_name = _nd.display_name(person.get_primary_name())
elif person_name == 0: elif person_name == 0:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
person_name = _('He') person_name = _('He')
else: else:
person_name = _('She') 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 = \ bdate,bplace,bdate_full,ddate,dplace,ddate_full = \
get_birth_death_strings(database,person,empty_date,empty_place) 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 ddate and ddate_full:
if dplace: if dplace:
if not age_units: #male, date, place, no age 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: if person_name == None:
person_name = _nd.display_name(person.get_primary_name()) person_name = _nd.display_name(person.get_primary_name())
elif person_name == 0: elif person_name == 0:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
person_name = _('He') person_name = _('He')
else: else:
person_name = _('She') person_name = _('She')
@ -1470,7 +1470,7 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""):
else: else:
return text return text
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
if bdate and bdate_full: if bdate and bdate_full:
if bplace: #male, date, place if bplace: #male, date, place
text = _("%(male_name)s " 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: if person_name == None:
person_name = _nd.display_name(person.get_primary_name()) person_name = _nd.display_name(person.get_primary_name())
elif person_name == 0: elif person_name == 0:
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
person_name = _('He') person_name = _('He')
else: else:
person_name = _('She') person_name = _('She')
@ -1545,7 +1545,7 @@ def list_person_str(database,person,person_name=None,empty_date="",empty_place="
text = "" text = ""
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
if bdate: if bdate:
if bplace: if bplace:
if ddate: if ddate:
@ -1750,11 +1750,11 @@ def list_person_str(database,person,person_name=None,empty_date="",empty_place="
_rtype = { _rtype = {
RelLib.Family.MARRIED : _("Married"), const.FAMILY_MARRIED : _("Married"),
RelLib.Family.UNMARRIED : _("Unmarried"), const.FAMILY_UNMARRIED : _("Unmarried"),
RelLib.Family.CIVIL_UNION : _("Civil Union"), const.FAMILY_CIVIL_UNION : _("Civil Union"),
RelLib.Family.UNKNOWN : _("Unknown"), const.FAMILY_UNKNOWN : _("Unknown"),
RelLib.Family.OTHER : _("Other"), const.FAMILY_CUSTOM : _("Other"),
} }
def relationship_name(rtype): def relationship_name(rtype):

View File

@ -789,9 +789,9 @@ class GedcomWriter:
for name in person.get_alternate_names(): for name in person.get_alternate_names():
self.write_person_name(name,"") self.write_person_name(name,"")
if person.get_gender() == RelLib.Person.MALE: if person.get_gender() == const.MALE:
self.writeln("1 SEX M") self.writeln("1 SEX M")
elif person.get_gender() == RelLib.Person.FEMALE: elif person.get_gender() == const.FEMALE:
self.writeln("1 SEX F") self.writeln("1 SEX F")
if not restricted: if not restricted:
@ -843,8 +843,8 @@ class GedcomWriter:
for f in person.get_parent_family_handle_list(): for f in person.get_parent_family_handle_list():
mrel = f[1] mrel = f[1]
frel = f[2] frel = f[2]
if (mrel == RelLib.Person.CHILD_REL_ADOPT or if (mrel == const.CHILD_ADOPTED or
frel == RelLib.Person.CHILD_REL_ADOPT): frel == const.CHILD_ADOPTED):
fam = f[0] fam = f[0]
break break
if fam: if fam:
@ -870,8 +870,8 @@ class GedcomWriter:
for f in person.get_parent_family_handle_list(): for f in person.get_parent_family_handle_list():
mrel = f[1] mrel = f[1]
frel = f[2] frel = f[2]
if (mrel == RelLib.Person.CHILD_REL_ADOPT or if (mrel == const.CHILD_ADOPTED or
frel == RelLib.Person.CHILD_REL_ADOPT): frel == const.CHILD_ADOPTED):
fam = f[0] fam = f[0]
break break
if fam: if fam:
@ -973,7 +973,7 @@ class GedcomWriter:
if self.flist.has_key(family[0]): if self.flist.has_key(family[0]):
self.writeln("1 FAMC @%s@" % self.fid(family[0])) self.writeln("1 FAMC @%s@" % self.fid(family[0]))
if self.adopt == GedcomInfo.ADOPT_PEDI: 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") self.writeln("2 PEDI Adopted")
for family_handle in person.get_family_handle_list(): for family_handle in person.get_family_handle_list():