* src/RelLib.py: Move constants back to RelLib, as class attributes.

* src/Utils.py: Move constant mappings from const.py.in
* src/const.py.in: Move constants and mappings elsewhere.
* various: Use constants from RelLib, not const.


svn: r4736
This commit is contained in:
Alex Roitman 2005-05-30 20:41:43 +00:00
parent a766caa5b9
commit 095915429d
16 changed files with 485 additions and 545 deletions

View File

@ -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 == const.MALE: if gender == RelLib.Person.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 == const.FAMILY_CIVIL_UNION: if relation == RelLib.Family.CIVIL_UNION:
if self.person.get_gender() == const.MALE: if self.person.get_gender() == RelLib.Person.MALE:
gen = const.MALE gen = RelLib.Person.MALE
else: else:
gen = const.FEMALE gen = RelLib.Person.FEMALE
elif self.person.get_gender() == const.MALE: elif self.person.get_gender() == RelLib.Person.MALE:
gen = const.FEMALE gen = RelLib.Person.FEMALE
else: else:
gen = const.MALE gen = RelLib.Person.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() == const.MALE: if self.person.get_gender() == RelLib.Person.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() == const.FAMILY_CIVIL_UNION: if self.rel_combo.get_active() == RelLib.Family.CIVIL_UNION:
if self.gender == const.MALE: if self.gender == RelLib.Person.MALE:
self.sgender = const.FEMALE self.sgender = RelLib.Person.FEMALE
else: else:
self.sgender = const.MALE self.sgender = RelLib.Person.MALE
else: else:
if self.gender == const.MALE: if self.gender == RelLib.Person.MALE:
self.sgender = const.MALE self.sgender = RelLib.Person.MALE
else: else:
self.sgender = const.FEMALE self.sgender = RelLib.Person.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 = const.FAMILY_MARRIED self.type = RelLib.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 == const.FAMILY_CIVIL_UNION: if self.type == RelLib.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 == const.FAMILY_CIVIL_UNION: if self.type == RelLib.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 == const.FAMILY_CIVIL_UNION or if (self.old_type == RelLib.Family.CIVIL_UNION or
self.type == const.FAMILY_CIVIL_UNION): self.type == RelLib.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() == const.MALE: if self.mother.get_gender() == RelLib.Person.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() == const.FEMALE: if self.father.get_gender() == RelLib.Person.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() == const.FEMALE: if self.father.get_gender() == RelLib.Person.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 == const.FAMILY_CIVIL_UNION: if self.type == RelLib.Family.CIVIL_UNION:
self.parent_relation_changed(self.prel) self.parent_relation_changed(self.prel)
elif person.get_gender() == const.MALE: elif person.get_gender() == RelLib.Person.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(const.MALE) person.set_gender(RelLib.Person.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() == const.FAMILY_CIVIL_UNION: if self.family.get_relationship() == RelLib.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 () ==
const.UNKNOWN) RelLib.Person.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() != const.MALE: if male and self.person.get_gender() != RelLib.Person.MALE:
changed = True changed = True
elif female and self.person.get_gender() != const.FEMALE: elif female and self.person.get_gender() != RelLib.Person.FEMALE:
changed = True changed = True
elif unknown and self.person.get_gender() != const.UNKNOWN: elif unknown and self.person.get_gender() != RelLib.Person.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() == const.UNKNOWN: if self.gender.get_active() == RelLib.Person.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() != const.MALE: if male and self.person.get_gender() != RelLib.Person.MALE:
self.person.set_gender(const.MALE) self.person.set_gender(RelLib.Person.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() != const.FEMALE: elif female and self.person.get_gender() != RelLib.Person.FEMALE:
self.person.set_gender(const.FEMALE) self.person.set_gender(RelLib.Person.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() != const.UNKNOWN: elif unknown and self.person.get_gender() != RelLib.Person.UNKNOWN:
self.person.set_gender(const.UNKNOWN) self.person.set_gender(RelLib.Person.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

@ -685,10 +685,10 @@ class FamilyView:
if not self.person: if not self.person:
return return
person = RelLib.Person() person = RelLib.Person()
if self.person.get_gender() == const.MALE: if self.person.get_gender() == RelLib.Person.MALE:
person.set_gender(const.FEMALE) person.set_gender(RelLib.Person.FEMALE)
else: else:
person.set_gender(const.MALE) person.set_gender(RelLib.Person.MALE)
try: try:
EditPerson.EditPerson(self.parent, person, self.parent.db, EditPerson.EditPerson(self.parent, person, self.parent.db,
self.new_spouse_after_edit) self.new_spouse_after_edit)
@ -712,7 +712,7 @@ class FamilyView:
old_person.add_family_handle(fhandle) old_person.add_family_handle(fhandle)
new_person.add_family_handle(fhandle) new_person.add_family_handle(fhandle)
if self.person.get_gender() == const.MALE: if self.person.get_gender() == RelLib.Person.MALE:
family.set_mother_handle(epo.person.get_handle()) family.set_mother_handle(epo.person.get_handle())
family.set_father_handle(self.person.get_handle()) family.set_father_handle(self.person.get_handle())
else: else:
@ -761,7 +761,7 @@ class FamilyView:
self.family = RelLib.Family() self.family = RelLib.Family()
self.parent.db.add_family(self.family,trans) self.parent.db.add_family(self.family,trans)
person.add_family_handle(self.family.get_handle()) person.add_family_handle(self.family.get_handle())
if person.get_gender() == const.MALE: if person.get_gender() == RelLib.Person.MALE:
self.family.set_father_handle(person) self.family.set_father_handle(person)
else: else:
self.family.set_mother_handle(person) self.family.set_mother_handle(person)
@ -783,7 +783,7 @@ class FamilyView:
family = RelLib.Family() family = RelLib.Family()
self.parent.db.add_family(family,trans) self.parent.db.add_family(family,trans)
person.add_family_handle(family.get_handle()) person.add_family_handle(family.get_handle())
if person.get_gender() == const.MALE: if person.get_gender() == RelLib.Person.MALE:
family.set_father_handle(person.get_handle()) family.set_father_handle(person.get_handle())
else: else:
family.set_mother_handle(person.get_handle()) family.set_mother_handle(person.get_handle())
@ -1434,7 +1434,7 @@ class FamilyView:
family = RelLib.Family() family = RelLib.Family()
self.parent.db.add_family(family,trans) self.parent.db.add_family(family,trans)
person.add_family_handle(family.get_handle()) person.add_family_handle(family.get_handle())
if person.get_gender() == const.MALE: if person.get_gender() == RelLib.Person.MALE:
family.set_father_handle(person.get_handle()) family.set_father_handle(person.get_handle())
else: else:
family.set_mother_handle(person.get_handle()) family.set_mother_handle(person.get_handle())
@ -1546,7 +1546,7 @@ class FamilyView:
sel_data.set(sel_data.target, bits_per, data) sel_data.set(sel_data.target, bits_per, data)
def north_american(self,val): def north_american(self,val):
if self.person.get_gender() == const.MALE: if self.person.get_gender() == RelLib.Person.MALE:
pname = self.person.get_primary_name() pname = self.person.get_primary_name()
return (pname.get_surname_prefix(),pname.get_surname()) return (pname.get_surname_prefix(),pname.get_surname())
elif self.family: elif self.family:
@ -1579,7 +1579,7 @@ class FamilyView:
def icelandic(self,val): def icelandic(self,val):
fname = "" fname = ""
if self.person.get_gender() == const.MALE: if self.person.get_gender() == RelLib.Person.MALE:
fname = self.person.get_primary_name().get_first_name() fname = self.person.get_primary_name().get_first_name()
elif self.family: elif self.family:
f = self.family.get_father_handle() f = self.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() == const.FEMALE return db.get_person_from_handle(handle).get_gender() == RelLib.Person.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() == const.UNKNOWN return db.get_person_from_handle(handle).get_gender() == RelLib.Person.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() == const.MALE return db.get_person_from_handle(handle).get_gender() == RelLib.Person.MALE
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -281,9 +281,9 @@ class PedigreeView:
tooltip.set_tip(text, self.format_person(lst[i][0], 11)) tooltip.set_tip(text, self.format_person(lst[i][0], 11))
text.set_alignment(0.0,0.0) text.set_alignment(0.0,0.0)
gender = lst[i][0].get_gender() gender = lst[i][0].get_gender()
if gender == const.MALE: if gender == RelLib.Person.MALE:
text.modify_bg( gtk.STATE_NORMAL, text.get_colormap().alloc_color("#F5FFFF")) text.modify_bg( gtk.STATE_NORMAL, text.get_colormap().alloc_color("#F5FFFF"))
elif gender == const.FEMALE: elif gender == RelLib.Person.FEMALE:
text.modify_bg( gtk.STATE_NORMAL, text.get_colormap().alloc_color("#FFF5FF")) text.modify_bg( gtk.STATE_NORMAL, text.get_colormap().alloc_color("#FFF5FF"))
else: else:
text.modify_bg( gtk.STATE_NORMAL, text.get_colormap().alloc_color("#FFFFF5")) text.modify_bg( gtk.STATE_NORMAL, text.get_colormap().alloc_color("#FFFFF5"))

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(const.FAMILY_MARRIED) self.family.set_relationship(RelLib.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)
@ -972,11 +972,11 @@ class GedcomParser:
note = self.parse_note(matches,self.person,1,note) note = self.parse_note(matches,self.person,1,note)
elif matches[1] == "SEX": elif matches[1] == "SEX":
if matches[2] == '': if matches[2] == '':
self.person.set_gender(const.UNKNOWN) self.person.set_gender(RelLib.Person.UNKNOWN)
elif matches[2][0] == "M": elif matches[2][0] == "M":
self.person.set_gender(const.MALE) self.person.set_gender(RelLib.Person.MALE)
else: else:
self.person.set_gender(const.FEMALE) self.person.set_gender(RelLib.Person.FEMALE)
elif matches[1] in [ "BAPL", "ENDL", "SLGC" ]: elif matches[1] in [ "BAPL", "ENDL", "SLGC" ]:
lds_ord = RelLib.LdsOrd() lds_ord = RelLib.LdsOrd()
if matches[1] == "BAPL": if matches[1] == "BAPL":
@ -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],const.UNKNOWN) ftype = pedi_type.get(matches[2],RelLib.Person.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"],
const.FAMILY_UNKNOWN)) RelLib.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:
@ -1242,11 +1242,11 @@ class GrampsParser:
def stop_gender(self,tag): def stop_gender(self,tag):
t = tag t = tag
if t == "M": if t == "M":
self.person.set_gender (const.MALE) self.person.set_gender (RelLib.Person.MALE)
elif t == "F": elif t == "F":
self.person.set_gender (const.FEMALE) self.person.set_gender (RelLib.Person.FEMALE)
else: else:
self.person.set_gender (const.UNKNOWN) self.person.set_gender (RelLib.Person.UNKNOWN)
def stop_stitle(self,tag): def stop_stitle(self,tag):
self.source.set_title(tag) self.source.set_title(tag)

