diff --git a/ChangeLog b/ChangeLog index a0c1b4344..0b1cb8b99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,13 @@ * src/GrampsDb/_GrampsIniKeys.py: os independent path 2006-03-20 Don Allingham + * src/lds.py: move LDS specific data out of const.py.in + * src/const.py.in: remove unused info + * src/DataViews.py: allow suppression of tool tips + * src/NameDisplay.py: sorted name key generation + * src/RelLib/_Name.py: remove sorted name function + * src/DisplayTabs.py: assign reference handle to new event_ref + * src/DisplayModels.py: new sort function * src/Editors/_EditPerson.py: call the callback if defined * src/SelectPerson.py: take out the profiling code * src/GrampsDb/_GrampsBSDDB.py: use db.THREAD to avoid diff --git a/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index 701c5beef..bcecc0db8 100644 --- a/src/DataViews/_PersonView.py +++ b/src/DataViews/_PersonView.py @@ -53,6 +53,8 @@ import Utils import QuestionDialog import TreeTips import Errors +import const + from Editors import EditPerson from DdTargets import DdTargets @@ -348,8 +350,9 @@ class PersonView(PageView.PersonNavView): self.generic_filter_widget.inverted()) self.tree.set_model(self.model) - if self.model.tooltip_column != None: - self.tooltips = TreeTips.TreeTips(self.tree, self.model.tooltip_column, + if const.use_tips and self.model.tooltip_column != None: + self.tooltips = TreeTips.TreeTips(self.tree, + self.model.tooltip_column, True) self.build_columns() self.dirty = False diff --git a/src/DisplayModels.py b/src/DisplayModels.py index 5ec7df439..0b039a9b8 100644 --- a/src/DisplayModels.py +++ b/src/DisplayModels.py @@ -436,7 +436,7 @@ class FamilyModel(BaseModel): def sort_father(self,data): if data[2]: person = self.db.get_person_from_handle(data[2]) - return person.primary_name.get_sort_name() + return NameDisplay.displayer.sort_string(person.primary_name) else: return u"" @@ -450,7 +450,7 @@ class FamilyModel(BaseModel): def sort_mother(self,data): if data[3]: person = self.db.get_person_from_handle(data[3]) - return person.primary_name.get_sort_name() + return NameDisplay.displayer.sort_string(person.primary_name) else: return u"" diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index c651802c1..fc78d9975 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -650,6 +650,7 @@ class EventEmbedList(EmbeddedList): self.rebuild() def event_added(self,ref,event): + ref.ref = event.handle self.get_data().append(ref) self.changed = True self.rebuild() @@ -1524,7 +1525,7 @@ class ChildModel(gtk.ListStore): self.column_birth_place(child), self.column_death_place(child), child.get_handle(), - child.get_primary_name().get_sort_name(), + NameDisplay.display.sort_string(child.primary_name), self.column_birth_sort(child), self.column_death_sort(child), ]) diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index 8a5b5a257..485670090 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -453,49 +453,49 @@ class EditFamily(EditPrimary): selector_window.close() - def mother_clicked(self, obj): - handle = self.obj.get_mother_handle() - if handle: - self.obj.set_mother_handle(None) - self.update_mother(None) - else: - from SelectPerson import SelectPerson - - data_filter = FastFemaleFilter(self.dbstate.db) - sel = SelectPerson(self.dbstate.db, "Select Mother", - filter=data_filter, - skip=self.obj.get_child_handle_list()) - person = sel.run() - - if person: - self.obj.set_mother_handle(person.handle) - self.update_mother(person.handle) - -# def mother_clicked(self,obj): +# def mother_clicked(self, obj): # handle = self.obj.get_mother_handle() # if handle: # self.obj.set_mother_handle(None) # self.update_mother(None) # else: -# filter_spec = PersonFilterSpec() -# filter_spec.set_gender(RelLib.Person.FEMALE) +# from SelectPerson import SelectPerson + +# data_filter = FastFemaleFilter(self.dbstate.db) +# sel = SelectPerson(self.dbstate.db, "Select Mother", +# filter=data_filter, +# skip=self.obj.get_child_handle_list()) +# person = sel.run() + +# if person: +# self.obj.set_mother_handle(person.handle) +# self.update_mother(person.handle) + + def mother_clicked(self,obj): + handle = self.obj.get_mother_handle() + if handle: + self.obj.set_mother_handle(None) + self.update_mother(None) + else: + filter_spec = PersonFilterSpec() + filter_spec.set_gender(RelLib.Person.FEMALE) -# child_birth_years = [] -# for person_handle in self.obj.get_child_handle_list(): -# person = self.db.get_person_from_handle(person_handle) -# event_ref = person.get_birth_ref() -# if event_ref and event_ref.ref: -# event = self.db.get_event_from_handle(event_ref.ref) -# child_birth_years.append(event.get_date_object().get_year()) + child_birth_years = [] + for person_handle in self.obj.get_child_handle_list(): + person = self.db.get_person_from_handle(person_handle) + event_ref = person.get_birth_ref() + if event_ref and event_ref.ref: + event = self.db.get_event_from_handle(event_ref.ref) + child_birth_years.append(event.get_date_object().get_year()) -# if len(child_birth_years) > 0: -# filter_spec.set_birth_year(min(child_birth_years)) -# filter_spec.set_birth_criteria(PersonFilterSpec.BEFORE) + if len(child_birth_years) > 0: + filter_spec.set_birth_year(min(child_birth_years)) + filter_spec.set_birth_criteria(PersonFilterSpec.BEFORE) -# selector = PersonSelector(self.dbstate,self.uistate, -# self.track,filter_spec=filter_spec) -# selector.connect('add-object',self.on_change_mother) + selector = PersonSelector(self.dbstate,self.uistate, + self.track,filter_spec=filter_spec) + selector.connect('add-object',self.on_change_mother) def on_change_father(self, selector_window, obj): if obj.__class__ == RelLib.Person: diff --git a/src/GrampsDb/_ReadGedcom.py b/src/GrampsDb/_ReadGedcom.py index db7201bfe..2fb124583 100644 --- a/src/GrampsDb/_ReadGedcom.py +++ b/src/GrampsDb/_ReadGedcom.py @@ -31,6 +31,7 @@ import os import re import string import const +import lds import time from TransUtils import sgettext as _ @@ -1430,8 +1431,8 @@ class GedcomParser: elif matches[1] == TOKEN_NOTE: note = self.parse_note(matches,lds_ord,level+1,note) elif matches[1] == TOKEN_STAT: - if const.lds_status.has_key(matches[2]): - lds_ord.set_status(const.lds_status[matches[2]]) + if lds.status.has_key(matches[2]): + lds_ord.set_status(lds.status[matches[2]]) else: self.barf(level+1) @@ -2401,11 +2402,11 @@ def load_place_values(place,text): #------------------------------------------------------------------------- def extract_temple(matches): try: - if const.lds_temple_to_abrev.has_key(matches[2]): - return const.lds_temple_to_abrev[matches[2]] + if lds.temple_to_abrev.has_key(matches[2]): + return lds.temple_to_abrev[matches[2]] else: values = matches[2].split() - return const.lds_temple_to_abrev[values[0]] + return lds.temple_to_abrev[values[0]] except: return None diff --git a/src/GrampsDb/_ReadXML.py b/src/GrampsDb/_ReadXML.py index e9d5f486c..60ac04651 100644 --- a/src/GrampsDb/_ReadXML.py +++ b/src/GrampsDb/_ReadXML.py @@ -1368,7 +1368,6 @@ class GrampsParser: if self.name.get_type() == "": self.name.set_type("Birth Name") self.person.set_primary_name (self.name) - self.person.get_primary_name().build_sort_name() self.name = None def stop_rname(self,tag): diff --git a/src/GrampsDb/_WriteGedcom.py b/src/GrampsDb/_WriteGedcom.py index b423e4cf4..2c77b05dd 100644 --- a/src/GrampsDb/_WriteGedcom.py +++ b/src/GrampsDb/_WriteGedcom.py @@ -30,6 +30,12 @@ import os import time import re import shutil + +try: + set() +except: + from sets import Set as set + from TransUtils import sgettext as _ #------------------------------------------------------------------------ @@ -56,6 +62,7 @@ import gtk.glade import RelLib import GenericFilter import const +import lds import _GedcomInfo as GedcomInfo import Errors import ansel_utf8 @@ -69,6 +76,16 @@ def keep_utf8(s): def iso8859(s): return s.encode('iso-8859-1','replace') +#------------------------------------------------------------------------- +# +# GEDCOM tags representing attributes that may take a parameter, value or +# description on the same line as the tag +# +#------------------------------------------------------------------------- +personalAttributeTakesParam = set(["CAST", "DSCR", "EDUC", "IDNO", + "NATI", "NCHI", "NMR", "OCCU", + "PROP", "RELI", "SSN", "TITL"]) + #------------------------------------------------------------------------- # # Calendar month names @@ -711,7 +728,7 @@ class GedcomWriter: mother_alive = Utils.probably_alive(person,self.db) if not self.restrict or ( not father_alive and not mother_alive ): - self.write_ord("SLGS",family.get_lds_sealing(),1,const.lds_ssealing) + self.write_ord("SLGS",family.get_lds_sealing(),1,lds.ssealing) for event_ref in family.get_event_ref_list(): event_handle = event_ref.ref @@ -869,9 +886,9 @@ class GedcomWriter: ad = 0 - self.write_ord("BAPL",person.get_lds_baptism(),1,const.lds_baptism) - self.write_ord("ENDL",person.get_lds_endowment(),1,const.lds_baptism) - self.write_ord("SLGC",person.get_lds_sealing(),1,const.lds_csealing) + self.write_ord("BAPL",person.get_lds_baptism(),1,lds.baptism) + self.write_ord("ENDL",person.get_lds_endowment(),1,lds.baptism) + self.write_ord("SLGC",person.get_lds_sealing(),1,lds.csealing) for event_ref in person.get_event_ref_list(): event = self.db.get_event_from_handle(event_ref.ref) @@ -904,7 +921,7 @@ class GedcomWriter: else: self.writeln('3 ADOP HUSB') elif val : - if const.personalGedcomAttributeTakesParam.has_key(val): + if val in personalAttributeTakesParam: if event.get_description(): self.writeln("1 %s %s" % (self.cnvtxt(val),\ self.cnvtxt(event.get_description()))) diff --git a/src/Makefile.am b/src/Makefile.am index c919a50f7..f7c8fc4b2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -66,6 +66,7 @@ gdir_PYTHON = \ gramps.py\ GrampsWidgets.py\ ImgManip.py\ + lds.py \ ListModel.py\ MergeData.py\ MergePeople.py\ diff --git a/src/NameDisplay.py b/src/NameDisplay.py index dfe33d37e..8bedf00ab 100644 --- a/src/NameDisplay.py +++ b/src/NameDisplay.py @@ -69,6 +69,9 @@ class NameDisplay: """ self.force_upper = upper + def sort_string(self,name): + return u"%-25s%-30s%s" % (name.surname,name.first_name,name.suffix) + def sorted(self,person): """ Returns a text string representing the L{RelLib.Person} instance's diff --git a/src/PeopleModel.py b/src/PeopleModel.py index 5f40599e1..615bd2f92 100644 --- a/src/PeopleModel.py +++ b/src/PeopleModel.py @@ -305,7 +305,7 @@ class PeopleModel(gtk.GenericTreeModel): def column_sort_name(self,data,node): n = Name() n.unserialize(data[_NAME_COL]) - return n.get_sort_name() + return NameDisplay.displayer.sort_string(n) def column_spouse(self,data,node): spouses_names = u"" diff --git a/src/RelLib/_Name.py b/src/RelLib/_Name.py index 85be808a2..8951eab97 100644 --- a/src/RelLib/_Name.py +++ b/src/RelLib/_Name.py @@ -124,8 +124,6 @@ class Name(PrivateSourceNote,DateBase): """ return [self.first_name,self.surname,self.suffix,self.title, self.type[1],self.prefix,self.patronymic] - #return [self.first_name,self.surname,self.suffix,self.title, - # self.type[1],self.prefix,self.patronymic,self.get_date()] def get_text_data_child_list(self): """ @@ -237,35 +235,22 @@ class Name(PrivateSourceNote,DateBase): """returns the type of the Name instance""" return self.type - def build_sort_name(self): - if self.surname: - self.sname = "%-25s%-30s%s" % (self.surname,self.first_name,self.suffix) - else: - self.sname = "@" - def set_first_name(self,name): """sets the given name for the Name instance""" self.first_name = name - self.build_sort_name() def set_patronymic(self,name): """sets the patronymic name for the Name instance""" self.patronymic = name - self.build_sort_name() def set_surname(self,name): """sets the surname (or last name) for the Name instance""" self.surname = name - self.build_sort_name() def set_suffix(self,name): """sets the suffix (such as Jr., III, etc.) for the Name instance""" self.suffix = name - self.build_sort_name() - def get_sort_name(self): - return self.sname - def get_first_name(self): """returns the given name for the Name instance""" return self.first_name diff --git a/src/ViewManager.py b/src/ViewManager.py index bf40d8453..0bf727f13 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -406,9 +406,9 @@ class ViewManager: about = gtk.AboutDialog() about.set_name(const.program_name) about.set_version(const.version) - about.set_copyright(const.copyright) + about.set_copyright(const.copyright_msg) try: - f = open(const.license,"r") + f = open(const.license_file,"r") about.set_license(f.read().replace('\x0c','')) f.close() except: diff --git a/src/const.py.in b/src/const.py.in index 2c2536f3c..fb957d70f 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -51,17 +51,6 @@ app_gramps_package = "application/x-gramps-package" app_geneweb = "application/x-geneweb" app_vcard = ["text/x-vcard","text/x-vcalendar"] -#------------------------------------------------------------------------- -# -# Display update values -# -#------------------------------------------------------------------------- - -UPDATE_PERSON = 0x1 -UPDATE_FAMILY = 0x2 -UPDATE_PLACE = 0x4 -UPDATE_SOURCE = 0x8 - #------------------------------------------------------------------------- # # Paths to external programs @@ -82,25 +71,36 @@ prefixdir = "@GPREFIX@" #------------------------------------------------------------------------- no_gconf = False +#------------------------------------------------------------------------- +# +# Determine the home directory. According to Wikipedia, most UNIX like +# systems use HOME. I'm assuming that this would apply to OS X as well. +# Windows apparently uses USERPROFILE +# +#------------------------------------------------------------------------- +if os.environ.has_key('HOME'): + home_dir = os.path(os.environ['HOME'],'.gramps') +else: + home_dir = os.path(os.environ['USERPROFILE'],'gramps') + #------------------------------------------------------------------------- # # 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. # #------------------------------------------------------------------------- - root_dir = os.path.abspath(os.path.dirname(__file__)) image_dir = os.path.join(root_dir,"images") -custom_filters = "~/.gramps/custom_filters.xml" -report_options = "~/.gramps/report_options.xml" -tool_options = "~/.gramps/tool_options.xml" -bsddbenv_dir = "~/.gramps/bsddbenv" +custom_filters = os.path.join(home_dir,"custom_filters.xml") +report_options = os.path.join(home_dir,"report_options.xml") +tool_options = os.path.join(home_dir,"tool_options.xml") +bsddbenv_dir = os.path.join(home_dir,"bsddbenv") icon = os.path.join(root_dir,"images","gramps.png") logo = os.path.join(root_dir,"images","logo.png") splash = os.path.join(root_dir,"images","splash.jpg") -license = os.path.join(root_dir,"COPYING") +license_file = os.path.join(root_dir,"COPYING") # # Glade files @@ -119,10 +119,11 @@ docgenDir = os.path.join(root_dir,"docgen") data_dir = os.path.join(root_dir,"data") system_filters = os.path.join(data_dir,"system_filters.xml") template_dir = os.path.join(data_dir,"templates") -papersize = "file:%s/papersize.xml" % data_dir tipdata = os.path.join(data_dir,"tips.xml") fdl = os.path.join(data_dir,"fdl.txt") +papersize = "file:%s/papersize.xml" % data_dir + startup = 1 dnd_images = 1 use_tips = False @@ -132,13 +133,13 @@ use_tips = False # About box information # #------------------------------------------------------------------------- -program_name = "GRAMPS" -version = "@VERSIONSTRING@" -copyright = unicode("© 2001-2005 Donald N. Allingham","iso-8859-1") -comments = _("GRAMPS (Genealogical Research and Analysis " - "Management Programming System) is a personal " - "genealogy program.") -authors = [ +program_name = "GRAMPS" +version = "@VERSIONSTRING@" +copyright_msg = unicode("© 2001-2006 Donald N. Allingham","iso-8859-1") +comments = _("GRAMPS (Genealogical Research and Analysis " + "Management Programming System) is a personal " + "genealogy program.") +authors = [ "Donald N. Allingham", "Alexander Roitman", "Richard Taylor", @@ -148,7 +149,7 @@ authors = [ "David Hampton", ] -documenters = [ +documenters = [ 'Alexander Roitman', ] @@ -217,213 +218,3 @@ longopts = [ shortopts = "O:i:o:f:a:p:?" -#------------------------------------------------------------------------- -# -# GEDCOM tags representing attributes that may take a parameter, value or -# description on the same line as the tag -# -#------------------------------------------------------------------------- -personalGedcomAttributeTakesParam = { - "CAST" : 1, - "DSCR" : 1, - "EDUC" : 1, - "IDNO" : 1, - "NATI" : 1, - "NCHI" : 1, - "NMR" : 1, - "OCCU" : 1, - "PROP" : 1, - "RELI" : 1, - "SSN" : 1, - "TITL" : 1 - } - -#------------------------------------------------------------------------- -# -# -# -#------------------------------------------------------------------------- - -places = [] -surnames = [] - -# -#Updated LDS Temple Codes from: -#http://www.geocities.com/rgpassey/temple/abclist.htm -#Confirmed against Temple Codes list recieved from Raliegh Temple -#Last update: 1/12/02 -# - -lds_temple_codes = { - "Aba, Nigeria" : "ABA", #1 Added - "Accra, Ghana" : "ACCRA", #2 Added - "Adelaide, Australia" : "ADELA", #3 Added - "Albuquerque, New Mexico" : "ALBUQ", #4 Added - "Anchorage, Alaska" : "ANCHO", #6 Added - "Apia, Samoa" : "APIA", #7 - "Asuncion, Paraguay" : "ASUNC", #8 Added - "Atlanta, Georgia" : "ATLAN", #9 - "Baton Rouge, Louisiana" : "BROUG", #10 Added - "Bern, Switzerland" : "SWISS", #11 - "Billings, Montana" : "BILLI", #12 Added - "Birmingham, Alabama" : "BIRMI", #13 Added - "Bismarck, North Dakota" : "BISMA", #14 Added - "Bogota, Columbia" : "BOGOT", #15 - "Boise, Idaho" : "BOISE", #16 - "Boston, Massachusetts" : "BOSTO", #17 Added - "Bountiful, Utah" : "BOUNT", #18 - "Brisban, Australia" : "BRISB", #19 Added - "Buenos Aires, Argentina" : "BAIRE", #20 - "Campinas, Brazil" : "CAMPI", #21 Added - "Caracas, Venezuela" : "CARAC", #22 Added - "Cardston, Alberta" : "ALBER", #23 - "Chicago, Illinois" : "CHICA", #24 - "Ciudad Juarez, Chihuahua" : "CIUJU", #25 Added - "Cochabamba, Boliva" : "COCHA", #26 - "Colonia Juarez, Chihuahua" : "COLJU", #27 Added - "Columbia, South Carolina" : "COLSC", #28 Added - "Columbia River, Washington" : "CRIVE", #121 Added - "Columbus, Ohio" : "COLUM", #29 Added - "Copenhagen, Denmark" : "COPEN", #30 Added - "Curitiba, Brazil" : "CURIT", - "Manhattan, New York" : "MANHA", - "Panama City, Panama" : "PCITY", - "Dallas, Texas" : "DALLA", #31 - "Denver, Colorado" : "DENVE", #32 - "Detroit, Michigan" : "DETRO", #33 Added - "Edmonton, Alberta" : "EDMON", #34 Added - "Frankfurt, Germany" : "FRANK", #35 - "Fresno, California" : "FRESN", #36 Added - "Freiberg, Germany" : "FREIB", #37 - "Fukuoka, Japan" : "FUKUO", #38 Added - "Guadalajara, Jalisco" : "GUADA", #39 Added - "Guatamala City, Guatamala" : "GUATE", #40 - "Guayaquil, Ecuador" : "GUAYA", #41 - "Halifax, Noca Scotia" : "HALIF", #42 Added - "Hamilton, New Zealand" : "NZEAL", #43 - "Harrison, New York" : "NYORK", #44 Added - "Hartford, Connecticut" : "HARTF", #Can not find in list used. ? - "Helsinki, Finland" : "HELSI", #45 Added - "Hermosillo, Sonora" : "HERMO", #46 Added - "Hong Kong, China" : "HKONG", #47 - "Houston, Texas" : "HOUST", #48 Added - "Idaho Falls, Idaho" : "IFALL", #49 - "Johannesburg, South Africa" : "JOHAN", #50 - "Jordan River, Utah" : "JRIVE", #111 - "Kialua Kona, Hawaii" : "KONA", #51 Added - "Kiev, Ukraine" : "KIEV", #52 Added - "Laie, Hawaii" : "HAWAI", #54 - "Las Vegas, Nevada" : "LVEGA", #55 - "Lima, Peru" : "LIMA" , #56 - "Logan, Utah" : "LOGAN", #57 - "London, England" : "LONDO", #58 - "Los Angeles, California" : "LANGE", #59 - "Louisville, Kentucky" : "LOUIS", #60 Added - "Lubbock, Texas" : "LUBBO", #61 Added - "Madrid, Spain" : "MADRI", #62 - "Manila, Philippines" : "MANIL", #63 - "Manti, Utah" : "MANTI", #64 - "Medford, Oregon" : "MEDFO", #65 Added - "Melbourne, Australia" : "MELBO", #66 Added - "Melphis, Tennessee" : "MEMPH", #67 Added - "Merida, Yucatan" : "MERID", #68 Added - "Mesa, Arizona" : "ARIZO", #69 - "Mexico City, Mexico" : "MEXIC", #70 - "Monterrey, Nuevo Leon" : "MONTE", #71 Added - "Montevideo, Uruguay" : "MNTVD", #72 - "Monticello, Utah" : "MONTI", #73 Added - "Montreal, Quebec" : "MONTR", #74 Added - "Mt. Timpanogos, Utah" : "MTIMP", #5 - "Nashville, Tennessee" : "NASHV", #75 - "Nauvoo, Illinois" : "NAUVO", #76 - "Nauvoo, Illinois (New)" : "NAUV2", #Rebuilt Added - "Newport Beach, California" : "NBEAC", #77 Added - "Nuku'alofa, Tonga" : "NUKUA", #78 - "Oakland, California" : "OAKLA", #79 - "Oaxaca, Oaxaca" : "OAKAC", #80 Added - "Ogden, Utah" : "OGDEN", #81 - "Oklahoma City, Oklahoma" : "OKLAH", #82 Added - "Orlando, Florida" : "ORLAN", #84 - "Palmayra, New York" : "PALMY", #85 Added - "Papeete, Tahiti" : "PAPEE", #86 - "Perth, Australia" : "PERTH", #87 Added - "Portland, Oregon" : "PORTL", #88 - "Porto Alegre, Brazil" : "PALEG", #89 Added - "Preston, England" : "PREST", #90 - "Provo, Utah" : "PROVO", #91 - "Raleigh, North Carolina" : "RALEI", #92 Added - "Recife, Brazil" : "RECIF", #93 - "Redlands, California" : "REDLA", #94 Added - "Regina, Saskatchewan" : "REGIN", #95 Added - "Reno, Nevada" : "RENO", #96 Added - "Sacramento, California" : "SACRA", #97 Added - "St. George, Utah" : "SGEOR", #98 - "St. Louis, Missouri" : "SLOUI", #99 - "St. Paul, Minnesota" : "SPMIN", #100 Added - "Salt Lake City, Utah" : "SLAKE", #101 - "San Diego, California" : "SDIEG", #102 - "San Antonio, Texas" : "ANTON", #103 Added - "San Jose, Costa Rica" : "SJOSE", #104 Added - "Santiago, Chile" : "SANTI", #105 - "Santo Domingo, Dominican Republic" : "SDOMI", #106 - "Sao Paulo, Brazil" : "SPAUL", #107 - "Seattle, Washington" : "SEATT", #108 - "Seoul, South Korea" : "SEOUL", #109 - "Snowflake, Arizona" : "SNOWF", #110 Added - "Spokane, Washington" : "SPOKA", #112 - "Stockholm, Sweden" : "STOCK", #113 - "Suva, Fiji" : "SUVA", #114 Added - "Sydney, Australia" : "SYDNE", #115 - "Taipei, Taiwan" : "TAIPE", #116 - "Tampico, Tamaulipas" : "TAMPI", #117 Added - "The Hague, Netherlands" : "HAGUE", #118 Added - "Tokyo, Japan" : "TOKYO", #119 - "Toronto, Ontario" : "TORNO", #120 - "Tuxtla Gutierrez, Chiapas" : "TGUTI", #122 Added - "Vera Cruz, Vera Cruz" : "VERAC", #123 Added - "Vernal, Utah" : "VERNA", #124 - "Villahermosa, Tabasco" : "VILLA", #125 Added - "Washington, D.C." : "WASHI", #126 - "Winter Quarters, Nebraska" : "WINTE", #83 Added -#Other Places - "Endowment House" : "EHOUS", #Not a temple per se - "President's Office" : "POFFI", #Not a temple per se - - -} - -lds_temple_to_abrev = {} -for (name,abbr) in lds_temple_codes.iteritems(): - lds_temple_to_abrev[abbr] = name - -lds_status = { - "BIC" : 1, "CANCELED" : 1, "CHILD" : 1, - "CLEARED" : 2, "COMPLETED" : 3, "DNS" : 4, - "INFANT" : 4, "PRE-1970" : 5, "QUALIFIED" : 6, - "DNS/CAN" : 7, "STILLBORN" : 7, "SUBMITTED" : 8, - "UNCLEARED" : 9, - } - -lds_baptism = [ - _(""), _("Child"), _("Cleared"), _("Completed"), - _("Infant"), _("Pre-1970"), _("Qualified"), _("Stillborn"), - _("Submitted"), _("Uncleared"), - ] - -lds_csealing = [ - _(""), _("BIC"), _("Cleared"), _("Completed"), - _("DNS"), _("Pre-1970"), _("Qualified"), _("Stillborn"), - _("Submitted"), _("Uncleared"), - ] - -lds_ssealing = [ - _(""), _("Canceled"), _("Cleared"), _("Completed"), - _("DNS"), _("Pre-1970"), _("Qualified"), _("DNS/CAN"), - _("Submitted"), _("Uncleared"), - ] - - -notes_formats = [ - _("Flowed"), - _("Preformatted"), -] diff --git a/src/lds.py b/src/lds.py new file mode 100644 index 000000000..ffc0db33d --- /dev/null +++ b/src/lds.py @@ -0,0 +1,206 @@ +# -*- python -*- +# -*- coding: utf-8 -*- +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2006 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 +# + +# $Id: const.py.in 6156 2006-03-16 20:25:15Z rshura $ + +#------------------------------------------------------------------------- +# +# Standard python modules +# +#------------------------------------------------------------------------- +from TransUtils import sgettext as _ + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- + +# +#Updated LDS Temple Codes from: +#http://www.geocities.com/rgpassey/temple/abclist.htm +#Confirmed against Temple Codes list recieved from Raliegh Temple +#Last update: 1/12/02 +# + +lds_temple_codes = { + "Aba, Nigeria" : "ABA", #1 Added + "Accra, Ghana" : "ACCRA", #2 Added + "Adelaide, Australia" : "ADELA", #3 Added + "Albuquerque, New Mexico" : "ALBUQ", #4 Added + "Anchorage, Alaska" : "ANCHO", #6 Added + "Apia, Samoa" : "APIA", #7 + "Asuncion, Paraguay" : "ASUNC", #8 Added + "Atlanta, Georgia" : "ATLAN", #9 + "Baton Rouge, Louisiana" : "BROUG", #10 Added + "Bern, Switzerland" : "SWISS", #11 + "Billings, Montana" : "BILLI", #12 Added + "Birmingham, Alabama" : "BIRMI", #13 Added + "Bismarck, North Dakota" : "BISMA", #14 Added + "Bogota, Columbia" : "BOGOT", #15 + "Boise, Idaho" : "BOISE", #16 + "Boston, Massachusetts" : "BOSTO", #17 Added + "Bountiful, Utah" : "BOUNT", #18 + "Brisban, Australia" : "BRISB", #19 Added + "Buenos Aires, Argentina" : "BAIRE", #20 + "Campinas, Brazil" : "CAMPI", #21 Added + "Caracas, Venezuela" : "CARAC", #22 Added + "Cardston, Alberta" : "ALBER", #23 + "Chicago, Illinois" : "CHICA", #24 + "Ciudad Juarez, Chihuahua" : "CIUJU", #25 Added + "Cochabamba, Boliva" : "COCHA", #26 + "Colonia Juarez, Chihuahua" : "COLJU", #27 Added + "Columbia, South Carolina" : "COLSC", #28 Added + "Columbia River, Washington" : "CRIVE", #121 Added + "Columbus, Ohio" : "COLUM", #29 Added + "Copenhagen, Denmark" : "COPEN", #30 Added + "Curitiba, Brazil" : "CURIT", + "Manhattan, New York" : "MANHA", + "Panama City, Panama" : "PCITY", + "Dallas, Texas" : "DALLA", #31 + "Denver, Colorado" : "DENVE", #32 + "Detroit, Michigan" : "DETRO", #33 Added + "Edmonton, Alberta" : "EDMON", #34 Added + "Frankfurt, Germany" : "FRANK", #35 + "Fresno, California" : "FRESN", #36 Added + "Freiberg, Germany" : "FREIB", #37 + "Fukuoka, Japan" : "FUKUO", #38 Added + "Guadalajara, Jalisco" : "GUADA", #39 Added + "Guatamala City, Guatamala" : "GUATE", #40 + "Guayaquil, Ecuador" : "GUAYA", #41 + "Halifax, Noca Scotia" : "HALIF", #42 Added + "Hamilton, New Zealand" : "NZEAL", #43 + "Harrison, New York" : "NYORK", #44 Added + "Hartford, Connecticut" : "HARTF", #Can not find in list used. ? + "Helsinki, Finland" : "HELSI", #45 Added + "Hermosillo, Sonora" : "HERMO", #46 Added + "Hong Kong, China" : "HKONG", #47 + "Houston, Texas" : "HOUST", #48 Added + "Idaho Falls, Idaho" : "IFALL", #49 + "Johannesburg, South Africa" : "JOHAN", #50 + "Jordan River, Utah" : "JRIVE", #111 + "Kialua Kona, Hawaii" : "KONA", #51 Added + "Kiev, Ukraine" : "KIEV", #52 Added + "Laie, Hawaii" : "HAWAI", #54 + "Las Vegas, Nevada" : "LVEGA", #55 + "Lima, Peru" : "LIMA" , #56 + "Logan, Utah" : "LOGAN", #57 + "London, England" : "LONDO", #58 + "Los Angeles, California" : "LANGE", #59 + "Louisville, Kentucky" : "LOUIS", #60 Added + "Lubbock, Texas" : "LUBBO", #61 Added + "Madrid, Spain" : "MADRI", #62 + "Manila, Philippines" : "MANIL", #63 + "Manti, Utah" : "MANTI", #64 + "Medford, Oregon" : "MEDFO", #65 Added + "Melbourne, Australia" : "MELBO", #66 Added + "Melphis, Tennessee" : "MEMPH", #67 Added + "Merida, Yucatan" : "MERID", #68 Added + "Mesa, Arizona" : "ARIZO", #69 + "Mexico City, Mexico" : "MEXIC", #70 + "Monterrey, Nuevo Leon" : "MONTE", #71 Added + "Montevideo, Uruguay" : "MNTVD", #72 + "Monticello, Utah" : "MONTI", #73 Added + "Montreal, Quebec" : "MONTR", #74 Added + "Mt. Timpanogos, Utah" : "MTIMP", #5 + "Nashville, Tennessee" : "NASHV", #75 + "Nauvoo, Illinois" : "NAUVO", #76 + "Nauvoo, Illinois (New)" : "NAUV2", #Rebuilt Added + "Newport Beach, California" : "NBEAC", #77 Added + "Nuku'alofa, Tonga" : "NUKUA", #78 + "Oakland, California" : "OAKLA", #79 + "Oaxaca, Oaxaca" : "OAKAC", #80 Added + "Ogden, Utah" : "OGDEN", #81 + "Oklahoma City, Oklahoma" : "OKLAH", #82 Added + "Orlando, Florida" : "ORLAN", #84 + "Palmayra, New York" : "PALMY", #85 Added + "Papeete, Tahiti" : "PAPEE", #86 + "Perth, Australia" : "PERTH", #87 Added + "Portland, Oregon" : "PORTL", #88 + "Porto Alegre, Brazil" : "PALEG", #89 Added + "Preston, England" : "PREST", #90 + "Provo, Utah" : "PROVO", #91 + "Raleigh, North Carolina" : "RALEI", #92 Added + "Recife, Brazil" : "RECIF", #93 + "Redlands, California" : "REDLA", #94 Added + "Regina, Saskatchewan" : "REGIN", #95 Added + "Reno, Nevada" : "RENO", #96 Added + "Sacramento, California" : "SACRA", #97 Added + "St. George, Utah" : "SGEOR", #98 + "St. Louis, Missouri" : "SLOUI", #99 + "St. Paul, Minnesota" : "SPMIN", #100 Added + "Salt Lake City, Utah" : "SLAKE", #101 + "San Diego, California" : "SDIEG", #102 + "San Antonio, Texas" : "ANTON", #103 Added + "San Jose, Costa Rica" : "SJOSE", #104 Added + "Santiago, Chile" : "SANTI", #105 + "Santo Domingo, Dominican Republic" : "SDOMI", #106 + "Sao Paulo, Brazil" : "SPAUL", #107 + "Seattle, Washington" : "SEATT", #108 + "Seoul, South Korea" : "SEOUL", #109 + "Snowflake, Arizona" : "SNOWF", #110 Added + "Spokane, Washington" : "SPOKA", #112 + "Stockholm, Sweden" : "STOCK", #113 + "Suva, Fiji" : "SUVA", #114 Added + "Sydney, Australia" : "SYDNE", #115 + "Taipei, Taiwan" : "TAIPE", #116 + "Tampico, Tamaulipas" : "TAMPI", #117 Added + "The Hague, Netherlands" : "HAGUE", #118 Added + "Tokyo, Japan" : "TOKYO", #119 + "Toronto, Ontario" : "TORNO", #120 + "Tuxtla Gutierrez, Chiapas" : "TGUTI", #122 Added + "Vera Cruz, Vera Cruz" : "VERAC", #123 Added + "Vernal, Utah" : "VERNA", #124 + "Villahermosa, Tabasco" : "VILLA", #125 Added + "Washington, D.C." : "WASHI", #126 + "Winter Quarters, Nebraska" : "WINTE", #83 Added +#Other Places + "Endowment House" : "EHOUS", #Not a temple per se + "President's Office" : "POFFI", #Not a temple per se + + +} + +lds_temple_to_abrev = {} +for (name,abbr) in lds_temple_codes.iteritems(): + lds_temple_to_abrev[abbr] = name + +status = { + "BIC" : 1, "CANCELED" : 1, "CHILD" : 1, + "CLEARED" : 2, "COMPLETED" : 3, "DNS" : 4, + "INFANT" : 4, "PRE-1970" : 5, "QUALIFIED" : 6, + "DNS/CAN" : 7, "STILLBORN" : 7, "SUBMITTED" : 8, + "UNCLEARED" : 9, + } + +csealing = [ + _(""), _("BIC"), _("Cleared"), _("Completed"), + _("DNS"), _("Pre-1970"), _("Qualified"), _("Stillborn"), + _("Submitted"), _("Uncleared"), + ] + +ssealing = [ + _(""), _("Canceled"), _("Cleared"), _("Completed"), + _("DNS"), _("Pre-1970"), _("Qualified"), _("DNS/CAN"), + _("Submitted"), _("Uncleared"), + ] + diff --git a/src/plugins/TestcaseGenerator.py b/src/plugins/TestcaseGenerator.py index 8ca9469f7..92452c31d 100644 --- a/src/plugins/TestcaseGenerator.py +++ b/src/plugins/TestcaseGenerator.py @@ -50,6 +50,7 @@ import Errors import RelLib from PluginUtils import Tool, register_tool import const +import lds import Utils from QuestionDialog import ErrorDialog from DateHandler import parser as _dp @@ -819,13 +820,13 @@ class TestcaseGenerator(Tool.Tool): #LDS if randint(0,1) == 1: - lds = self.rand_ldsord( const.lds_baptism) + lds = self.rand_ldsord( lds.baptism) np.set_lds_baptism( lds) if randint(0,1) == 1: - lds = self.rand_ldsord( const.lds_baptism) + lds = self.rand_ldsord( lds.baptism) np.set_lds_endowment( lds) if randint(0,1) == 1: - lds = self.rand_ldsord( const.lds_csealing) + lds = self.rand_ldsord( lds.csealing) np.set_lds_sealing( lds) person_handle = self.db.add_person(np,self.trans) @@ -879,7 +880,7 @@ class TestcaseGenerator(Tool.Tool): fam.set_relationship( self.rand_type(Utils.family_relations)) else: fam.set_relationship((RelLib.Family.MARRIED,'')) - lds = self.rand_ldsord( const.lds_ssealing) + lds = self.rand_ldsord( lds.ssealing) fam.set_lds_sealing( lds) fam_h = self.db.add_family(fam,self.trans) fam = self.db.commit_family(fam,self.trans) @@ -946,7 +947,7 @@ class TestcaseGenerator(Tool.Tool): fam.set_relationship( self.rand_type(Utils.family_relations)) else: fam.set_relationship( (RelLib.Family.MARRIED,'') ) - lds = self.rand_ldsord( const.lds_ssealing) + lds = self.rand_ldsord( lds.ssealing) fam.set_lds_sealing( lds) fam.add_child_handle(child_h) fam_h = self.db.add_family(fam,self.trans) @@ -1225,7 +1226,7 @@ class TestcaseGenerator(Tool.Tool): if randint(0,1) == 1: lds.set_status( randint(0,len(status_list)-1)) if randint(0,1) == 1: - lds.set_temple( choice( const.lds_temple_to_abrev.keys())) + lds.set_temple( choice( lds.temple_to_abrev.keys())) if randint(0,1) == 1: lds.set_place_handle( self.rand_place()) return lds