gramps/src/const.py

517 lines
15 KiB
Python
Raw Normal View History

2001-05-13 07:26:57 +05:30
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import os
import intl
import GdkImlib
2001-05-13 07:26:57 +05:30
_ = intl.gettext
#-------------------------------------------------------------------------
#
# Paths to external programs
#
#-------------------------------------------------------------------------
editor = "gimp"
zipcmd = "zip -r -q"
convert = "convert"
2001-05-13 07:26:57 +05:30
#-------------------------------------------------------------------------
#
# Exceptions
#
#-------------------------------------------------------------------------
OpenFailed = "Open Failed"
#-------------------------------------------------------------------------
#
# Paths to files - assumes that files reside in the same directory as
# this one, and that the plugins directory is in a directory below this.
#
#-------------------------------------------------------------------------
if os.environ.has_key('GRAMPSDIR'):
2001-06-22 01:11:56 +05:30
rootDir = os.environ['GRAMPSDIR']
else:
rootDir = "."
2001-05-13 07:26:57 +05:30
logo = rootDir + os.sep + "gramps.xpm"
gladeFile = rootDir + os.sep + "gramps.glade"
placesFile = rootDir + os.sep + "places.glade"
2001-05-13 07:26:57 +05:30
imageselFile = rootDir + os.sep + "imagesel.glade"
marriageFile = rootDir + os.sep + "marriage.glade"
editPersonFile = rootDir + os.sep + "EditPerson.glade"
bookFile = rootDir + os.sep + "bookmarks.glade"
pluginsFile = rootDir + os.sep + "plugins.glade"
2001-06-03 04:26:04 +05:30
editnoteFile = rootDir + os.sep + "editnote.glade"
2001-05-13 07:26:57 +05:30
configFile = rootDir + os.sep + "config.glade"
2001-06-06 04:45:43 +05:30
stylesFile = rootDir + os.sep + "styles.glade"
dialogFile = rootDir + os.sep + "dialog.glade"
2001-10-24 06:54:18 +05:30
mergeFile = rootDir + os.sep + "mergedata.glade"
2001-05-13 07:26:57 +05:30
pluginsDir = rootDir + os.sep + "plugins"
filtersDir = rootDir + os.sep + "filters"
dataDir = rootDir + os.sep + "data"
gtkrcFile = rootDir + os.sep + "gtkrc"
#-------------------------------------------------------------------------
#
# About box information
#
#-------------------------------------------------------------------------
progName = "gramps"
2001-10-04 09:52:41 +05:30
version = "0.6.0pre"
2001-05-13 07:26:57 +05:30
copyright = "(C) 2001 Donald N. Allingham"
authors = ["Donald N. Allingham"]
2001-06-07 19:19:00 +05:30
comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program that can be extended by using the Python programming language.")
2001-05-13 07:26:57 +05:30
#-------------------------------------------------------------------------
#
# Enable/disable exceptions. For debugging purposes
#
#-------------------------------------------------------------------------
useExceptions= 0
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
picWidth = 275.0
2001-10-17 05:39:42 +05:30
thumbScale = 96.0
2001-05-13 07:26:57 +05:30
indexFile = "data.gramps"
male = _("male")
female = _("female")
unknown = _("unknown")
2001-05-13 07:26:57 +05:30
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
2001-08-22 04:12:33 +05:30
output_formats = [
"OpenOffice",
"AbiWord",
"PDF",
"HTML"
]
childRelations = {
_("Birth") : "Birth",
_("Adopted") : "Adopted",
_("Stepchild") : "Stepchild",
_("Foster") : "Foster",
_("None") : "None",
_("Unknown") : "Unknown",
_("Other") : "Other",
}
2001-05-13 07:26:57 +05:30
#-------------------------------------------------------------------------
#
# Confidence
#
#-------------------------------------------------------------------------
2001-08-22 04:12:33 +05:30
confidence = [
_("Very Low"),
_("Low"),
_("Normal"),
_("High"),
_("Very High")
]
#-------------------------------------------------------------------------
#
# Family event string mappings
#
#-------------------------------------------------------------------------
2001-05-13 07:26:57 +05:30
familyConstantEvents = {
2001-08-22 04:12:33 +05:30
"Annulment" : "ANUL",
"Divorce Filing" : "DIVF",
"Divorce" : "DIV",
"Engagement" : "ENGA",
"Marriage Contract" : "MARC",
"Marriage License" : "MARL",
"Marriage Settlement" : "MARS",
"Marriage" : "MARR"
2001-05-13 07:26:57 +05:30
}
_fe_e2l = {
2001-08-22 04:12:33 +05:30
"Annulment" : _("Annulment"),
"Divorce Filing" : _("Divorce Filing"),
"Divorce" : _("Divorce"),
"Engagement" : _("Engagement"),
"Marriage Contract" : _("Marriage Contract"),
"Marriage License" : _("Marriage License"),
"Marriage Settlement" : _("Marriage Settlement"),
"Marriage" : _("Marriage")
}
_fe_l2e = {}
for a in _fe_e2l.keys():
_fe_l2e[_fe_e2l[a]] = a
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def display_fevent(st):
if _fe_e2l.has_key(st):
return _fe_e2l[st]
else:
return st
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def save_fevent(st):
if _fe_l2e.has_key(st):
return _fe_l2e[st]
else:
return st
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
2001-05-13 07:26:57 +05:30
personalConstantEvents = {
2001-09-09 02:05:10 +05:30
"Adopted" : "ADOP",
"Adult Christening" : "CHRA",
"Alternate Birth" : "BIRT",
"Alternate Death" : "DEAT",
"Baptism (LDS)" : "BAPL",
"Baptism" : "BAPM",
"Bar Mitzvah" : "BARM",
"Bas Mitzvah" : "BASM",
"Burial" : "BURI",
"Cause Of Death" : "CAUS",
"Ordination" : "ORID",
"Census" : "CENS",
"Christening" : "CHR" ,
"Confirmation" : "CONF",
"Cremation" : "CREM",
"Degree" : "_DEG",
"Divorce Filing" : "DIVF",
"Education" : "EDUC",
"Elected" : "_ELEC",
"Emigration" : "EMIG",
"First Communion" : "FCOM",
"Graduation" : "GRAD",
"Medical Information" : "_MDCL",
"Military Service" : "_MILT",
"Naturalization" : "NATU",
"Immigration" : "IMMI",
"Occupation" : "OCCU",
"Probate" : "PROB",
"Property" : "PROP",
"Religion" : "RELI",
"Residence" : "RESI",
"Retirement" : "RETI",
"Will" : "WILL"
2001-05-13 07:26:57 +05:30
}
_pe_e2l = {
2001-09-09 02:05:10 +05:30
"Adopted" : _("Adopted"),
"Alternate Birth" : _("Alternate Birth"),
"Alternate Death" : _("Alternate Death"),
"Adult Christening" : _("Adult Christening"),
"Baptism (LDS)" : _("Baptism (LDS)"),
"Baptism" : _("Baptism"),
"Bar Mitzvah" : _("Bar Mitzvah"),
"Bas Mitzvah" : _("Bas Mitzvah"),
"Burial" : _("Burial"),
"Cause Of Death" : _("Cause Of Death"),
"Census" : _("Census"),
"Christening" : _("Christening"),
"Confirmation" : _("Confirmation"),
"Cremation" : _("Cremation"),
"Degree" : _("Degree"),
"Divorce Filing" : _("Divorce Filing"),
"Education" : _("Education"),
"Elected" : _("Elected"),
"Emigration" : _("Emigration"),
"First Communion" : _("First Communion"),
"Immigration" : _("Immigration"),
"Graduation" : _("Graduation"),
"Medical Information" : _("Medical Information"),
"Military Service" : _("Military Service"),
"Naturalization" : _("Naturalization"),
"Occupation" : _("Occupation"),
"Ordination" : _("Ordination"),
"Probate" : _("Probate"),
"Property" : _("Property"),
"Religion" : _("Religion"),
"Residence" : _("Residence"),
"Retirement" : _("Retirement"),
"Will" : _("Will")
}
_pe_l2e = {}
for a in _pe_e2l.keys():
_pe_l2e[_pe_e2l[a]] = a
2001-07-03 22:44:17 +05:30
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def display_pevent(st):
if _pe_e2l.has_key(st):
return _pe_e2l[st]
else:
return st
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def save_pevent(st):
if _pe_l2e.has_key(st):
return _pe_l2e[st]
else:
return st
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
2001-05-13 07:26:57 +05:30
personalConstantAttributes = {
"Caste" : "CAST",
2001-05-13 07:26:57 +05:30
"Description" : "DSCR",
2001-07-03 22:44:17 +05:30
"Identification Number" : "IDNO",
"National Origin" : "NATI",
2001-05-13 07:26:57 +05:30
"Social Security Number": "SSN"
}
2001-07-03 22:44:17 +05:30
_pa_e2l = {
"Caste" : _("Caste"),
2001-07-03 22:44:17 +05:30
"Description" : _("Description"),
"Identification Number" : _("Identification Number"),
"National Origin" : _("National Origin"),
2001-07-03 22:44:17 +05:30
"Social Security Number": _("Social Security Number")
}
_pa_l2e = {}
for a in _pa_e2l.keys():
_pa_l2e[_pa_e2l[a]] = a
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def display_pattr(st):
if _pa_e2l.has_key(st):
return _pa_e2l[st]
else:
return st
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def save_pattr(st):
if _pa_l2e.has_key(st):
return _pa_l2e[st]
else:
return st
2001-07-04 02:20:02 +05:30
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
2001-06-03 04:26:04 +05:30
familyConstantAttributes = {
"Number of Children" : "NCHI",
2001-06-03 04:26:04 +05:30
}
2001-07-04 02:20:02 +05:30
_fa_e2l = {
"Number of Children" : _("Number of Children"),
2001-07-04 02:20:02 +05:30
}
_fa_l2e = {}
for a in _fa_e2l.keys():
_fa_l2e[_fa_e2l[a]] = a
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def display_fattr(st):
if _fa_e2l.has_key(st):
return _fa_e2l[st]
else:
return st
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def save_fattr(st):
if _fa_l2e.has_key(st):
return _fa_l2e[st]
else:
return st
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
_frel2def = {
_("Married") : _("A legal or common-law relationship between a husband and wife"),
_("Unmarried"): _("No legal or common-law relationship between man and woman"),
_("Partners") : _("An established relationship between members of the same sex"),
_("Unknown") : _("Unknown relationship between a man and woman"),
_("Other") : _("An unspecified relationship between a man and woman")
}
2001-07-04 02:20:02 +05:30
_fr_e2l = {
2001-08-22 04:12:33 +05:30
"Married" : _("Married"),
"Unmarried" : _("Unmarried"),
"Partners" : _("Partners"),
"Unknown" : _("Unknown"),
"Other" : _("Other")
2001-07-04 02:20:02 +05:30
}
_fr_l2e = {}
for a in _fa_e2l.keys():
_fa_l2e[_fa_e2l[a]] = a
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def relationship_def(txt):
if _frel2def.has_key(txt):
return _frel2def[txt]
else:
return _("No definition available")
2001-07-04 02:20:02 +05:30
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def display_frel(st):
if _fr_e2l.has_key(st):
return _fr_e2l[st]
else:
return st
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def save_frel(st):
if _fr_l2e.has_key(st):
return _fr_l2e[st]
else:
return st
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
2001-07-03 22:44:17 +05:30
def initialize_personal_event_list():
p = []
for event in personalConstantEvents.keys():
p.append(_pe_e2l[event])
p.sort()
return p
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
2001-07-03 22:44:17 +05:30
def initialize_marriage_event_list():
p = []
for event in familyConstantEvents.keys():
p.append(_fe_e2l[event])
p.sort()
return p
2001-07-03 22:44:17 +05:30
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def initialize_personal_attribute_list():
p = []
for event in personalConstantAttributes.keys():
p.append(_pa_e2l[event])
p.sort()
return p
2001-05-13 07:26:57 +05:30
2001-07-04 02:20:02 +05:30
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def initialize_family_attribute_list():
p = []
for event in familyConstantAttributes.keys():
p.append(_fa_e2l[event])
p.sort()
return p
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def initialize_family_relation_list():
p = []
for event in _fr_e2l.keys():
p.append(_fr_e2l[event])
p.sort()
return p
2001-07-03 22:44:17 +05:30
personalEvents = initialize_personal_event_list()
personalAttributes = initialize_personal_attribute_list()
marriageEvents = initialize_marriage_event_list()
2001-07-04 02:20:02 +05:30
familyAttributes = initialize_family_attribute_list()
familyRelations = initialize_family_relation_list()
places = []
surnames = []
xpm_data = [
'/* XPM */',
'static char * foo_xpm[] = {',
'"1 1 1 1"',
'" c None"',
'" "};']
empty_image = GdkImlib.create_image_from_xpm(xpm_data)