View File

@ -42,7 +42,6 @@ from warnings import warn
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const
import Date import Date
import DateHandler import DateHandler
@ -891,6 +890,19 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
@sort: serialize, unserialize, get_*, set_*, add_*, remove_* @sort: serialize, unserialize, get_*, set_*, add_*, remove_*
""" """
UNKNOWN = 2
MALE = 1
FEMALE = 0
CHILD_NONE = 0
CHILD_BIRTH = 1
CHILD_ADOPTED = 2
CHILD_STEPCHILD = 3
CHILD_SPONSORED = 4
CHILD_FOSTER = 5
CHILD_UNKNOWN = 6
CHILD_CUSTOM = 7
def __init__(self): def __init__(self):
""" """
Creates a new Person instance. After initialization, most Creates a new Person instance. After initialization, most
@ -907,7 +919,7 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
self.parent_family_list = [] self.parent_family_list = []
self.nickname = "" self.nickname = ""
self.alternate_names = [] self.alternate_names = []
self.gender = const.UNKNOWN self.gender = Person.UNKNOWN
self.death_ref = None self.death_ref = None
self.birth_ref = None self.birth_ref = None
self.address_list = [] self.address_list = []
@ -1210,9 +1222,9 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
@param gender: Assigns the Person's gender to one of the @param gender: Assigns the Person's gender to one of the
following constants:: following constants::
const.MALE Person.MALE
const.FEMALE Person.FEMALE
const.UNKNOWN Person.UNKNOWN
@type gender: int @type gender: int
""" """
# if the db object has been assigned, update the # if the db object has been assigned, update the
@ -1228,9 +1240,9 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
Returns the gender of the Person Returns the gender of the Person
@returns: Returns one of the following constants:: @returns: Returns one of the following constants::
const.MALE Person.MALE
const.FEMALE Person.FEMALE
const.UNKNOWN Person.UNKNOWN
@rtype: int @rtype: int
""" """
return self.gender return self.gender
@ -1264,7 +1276,7 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
# remove when transitition done. # remove when transitition done.
event_ref = EventRef() event_ref = EventRef()
event_ref.set_reference_handle(event_handle) event_ref.set_reference_handle(event_handle)
event_ref.set_role( const.ROLE_PRIMARY) event_ref.set_role( EventRef.ROLE_PRIMARY)
self.set_death_ref( event_ref) self.set_death_ref( event_ref)
def set_death_ref(self,event_ref): def set_death_ref(self,event_ref):
@ -1327,7 +1339,7 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
# remove when transitition done. # remove when transitition done.
event_ref = EventRef() event_ref = EventRef()
event_ref.set_reference_handle(event_handle) event_ref.set_reference_handle(event_handle)
event_ref.set_role( const.ROLE_PRIMARY) event_ref.set_role( EventRef.ROLE_PRIMARY)
self.add_event_ref( event_ref) self.add_event_ref( event_ref)
def add_event_ref(self,event_ref): def add_event_ref(self,event_ref):
@ -1372,7 +1384,7 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
for event_handle in event_list: for event_handle in event_list:
event_ref = EventRef() event_ref = EventRef()
event_ref.set_reference_handle(event_handle) event_ref.set_reference_handle(event_handle)
event_ref.set_role( const.ROLE_PRIMARY) event_ref.set_role( EventRef.ROLE_PRIMARY)
event_ref_list.append( event_ref) event_ref_list.append( event_ref)
self.set_event_ref_list(event_ref_list) self.set_event_ref_list(event_ref_list)
@ -1737,6 +1749,12 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
or the changes will be lost. or the changes will be lost.
""" """
MARRIED = 0
UNMARRIED = 1
CIVIL_UNION = 2
UNKNOWN = 3
CUSTOM = 4
def __init__(self): def __init__(self):
""" """
Creates a new Family instance. After initialization, most Creates a new Family instance. After initialization, most
@ -1750,7 +1768,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
self.father_handle = None self.father_handle = None
self.mother_handle = None self.mother_handle = None
self.child_list = [] self.child_list = []
self.type = const.FAMILY_MARRIED self.type = Family.MARRIED
self.event_ref_list = [] self.event_ref_list = []
self.lds_seal = None self.lds_seal = None
self.complete = 0 self.complete = 0
@ -1937,17 +1955,17 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
Sets the relationship type between the people identified as the Sets the relationship type between the people identified as the
father and mother in the relationship. The valid values are: father and mother in the relationship. The valid values are:
- C{const.FAMILY_MARRIED} : indicates a legally recognized married - C{Family.MARRIED} : indicates a legally recognized married
relationship between two individuals. This may be either relationship between two individuals. This may be either
an opposite or a same sex relationship. an opposite or a same sex relationship.
- C{const_FAMILY_UNMARRIED} : indicates a relationship between two - C{Family.UNMARRIED} : indicates a relationship between two
individuals that is not a legally recognized relationship. individuals that is not a legally recognized relationship.
- C{const_FAMILY_CIVIL_UNION} : indicates a legally recongnized, - C{Family.CIVIL_UNION} : indicates a legally recongnized,
non-married relationship between two individuals of the non-married relationship between two individuals of the
same sex. same sex.
- C{const.FAMILY_UNKNOWN} : indicates that the type of relationship - C{Family.UNKNOWN} : indicates that the type of relationship
between the two individuals is not know. between the two individuals is not know.
- C{const.FAMILY_CUSTOM} : indicates that the type of relationship - C{Family.CUSTOM} : indicates that the type of relationship
between the two individuals does not match any of the between the two individuals does not match any of the
other types. other types.
@ -2061,7 +2079,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
# remove when transitition done. # remove when transitition done.
event_ref = EventRef() event_ref = EventRef()
event_ref.set_reference_handle(event_handle) event_ref.set_reference_handle(event_handle)
event_ref.set_role( const.ROLE_PRIMARY) event_ref.set_role(EventRef.ROLE_PRIMARY)
self.add_event_ref(event_ref) self.add_event_ref(event_ref)
def add_event_ref(self,event_ref): def add_event_ref(self,event_ref):
@ -2106,7 +2124,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
for event_handle in event_list: for event_handle in event_list:
event_ref = EventRef() event_ref = EventRef()
event_ref.set_reference_handle(event_handle) event_ref.set_reference_handle(event_handle)
event_ref.set_role( const.ROLE_PRIMARY) event_ref.set_role(EventRef.ROLE_PRIMARY)
event_ref_list.append( event_ref) event_ref_list.append( event_ref)
self.set_event_ref_list(event_ref_list) self.set_event_ref_list(event_ref_list)
@ -2128,8 +2146,52 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
such as a birth, death, or marriage. such as a birth, death, or marriage.
""" """
NAME = 0 UNKNOWN = -1
ID = 1 CUSTOM = 0
MARRIAGE = 1
MARR_SETTL = 2
MARR_LIC = 3
MARR_CONTR = 4
MARR_BANNS = 5
ENGAGEMENT = 6
DIVORCE = 7
DIV_FILING = 8
ANNULMENT = 9
MARR_ALT = 10
ADOPT = 11
BIRTH = 12
DEATH = 13
ADULT_CHRISTEN = 14
BAPTISM = 15
BAR_MITZVAH = 16
BAS_MITZVAH = 17
BLESS = 18
BURIAL = 19
CAUSE_DEATH = 20
CENSUS = 21
CHRISTEN = 22
CONFIRMATION = 23
CREMATION = 24
DEGREE = 25
EDUCATION = 26
ELECTED = 27
EMIGRATION = 28
FIRST_COMMUN = 29
IMMIGRATION = 30
GRADUATION = 31
MED_INFO = 32
MILITARY_SERV = 33
NATURALIZATION = 34
NOB_TITLE = 35
NUM_MARRIAGES = 36
OCCUPATION = 37
ORDINATION = 38
PROBATE = 39
PROPERTY = 40
RELIGION = 41
RESIDENCE = 42
RETIREMENT = 43
WILL = 44
def __init__(self,source=None): def __init__(self,source=None):
""" """
@ -2147,7 +2209,8 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
if source: if source:
self.description = source.description self.description = source.description
self.name = source.name self.type_int = source.type_int
self.type_str = source.type_str
self.cause = source.cause self.cause = source.cause
if source.witness != None: if source.witness != None:
self.witness = source.witness[:] self.witness = source.witness[:]
@ -2155,7 +2218,8 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
self.witness = None self.witness = None
else: else:
self.description = "" self.description = ""
self.name = "" self.type_int = Event.CUSTOM
self.type_str = ""
self.cause = "" self.cause = ""
self.witness = None self.witness = None
@ -2175,10 +2239,10 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
be considered persistent. be considered persistent.
@rtype: tuple @rtype: tuple
""" """
return (self.handle, self.gramps_id, self.name, self.date, return (self.handle, self.gramps_id, self.type_int, self.type_str,
self.description, self.place, self.cause, self.private, self.date, self.description, self.place, self.cause,
self.source_list, self.note, self.witness, self.media_list, self.private, self.source_list, self.note, self.witness,
self.change) self.media_list, self.change)
def unserialize(self,data): def unserialize(self,data):
""" """
@ -2189,9 +2253,10 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
Person object Person object
@type data: tuple @type data: tuple
""" """
(self.handle, self.gramps_id, self.name, self.date, self.description, (self.handle, self.gramps_id, self.type_int, self.type_str,
self.place, self.cause, self.private, self.source_list, self.date, self.description, self.place, self.cause, self.private,
self.note, self.witness, self.media_list, self.change) = data self.source_list, self.note, self.witness, self.media_list,
self.change) = data
def _has_handle_reference(self,classname,handle): def _has_handle_reference(self,classname,handle):
if classname == 'Place': if classname == 'Place':
@ -3488,6 +3553,15 @@ class Attribute(PrivateSourceNote):
"""Provides a simple key/value pair for describing properties. Used """Provides a simple key/value pair for describing properties. Used
by the Person and Family objects to store descriptive information.""" by the Person and Family objects to store descriptive information."""
UNKNOWN = -1
CUSTOM = 0
CASTE = 1
DESCRIPTION = 2
ID = 3
NATIONAL = 4
NUM_CHILD = 5
SSN = 6
def __init__(self,source=None): def __init__(self,source=None):
"""creates a new Attribute object, copying from the source if provided""" """creates a new Attribute object, copying from the source if provided"""
PrivateSourceNote.__init__(self,source) PrivateSourceNote.__init__(self,source)
@ -3658,6 +3732,12 @@ class Name(PrivateSourceNote,DateBase):
LNFN = 1 # last name, first name LNFN = 1 # last name, first name
FNLN = 2 # first name, last name FNLN = 2 # first name, last name
UNKNOWN = -1
CUSTOM = 0
AKA = 1
BIRTH = 2
MARRIED = 3
def __init__(self,source=None): def __init__(self,source=None):
"""creates a new Name instance, copying from the source if provided""" """creates a new Name instance, copying from the source if provided"""
PrivateSourceNote.__init__(self,source) PrivateSourceNote.__init__(self,source)
@ -4076,6 +4156,12 @@ class SourceRef(BaseObject,DateBase,PrivacyBase,NoteBase):
"""Source reference, containing detailed information about how a """Source reference, containing detailed information about how a
referenced source relates to it""" referenced source relates to it"""
CONF_VERY_HIGH = 4
CONF_HIGH = 3
CONF_NORMAL = 2
CONF_LOW = 1
CONF_VERY_LOW = 0
def __init__(self,source=None): def __init__(self,source=None):
"""creates a new SourceRef, copying from the source if present""" """creates a new SourceRef, copying from the source if present"""
DateBase.__init__(self,source) DateBase.__init__(self,source)
@ -4087,7 +4173,7 @@ class SourceRef(BaseObject,DateBase,PrivacyBase,NoteBase):
self.page = source.page self.page = source.page
self.text = source.text self.text = source.text
else: else:
self.confidence = const.CONF_NORMAL self.confidence = SourceRef.CONF_NORMAL
self.ref = None self.ref = None
self.page = "" self.page = ""
self.note = Note() self.note = Note()
@ -4188,6 +4274,16 @@ class EventRef(BaseObject,PrivacyBase,NoteBase):
to the refereneced event. to the refereneced event.
""" """
UNKNOWN = -1
CUSTOM = 0
PRIMARY = 1
CLERGY = 2
CELEBRANT = 3
AIDE = 4
BRIDE = 5
GROOM = 6
WITNESS = 7
def __init__(self,source=None): def __init__(self,source=None):
""" """
Creates a new EventRef instance, copying from the source if present. Creates a new EventRef instance, copying from the source if present.
@ -4200,7 +4296,7 @@ class EventRef(BaseObject,PrivacyBase,NoteBase):
self.role_str = source.role_str self.role_str = source.role_str
else: else:
self.ref = None self.ref = None
self.role_int = const.ROLE_CUSTOM self.role_int = EventRef.ROLE_CUSTOM
self.role_str = "" self.role_str = ""
def get_text_data_list(self): def get_text_data_list(self):
@ -4253,7 +4349,7 @@ class EventRef(BaseObject,PrivacyBase,NoteBase):
Returns the integer corresponding to the preset role. Returns the integer corresponding to the preset role.
If custom then the string is returned. If custom then the string is returned.
""" """
if self.role_int == const.ROLE_CUSTOM: if self.role_int == EventRef.ROLE_CUSTOM:
return self.role_str return self.role_str
else: else:
return self.role_int return self.role_int
@ -4264,7 +4360,7 @@ class EventRef(BaseObject,PrivacyBase,NoteBase):
If integer, it is set as is. If string, it is recorded as custom role. If integer, it is set as is. If string, it is recorded as custom role.
""" """
if type(role) == str: if type(role) == str:
self.role_int = const.ROLE_CUSTOM self.role_int = EventRef.ROLE_CUSTOM
self.role_str = role self.role_str = role
elif type(role) == int: elif type(role) == int:
self.role_int = role self.role_int = role
@ -4314,11 +4410,11 @@ class GenderStats:
else: else:
increment = -1 increment = -1
if gender == const.MALE: if gender == Person.MALE:
male += increment male += increment
elif gender == const.FEMALE: elif gender == Person.FEMALE:
female += increment female += increment
elif gender == const.UNKNOWN: elif gender == Person.UNKNOWN:
unknown += increment unknown += increment
self.stats[name] = (male, female, unknown) self.stats[name] = (male, female, unknown)
@ -4330,27 +4426,44 @@ class GenderStats:
def guess_gender (self, name): def guess_gender (self, name):
name = self._get_key_from_name (name) name = self._get_key_from_name (name)
if not name or not self.stats.has_key (name): if not name or not self.stats.has_key (name):
return const.UNKNOWN return Person.UNKNOWN
(male, female, unknown) = self.stats[name] (male, female, unknown) = self.stats[name]
if unknown == 0: if unknown == 0:
if male and not female: if male and not female:
return const.MALE return Person.MALE
if female and not male: if female and not male:
return const.FEMALE return Person.FEMALE
if male > (2 * female): if male > (2 * female):
return const.MALE return Person.MALE
if female > (2 * male): if female > (2 * male):
return const.FEMALE return Person.FEMALE
return const.UNKNOWN return Person.UNKNOWN
class RepoRef(BaseObject,NoteBase): class RepoRef(BaseObject,NoteBase):
""" """
Repository reference class. Repository reference class.
""" """
UNKNOWN = -1
CUSTOM = 0
AUDIO = 1
BOOK = 2
CARD = 3
ELECTRONIC = 4
FICHE = 5
FILM = 6
MAGAZINE = 7
MANUSCRIPT = 8
MAP = 9
NEWSPAPER = 10
PHOTO = 11
THOMBSTOBE = 12
VIDEO = 13
def __init__(self,source=None): def __init__(self,source=None):
NoteBase.__init__(self) NoteBase.__init__(self)
if source: if source:
@ -4361,7 +4474,7 @@ class RepoRef(BaseObject,NoteBase):
else: else:
self.ref = None self.ref = None
self.call_number = "" self.call_number = ""
self.media_type_int = const.SRC_MEDIA_CUSTOM self.media_type_int = RepoRef.CUSTOM
self.media_type_str = "" self.media_type_str = ""
def get_text_data_list(self): def get_text_data_list(self):
@ -4410,7 +4523,7 @@ class RepoRef(BaseObject,NoteBase):
return self.call_number return self.call_number
def get_media_type(self): def get_media_type(self):
if self.media_type_int == const.SRC_MEDIA_CUSTOM: if self.media_type_int == RepoRef.CUSTOM:
return self.media_type_str return self.media_type_str
else: else:
return self.media_type_int return self.media_type_int
@ -4420,7 +4533,7 @@ class RepoRef(BaseObject,NoteBase):
self.media_type_int = media_type self.media_type_int = media_type
self.media_type_str = "" self.media_type_str = ""
else: else:
self.media_type_int = const.SRC_MEDIA_CUSTOM self.media_type_int = RepoRef.CUSTOM
self.media_type_str = media_type self.media_type_str = media_type
class Repository(PrimaryObject,NoteBase): class Repository(PrimaryObject,NoteBase):
@ -4668,12 +4781,12 @@ if __name__ == "__main__":
rr1 = RepoRef() rr1 = RepoRef()
rr1.set_reference_handle('ref-handle') rr1.set_reference_handle('ref-handle')
rr1.set_call_number('call-number') rr1.set_call_number('call-number')
rr1.set_media_type(const.SRC_MEDIA_BOOK) rr1.set_media_type(RepoRef.BOOK)
rr1.set_note('some note') rr1.set_note('some note')
assert rr1.get_reference_handle() == 'ref-handle' assert rr1.get_reference_handle() == 'ref-handle'
assert rr1.get_call_number() == 'call-number' assert rr1.get_call_number() == 'call-number'
assert rr1.get_media_type() == const.SRC_MEDIA_BOOK assert rr1.get_media_type() == RepoRef.BOOK
assert rr1.get_note() == 'some note' assert rr1.get_note() == 'some note'
unittest.main() unittest.main()

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() == const.MALE: elif other_person.get_gender() == RelLib.Person.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() == const.MALE: if other_person.get_gender() == RelLib.Person.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() == const.MALE: if other_person.get_gender() == RelLib.Person.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() == const.MALE: if other_person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.FAMILY_MARRIED: if family.get_relationship() == RelLib.Family.MARRIED:
if person.get_gender() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.FAMILY_MARRIED: if family.get_relationship() == RelLib.Family.MARRIED:
if person.get_gender() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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() == const.MALE: if person.get_gender() == RelLib.Person.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 = {
const.FAMILY_MARRIED : _("Married"), RelLib.Family.MARRIED : _("Married"),
const.FAMILY_UNMARRIED : _("Unmarried"), RelLib.Family.UNMARRIED : _("Unmarried"),
const.FAMILY_CIVIL_UNION : _("Civil Union"), RelLib.Family.CIVIL_UNION : _("Civil Union"),
const.FAMILY_UNKNOWN : _("Unknown"), RelLib.Family.UNKNOWN : _("Unknown"),
const.FAMILY_CUSTOM : _("Other"), RelLib.Family.CUSTOM : _("Other"),
} }
def relationship_name(rtype): def relationship_name(rtype):

View File

@ -96,7 +96,7 @@ class SelectChild:
father = self.db.get_person_from_handle(self.family.get_father_handle()) father = self.db.get_person_from_handle(self.family.get_father_handle())
mother = self.db.get_person_from_handle(self.family.get_mother_handle()) mother = self.db.get_person_from_handle(self.family.get_mother_handle())
else: else:
if self.person.get_gender() == const.MALE: if self.person.get_gender() == RelLib.Person.MALE:
self.mrel.set_sensitive(False) self.mrel.set_sensitive(False)
else: else:
self.frel.set_sensitive(False) self.frel.set_sensitive(False)
@ -237,9 +237,9 @@ class SelectChild:
for idval in person_list: for idval in person_list:
person = self.db.get_person_from_handle(idval) person = self.db.get_person_from_handle(idval)
name = NameDisplay.displayer.display(person) name = NameDisplay.displayer.display(person)
if person.gender == const.MALE: if person.gender == RelLib.Person.MALE:
gender = _("male") gender = _("male")
elif person.gender == const.FEMALE: elif person.gender == RelLib.Person.FEMALE:
gender = _("female") gender = _("female")
else: else:
gender = _("unknown") gender = _("unknown")
@ -296,7 +296,7 @@ class SelectChild:
self.db.add_family(self.family,trans) self.db.add_family(self.family,trans)
self.person.add_family_handle(self.family.get_handle()) self.person.add_family_handle(self.family.get_handle())
self.db.commit_person(self.person,trans) self.db.commit_person(self.person,trans)
if self.person.get_gender() == const.MALE: if self.person.get_gender() == RelLib.Person.MALE:
self.family.set_father_handle(self.person.get_handle()) self.family.set_father_handle(self.person.get_handle())
else: else:
self.family.set_mother_handle(self.person.get_handle()) self.family.set_mother_handle(self.person.get_handle())
@ -312,13 +312,13 @@ class SelectChild:
mrel = self.mrel.get_active() mrel = self.mrel.get_active()
mother = self.db.get_person_from_handle(self.family.get_mother_handle()) mother = self.db.get_person_from_handle(self.family.get_mother_handle())
if mother and mother.get_gender() != const.FEMALE: if mother and mother.get_gender() != RelLib.Person.FEMALE:
if mrel == const.CHILD_BIRTH: if mrel == const.CHILD_BIRTH:
mrel = const.CHILD_UNKNOWN mrel = const.CHILD_UNKNOWN
frel = self.frel.get_active() frel = self.frel.get_active()
father = self.db.get_person_from_handle(self.family.get_father_handle()) father = self.db.get_person_from_handle(self.family.get_father_handle())
if father and father.get_gender() != const.MALE: if father and father.get_gender() != RelLib.Person.MALE:
if frel == const.CHILD_BIRTH: if frel == const.CHILD_BIRTH:
frel = const.CHILD_UNKNOWN frel = const.CHILD_UNKNOWN
@ -336,7 +336,7 @@ class SelectChild:
self.redraw_child_list(not obj.get_active()) self.redraw_child_list(not obj.get_active())
def north_american(self,val): def north_american(self,val):
if self.person.get_gender() == const.MALE: if self.person.get_gender() == RelLib.Person.MALE:
return self.person.get_primary_name().get_surname() return self.person.get_primary_name().get_surname()
elif self.family: elif self.family:
f = self.family.get_father_handle() f = self.family.get_father_handle()
@ -367,7 +367,7 @@ class SelectChild:
def icelandic(self,val): def icelandic(self,val):
fname = "" fname = ""
if self.person.get_gender() == const.MALE: if self.person.get_gender() == RelLib.Person.MALE:
fname = self.person.get_primary_name().get_first_name() fname = self.person.get_primary_name().get_first_name()
elif self.family: elif self.family:
f = self.family.get_father_handle() f = self.family.get_father_handle()

View File

@ -27,6 +27,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import locale import locale
from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -51,13 +52,224 @@ import const
import GrampsMime import GrampsMime
import NameDisplay import NameDisplay
import Date import Date
import RelLib
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# internationalization # Integer to String mappings for constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gettext import gettext as _ gender = {
RelLib.Person.MALE : _("male"),
RelLib.Person.FEMALE : _("female"),
RelLib.Person.UNKNOWN : _("unknown"),
}
child_relations = {
RelLib.Person.CHILD_NONE : _("None"),
RelLib.Person.CHILD_BIRTH : _("Birth"),
RelLib.Person.CHILD_ADOPTED : _("Adopted"),
RelLib.Person.CHILD_STEPCHILD : _("Stepchild"),
RelLib.Person.CHILD_SPONSORED : _("Sponsored"),
RelLib.Person.CHILD_FOSTER : _("Foster"),
RelLib.Person.CHILD_UNKNOWN : _("Unknown"),
RelLib.Person.CHILD_CUSTOM : _("Custom"),
}
confidence = {
RelLib.SourceRef.CONF_VERY_HIGH : _("Very High"),
RelLib.SourceRef.CONF_HIGH : _("High"),
RelLib.SourceRef.CONF_NORMAL : _("Normal"),
RelLib.SourceRef.CONF_LOW : _("Low"),
RelLib.SourceRef.CONF_VERY_LOW : _("Very Low"),
}
family_events = {
RelLib.Event.UNKNOWN : _("Unknown"),
RelLib.Event.CUSTOM : _("Custom"),
RelLib.Event.MARRIAGE : _("Marriage"),
RelLib.Event.MARR_SETTL : _("Marriage Settlement"),
RelLib.Event.MARR_LIC : _("Marriage License"),
RelLib.Event.MARR_CONTR : _("Marriage Contract"),
RelLib.Event.MARR_BANNS : _("Marriage Banns"),
RelLib.Event.ENGAGEMENT : _("Engagement"),
RelLib.Event.DIVORCE : _("Divorce"),
RelLib.Event.DIV_FILING : _("Divorce Filing"),
RelLib.Event.ANNULMENT : _("Annulment"),
RelLib.Event.MARR_ALT : _("Alternate Marriage"),
}
personal_events = {
RelLib.Event.UNKNOWN : _("Unknown"),
RelLib.Event.CUSTOM : _("Custom"),
RelLib.Event.ADOPT : _("Adopted"),
RelLib.Event.BIRTH : _("Birth"),
RelLib.Event.DEATH : _("Death"),
RelLib.Event.ADULT_CHRISTEN : _("Adult Christening"),
RelLib.Event.BAPTISM : _("Baptism"),
RelLib.Event.BAR_MITZVAH : _("Bar Mitzvah"),
RelLib.Event.BAS_MITZVAH : _("Bas Mitzvah"),
RelLib.Event.BLESS : _("Blessing"),
RelLib.Event.BURIAL : _("Burial"),
RelLib.Event.CAUSE_DEATH : _("Cause Of Death"),
RelLib.Event.CENSUS : _("Census"),
RelLib.Event.CHRISTEN : _("Christening"),
RelLib.Event.CONFIRMATION : _("Confirmation"),
RelLib.Event.CREMATION : _("Cremation"),
RelLib.Event.DEGREE : _("Degree"),
RelLib.Event.DIV_FILING : _("Divorce Filing"),
RelLib.Event.EDUCATION : _("Education"),
RelLib.Event.ELECTED : _("Elected"),
RelLib.Event.EMIGRATION : _("Emigration"),
RelLib.Event.FIRST_COMMUN : _("First Communion"),
RelLib.Event.IMMIGRATION : _("Immigration"),
RelLib.Event.GRADUATION : _("Graduation"),
RelLib.Event.MED_INFO : _("Medical Information"),
RelLib.Event.MILITARY_SERV : _("Military Service"),
RelLib.Event.NATURALIZATION : _("Naturalization"),
RelLib.Event.NOB_TITLE : _("Nobility Title"),
RelLib.Event.NUM_MARRIAGES : _("Number of Marriages"),
RelLib.Event.OCCUPATION : _("Occupation"),
RelLib.Event.ORDINATION : _("Ordination"),
RelLib.Event.PROBATE : _("Probate"),
RelLib.Event.PROPERTY : _("Property"),
RelLib.Event.RELIGION : _("Religion"),
RelLib.Event.RESIDENCE : _("Residence"),
RelLib.Event.RETIREMENT : _("Retirement"),
RelLib.Event.WILL : _("Will")
}
personal_attributes = {
RelLib.Attribute.UNKNOWN : _("Unknown"),
RelLib.Attribute.CUSTOM : _("Custom"),
RelLib.Attribute.CASTE : _("Caste"),
RelLib.Attribute.DESCRIPTION : _("Description"),
RelLib.Attribute.ID : _("Identification Number"),
RelLib.Attribute.NATIONAL : _("National Origin"),
RelLib.Attribute.NUM_CHILD : _("Number of Children"),
RelLib.Attribute.SSN : _("Social Security Number"),
}
family_attributes = {
RelLib.Attribute.UNKNOWN : _("Unknown"),
RelLib.Attribute.CUSTOM : _("Custom"),
RelLib.Attribute.NUM_CHILD : _("Number of Children"),
}
family_relations = {
RelLib.Family.MARRIED : _("Married"),
RelLib.Family.UNMARRIED : _("Unmarried"),
RelLib.Family.CIVIL_UNION : _("Civil Union"),
RelLib.Family.UNKNOWN : _("Unknown"),
RelLib.Family.CUSTOM : _("Other"),
}
family_rel_descriptions = {
RelLib.Family.MARRIED : _("A legal or common-law relationship "
"between a husband and wife"),
RelLib.Family.UNMARRIED : _("No legal or common-law relationship "
"between man and woman"),
RelLib.Family.CIVIL_UNION : _("An established relationship between "
"members of the same sex"),
RelLib.Family.UNKNOWN : _("Unknown relationship between a man "
"and woman"),
RelLib.Family.CUSTOM : _("An unspecified relationship "
"a man and woman"),
}
name_types = {
RelLib.Name.UNKNOWN : _("Unknown"),
RelLib.Name.CUSTOM : _("Custom"),
RelLib.Name.AKA : _("Also Known As"),
RelLib.Name.BIRTH : _("Birth Name"),
RelLib.Name.MARRIED : _("Married Name"),
}
source_media_types = {
RelLib.RepoRef.UNKNOWN : _("Unknown"),
RelLib.RepoRef.CUSTOM : _("Custom"),
RelLib.RepoRef.AUDIO : _("Audio"),
RelLib.RepoRef.BOOK : _("Book"),
RelLib.RepoRef.CARD : _("Card"),
RelLib.RepoRef.ELECTRONIC : _("Electronic"),
RelLib.RepoRef.FICHE : _("Fiche"),
RelLib.RepoRef.FILM : _("Film"),
RelLib.RepoRef.MAGAZINE : _("Magazine"),
RelLib.RepoRef.MANUSCRIPT : _("Manuscript"),
RelLib.RepoRef.MAP : _("Map"),
RelLib.RepoRef.NEWSPAPER : _("Newspaper"),
RelLib.RepoRef.PHOTO : _("Photo"),
RelLib.RepoRef.THOMBSTOBE : _("Thombstone"),
RelLib.RepoRef.VIDEO : _("Video"),
}
#-------------------------------------------------------------------------
#
# Integer to GEDCOM tag mappings for constants
#
#-------------------------------------------------------------------------
familyConstantEvents = {
RelLib.Event.ANNULMENT : "ANUL",
RelLib.Event.DIV_FILING : "DIVF",
RelLib.Event.DIVORCE : "DIV",
RelLib.Event.ENGAGEMENT : "ENGA",
RelLib.Event.MARR_BANNS : "MARB",
RelLib.Event.MARR_CONTR : "MARC",
RelLib.Event.MARR_LIC : "MARL",
RelLib.Event.MARR_SETTL : "MARS",
RelLib.Event.MARRIAGE : "MARR"
}
personalConstantEvents = {
RelLib.Event.ADOPT : "ADOP",
RelLib.Event.ADULT_CHRISTEN : "CHRA",
RelLib.Event.BIRTH : "BIRT",
RelLib.Event.DEATH : "DEAT",
RelLib.Event.BAPTISM : "BAPM",
RelLib.Event.BAR_MITZVAH : "BARM",
RelLib.Event.BAS_MITZVAH : "BASM",
RelLib.Event.BLESS : "BLES",
RelLib.Event.BURIAL : "BURI",
RelLib.Event.CAUSE_DEATH : "CAUS",
RelLib.Event.ORDINATION : "ORDI",
RelLib.Event.CENSUS : "CENS",
RelLib.Event.CHRISTEN : "CHR" ,
RelLib.Event.CONFIRMATION : "CONF",
RelLib.Event.CREMATION : "CREM",
RelLib.Event.DEGREE : "",
RelLib.Event.DIV_FILING : "DIVF",
RelLib.Event.EDUCATION : "EDUC",
RelLib.Event.ELECTED : "",
RelLib.Event.ELECTED : "EMIG",
RelLib.Event.FIRST_COMMUN : "FCOM",
RelLib.Event.GRADUATION : "GRAD",
RelLib.Event.MED_INFO : "",
RelLib.Event.MILITARY_SERV : "",
RelLib.Event.NATURALIZATION : "NATU",
RelLib.Event.NOB_TITLE : "TITL",
RelLib.Event.NUM_MARRIAGES : "NMR",
RelLib.Event.IMMIGRATION : "IMMI",
RelLib.Event.OCCUPATION : "OCCU",
RelLib.Event.PROBATE : "PROB",
RelLib.Event.PROPERTY : "PROP",
RelLib.Event.RELIGION : "RELI",
RelLib.Event.RESIDENCE : "RESI",
RelLib.Event.RETIREMENT : "RETI",
RelLib.Event.WILL : "WILL",
}
familyConstantAttributes = {
RelLib.Attribute.NUM_CHILD : "NCHI",
}
personalConstantAttributes = {
RelLib.Attribute.CASTE : "CAST",
RelLib.Attribute.DESCRIPTION : "DSCR",
RelLib.Attribute.ID : "IDNO",
RelLib.Attribute.NATIONAL : "NATI",
RelLib.Attribute.NUM_CHILD : "NCHI",
RelLib.Attribute.SSN : "SSN",
}
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

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() == const.MALE: if person.get_gender() == RelLib.Person.MALE:
self.writeln("1 SEX M") self.writeln("1 SEX M")
elif person.get_gender() == const.FEMALE: elif person.get_gender() == RelLib.Person.FEMALE:
self.writeln("1 SEX F") self.writeln("1 SEX F")
if not restricted: if not restricted:

View File

@ -253,9 +253,9 @@ class XmlWriter:
count += 1 count += 1
self.write_id("person",person,2) self.write_id("person",person,2)
if person.get_gender() == const.MALE: if person.get_gender() == RelLib.Person.MALE:
self.write_line("gender","M",3) self.write_line("gender","M",3)
elif person.get_gender() == const.FEMALE: elif person.get_gender() == RelLib.Person.FEMALE:
self.write_line("gender","F",3) self.write_line("gender","F",3)
else: else:
self.write_line("gender","U",3) self.write_line("gender","U",3)

View File

@ -28,12 +28,6 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _ from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -77,7 +71,6 @@ prefixdir = "@GPREFIX@"
# Configuration database options - True means drop down to .INI files # Configuration database options - True means drop down to .INI files
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
no_gconf = False no_gconf = False
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -86,7 +79,6 @@ no_gconf = False
# this one, and that the plugins directory is in a directory below this. # this one, and that the plugins directory is in a directory below this.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
if os.environ.has_key('GRAMPSDIR'): if os.environ.has_key('GRAMPSDIR'):
rootDir = os.environ['GRAMPSDIR'] rootDir = os.environ['GRAMPSDIR']
else: else:
@ -219,383 +211,6 @@ longopts = [
shortopts = "O:i:o:f:a:p:?" shortopts = "O:i:o:f:a:p:?"
#-------------------------------------------------------------------------
#
# Gender constants
#
#-------------------------------------------------------------------------
UNKNOWN = 2
MALE = 1
FEMALE = 0
gender = {
MALE : _("male"),
FEMALE : _("female"),
UNKNOWN : _("unknown"),
}
#-------------------------------------------------------------------------
#
# Child relation constants
#
#-------------------------------------------------------------------------
CHILD_NONE = 0
CHILD_BIRTH = 1
CHILD_ADOPTED = 2
CHILD_STEPCHILD = 3
CHILD_SPONSORED = 4
CHILD_FOSTER = 5
CHILD_UNKNOWN = 6
CHILD_CUSTOM = 7
child_relations = {
CHILD_NONE : _("None"),
CHILD_BIRTH : _("Birth"),
CHILD_ADOPTED : _("Adopted"),
CHILD_STEPCHILD : _("Stepchild"),
CHILD_SPONSORED : _("Sponsored"),
CHILD_FOSTER : _("Foster"),
CHILD_UNKNOWN : _("Unknown"),
CHILD_CUSTOM : _("Custom"),
}
#-------------------------------------------------------------------------
#
# Confidence constants
#
#-------------------------------------------------------------------------
CONF_VERY_HIGH = 4
CONF_HIGH = 3
CONF_NORMAL = 2
CONF_LOW = 1
CONF_VERY_LOW = 0
confidence = {
CONF_VERY_HIGH : _("Very High"),
CONF_HIGH : _("High"),
CONF_NORMAL : _("Normal"),
CONF_LOW : _("Low"),
CONF_VERY_LOW : _("Very Low"),
}
#-------------------------------------------------------------------------
#
# Event constants
#
#-------------------------------------------------------------------------
EVENT_UNKNOWN = -1
EVENT_CUSTOM = 0
EVENT_MARRIAGE = 1
EVENT_MARR_SETTL = 2
EVENT_MARR_LIC = 3
EVENT_MARR_CONTR = 4
EVENT_MARR_BANNS = 5
EVENT_ENGAGEMENT = 6
EVENT_DIVORCE = 7
EVENT_DIV_FILING = 8
EVENT_ANNULMENT = 9
EVENT_MARR_ALT = 10
EVENT_ADOPT = 11
EVENT_BIRTH = 12
EVENT_DEATH = 13
EVENT_ADULT_CHRISTEN = 14
EVENT_BAPTISM = 15
EVENT_BAR_MITZVAH = 16
EVENT_BAS_MITZVAH = 17
EVENT_BLESS = 18
EVENT_BURIAL = 19
EVENT_CAUSE_DEATH = 20
EVENT_CENSUS = 21
EVENT_CHRISTEN = 22
EVENT_CONFIRMATION = 23
EVENT_CREMATION = 24
EVENT_DEGREE = 25
EVENT_EDUCATION = 26
EVENT_ELECTED = 27
EVENT_EMIGRATION = 28
EVENT_FIRST_COMMUN = 29
EVENT_IMMIGRATION = 30
EVENT_GRADUATION = 31
EVENT_MED_INFO = 32
EVENT_MILITARY_SERV = 33
EVENT_NATURALIZATION = 34
EVENT_NOB_TITLE = 35
EVENT_NUM_MARRIAGES = 36
EVENT_OCCUPATION = 37
EVENT_ORDINATION = 38
EVENT_PROBATE = 39
EVENT_PROPERTY = 40
EVENT_RELIGION = 41
EVENT_RESIDENCE = 42
EVENT_RETIREMENT = 43
EVENT_WILL = 44
familyConstantEvents = {
EVENT_ANNULMENT : "ANUL",
EVENT_DIV_FILING : "DIVF",
EVENT_DIVORCE : "DIV",
EVENT_ENGAGEMENT : "ENGA",
EVENT_MARR_BANNS : "MARB",
EVENT_MARR_CONTR : "MARC",
EVENT_MARR_LIC : "MARL",
EVENT_MARR_SETTL : "MARS",
EVENT_MARRIAGE : "MARR"
}
family_events = {
EVENT_UNKNOWN : _("Unknown"),
EVENT_CUSTOM : _("Custom"),
EVENT_MARRIAGE : _("Marriage"),
EVENT_MARR_SETTL : _("Marriage Settlement"),
EVENT_MARR_LIC : _("Marriage License"),
EVENT_MARR_CONTR : _("Marriage Contract"),
EVENT_MARR_BANNS : _("Marriage Banns"),
EVENT_ENGAGEMENT : _("Engagement"),
EVENT_DIVORCE : _("Divorce"),
EVENT_DIV_FILING : _("Divorce Filing"),
EVENT_ANNULMENT : _("Annulment"),
EVENT_MARR_ALT : _("Alternate Marriage"),
}
personalConstantEvents = {
EVENT_ADOPT : "ADOP",
EVENT_ADULT_CHRISTEN : "CHRA",
EVENT_BIRTH : "BIRT",
EVENT_DEATH : "DEAT",
EVENT_BAPTISM : "BAPM",
EVENT_BAR_MITZVAH : "BARM",
EVENT_BAS_MITZVAH : "BASM",
EVENT_BLESS : "BLES",
EVENT_BURIAL : "BURI",
EVENT_CAUSE_DEATH : "CAUS",
EVENT_ORDINATION : "ORDI",
EVENT_CENSUS : "CENS",
EVENT_CHRISTEN : "CHR" ,
EVENT_CONFIRMATION : "CONF",
EVENT_CREMATION : "CREM",
EVENT_DEGREE : "",
EVENT_DIV_FILING : "DIVF",
EVENT_EDUCATION : "EDUC",
EVENT_ELECTED : "",
EVENT_ELECTED : "EMIG",
EVENT_FIRST_COMMUN : "FCOM",
EVENT_GRADUATION : "GRAD",
EVENT_MED_INFO : "",
EVENT_MILITARY_SERV : "",
EVENT_NATURALIZATION : "NATU",
EVENT_NOB_TITLE : "TITL",
EVENT_NUM_MARRIAGES : "NMR",
EVENT_IMMIGRATION : "IMMI",
EVENT_OCCUPATION : "OCCU",
EVENT_PROBATE : "PROB",
EVENT_PROPERTY : "PROP",
EVENT_RELIGION : "RELI",
EVENT_RESIDENCE : "RESI",
EVENT_RETIREMENT : "RETI",
EVENT_WILL : "WILL",
}
personal_events = {
EVENT_UNKNOWN : _("Unknown"),
EVENT_CUSTOM : _("Custom"),
EVENT_ADOPT : _("Adopted"),
EVENT_BIRTH : _("Birth"),
EVENT_DEATH : _("Death"),
EVENT_ADULT_CHRISTEN : _("Adult Christening"),
EVENT_BAPTISM : _("Baptism"),
EVENT_BAR_MITZVAH : _("Bar Mitzvah"),
EVENT_BAS_MITZVAH : _("Bas Mitzvah"),
EVENT_BLESS : _("Blessing"),
EVENT_BURIAL : _("Burial"),
EVENT_CAUSE_DEATH : _("Cause Of Death"),
EVENT_CENSUS : _("Census"),
EVENT_CHRISTEN : _("Christening"),
EVENT_CONFIRMATION : _("Confirmation"),
EVENT_CREMATION : _("Cremation"),
EVENT_DEGREE : _("Degree"),
EVENT_DIV_FILING : _("Divorce Filing"),
EVENT_EDUCATION : _("Education"),
EVENT_ELECTED : _("Elected"),
EVENT_EMIGRATION : _("Emigration"),
EVENT_FIRST_COMMUN : _("First Communion"),
EVENT_IMMIGRATION : _("Immigration"),
EVENT_GRADUATION : _("Graduation"),
EVENT_MED_INFO : _("Medical Information"),
EVENT_MILITARY_SERV : _("Military Service"),
EVENT_NATURALIZATION : _("Naturalization"),
EVENT_NOB_TITLE : _("Nobility Title"),
EVENT_NUM_MARRIAGES : _("Number of Marriages"),
EVENT_OCCUPATION : _("Occupation"),
EVENT_ORDINATION : _("Ordination"),
EVENT_PROBATE : _("Probate"),
EVENT_PROPERTY : _("Property"),
EVENT_RELIGION : _("Religion"),
EVENT_RESIDENCE : _("Residence"),
EVENT_RETIREMENT : _("Retirement"),
EVENT_WILL : _("Will")
}
#-------------------------------------------------------------------------
#
# Attribute constants
#
#-------------------------------------------------------------------------
ATTR_UNKNOWN = -1
ATTR_CUSTOM = 0
ATTR_CASTE = 1
ATTR_DESCRIPTION = 2
ATTR_ID = 3
ATTR_NATIONAL = 4
ATTR_NUM_CHILD = 5
ATTR_SSN = 6
personal_attributes = {
ATTR_UNKNOWN : _("Unknown"),
ATTR_CUSTOM : _("Custom"),
ATTR_CASTE : _("Caste"),
ATTR_DESCRIPTION : _("Description"),
ATTR_ID : _("Identification Number"),
ATTR_NATIONAL : _("National Origin"),
ATTR_NUM_CHILD : _("Number of Children"),
ATTR_SSN : _("Social Security Number"),
}
personalConstantAttributes = {
ATTR_CASTE : "CAST",
ATTR_DESCRIPTION : "DSCR",
ATTR_ID : "IDNO",
ATTR_NATIONAL : "NATI",
ATTR_NUM_CHILD : "NCHI",
ATTR_SSN : "SSN",
}
familyConstantAttributes = {
ATTR_NUM_CHILD : "NCHI",
}
family_attributes = {
ATTR_UNKNOWN : _("Unknown"),
ATTR_CUSTOM : _("Custom"),
ATTR_NUM_CHILD : _("Number of Children"),
}
#-------------------------------------------------------------------------
#
# Family Relationship Translation table
#
#-------------------------------------------------------------------------
FAMILY_MARRIED = 0
FAMILY_UNMARRIED = 1
FAMILY_CIVIL_UNION = 2
FAMILY_UNKNOWN = 3
FAMILY_CUSTOM = 4
family_relations = {
FAMILY_MARRIED : _("Married"),
FAMILY_UNMARRIED : _("Unmarried"),
FAMILY_CIVIL_UNION : _("Civil Union"),
FAMILY_UNKNOWN : _("Unknown"),
FAMILY_CUSTOM : _("Other"),
}
family_rel_descriptions = {
FAMILY_MARRIED : _("A legal or common-law relationship "
"between a husband and wife"),
FAMILY_UNMARRIED : _("No legal or common-law relationship "
"between man and woman"),
FAMILY_CIVIL_UNION : _("An established relationship between "
"members of the same sex"),
FAMILY_UNKNOWN : _("Unknown relationship between a man and woman"),
FAMILY_CUSTOM : _("An unspecified relationship between "
"a man and woman"),
}
#-------------------------------------------------------------------------
#
# Name constants
#
#-------------------------------------------------------------------------
NAME_UNKNOWN = -1
NAME_CUSTOM = 0
NAME_AKA = 1
NAME_BIRTH = 2
NAME_MARRIED = 3
NameTypesMap = {
NAME_UNKNOWN : _("Unknown"),
NAME_CUSTOM : _("Custom"),
NAME_AKA : _("Also Known As"),
NAME_BIRTH : _("Birth Name"),
NAME_MARRIED : _("Married Name"),
}
#-------------------------------------------------------------------------
#
# Role constants
#
#-------------------------------------------------------------------------
ROLE_UNKNOWN = -1
ROLE_CUSTOM = 0
ROLE_PRIMARY = 1
ROLE_CLERGY = 2
ROLE_CELEBRANT = 3
ROLE_AIDE = 4
ROLE_BRIDE = 5
ROLE_GROOM = 6
ROLE_WITNESS = 7
event_roles = {
ROLE_UNKNOWN : _("Unknown"),
ROLE_CUSTOM : _("Custom"),
ROLE_PRIMARY : _("Primary participant"),
ROLE_CLERGY : _("Clergy personnel"),
ROLE_CELEBRANT : _("Celebrant"),
ROLE_AIDE : _("Aide"),
ROLE_BRIDE : _("Bride"),
ROLE_GROOM : _("Groom"),
ROLE_WITNESS : _("Witness"),
}
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
SRC_MEDIA_UNKNOWN = -1
SRC_MEDIA_CUSTOM = 0
SRC_MEDIA_AUDIO = 1
SRC_MEDIA_BOOK = 2
SRC_MEDIA_CARD = 3
SRC_MEDIA_ELECTRONIC = 4
SRC_MEDIA_FICHE = 5
SRC_MEDIA_FILM = 6
SRC_MEDIA_MAGAZINE = 7
SRC_MEDIA_MANUSCRIPT = 8
SRC_MEDIA_MAP = 9
SRC_MEDIA_NEWSPAPER = 10
SRC_MEDIA_PHOTO = 11
SRC_MEDIA_THOMBSTOBE = 12
SRC_MEDIA_VIDEO = 13
source_media_types = {
SRC_MEDIA_UNKNOWN : _("Unknown"),
SRC_MEDIA_CUSTOM : _("Custom"),
SRC_MEDIA_AUDIO : _("Audio"),
SRC_MEDIA_BOOK : _("Book"),
SRC_MEDIA_CARD : _("Card"),
SRC_MEDIA_ELECTRONIC : _("Electronic"),
SRC_MEDIA_FICHE : _("Fiche"),
SRC_MEDIA_FILM : _("Film"),
SRC_MEDIA_MAGAZINE : _("Magazine"),
SRC_MEDIA_MANUSCRIPT : _("Manuscript"),
SRC_MEDIA_MAP : _("Map"),
SRC_MEDIA_NEWSPAPER : _("Newspaper"),
SRC_MEDIA_PHOTO : _("Photo"),
SRC_MEDIA_THOMBSTOBE : _("Thombstone"),
SRC_MEDIA_VIDEO : _("Video"),
}
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #