From cba30529cdeaac1b841ab3444c95556b65d94a96 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 11 May 2007 03:47:58 +0000 Subject: [PATCH] 2007-05-10 Don Allingham * src/GrampsDb/_ReadXML.py: fix privacy settings * src/GrampsDb/_WriteXML.py: fix privacy settings * src/LdsUtils.py: updated temple codes * src/DbLoader.py: try to handle default directory better * src/LdsOrd.py: Update from bug tracker (#925) submitted by robocoder svn: r8460 --- gramps2/ChangeLog | 7 + gramps2/src/DbLoader.py | 8 +- gramps2/src/GrampsDb/_ReadXML.py | 11 +- gramps2/src/GrampsDb/_WriteXML.py | 14 +- gramps2/src/LdsUtils.py | 283 +++++++++++++++--------------- gramps2/src/RelLib/_LdsOrd.py | 1 - 6 files changed, 173 insertions(+), 151 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 7a97163bc..380ecf6ce 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,9 @@ +2007-05-10 Don Allingham + * src/GrampsDb/_ReadXML.py: fix privacy settings + * src/GrampsDb/_WriteXML.py: fix privacy settings + * src/LdsUtils.py: updated temple codes + * src/DbLoader.py: try to handle default directory better + 2007-05-10 Benny Malengier * src/GrampsDb/_ReadXML.py: partly fix #1053, import privacy of person, family, media, source, place and repo correct. Still to do: sourceref and lds_ordinance @@ -7,6 +13,7 @@ * src/DataViews/_PedigreeView.py: Some rendering fixes for RTL locales 2007-05-09 Don Allingham + * src/LdsOrd.py: Update from bug tracker (#925) submitted by robocoder * src/GrampsDb/_ReadGedcom.py (GedcomParser.func_name_aka): patch submitted on bug tracker for AKA parameter missing (#1034) diff --git a/gramps2/src/DbLoader.py b/gramps2/src/DbLoader.py index 076aa1864..95f4a62cd 100644 --- a/gramps2/src/DbLoader.py +++ b/gramps2/src/DbLoader.py @@ -513,12 +513,12 @@ def get_default_dir(): default_dir += os.path.sep if len(default_dir)<=1: default_dir = Config.get(Config.RECENT_IMPORT_DIR) - if len(default_dir)<=1: + if not default_dir or len(default_dir)<=1: default_dir = Config.get(Config.RECENT_EXPORT_DIR) - if len(default_dir)<=1: - default_dir = '~/' + if not default_dir or len(default_dir)<=1: + default_dir = os.path.expanduser('~/') else: - default_dir = "~/" + default_dir = os.path.expanduser("~/") return default_dir #------------------------------------------------------------------------- diff --git a/gramps2/src/GrampsDb/_ReadXML.py b/gramps2/src/GrampsDb/_ReadXML.py index f148a6b86..2217c6a7c 100644 --- a/gramps2/src/GrampsDb/_ReadXML.py +++ b/gramps2/src/GrampsDb/_ReadXML.py @@ -677,6 +677,7 @@ class GrampsParser(UpdateCallback): except KeyError: gramps_id = self.map_pid(attrs['ref']) self.placeobj = self.find_place_by_gramps_id(gramps_id) + self.placeobj.private = bool(attrs.get("priv")) def start_placeobj(self,attrs): gramps_id = self.map_pid(attrs['id']) @@ -896,6 +897,8 @@ class GrampsParser(UpdateCallback): self.person = self.find_person_by_gramps_id(new_id) self.person.private = bool(attrs.get("priv")) + self.person.private = bool(attrs.get("priv")) + # Old and new markers: complete=1 and marker=word both have to work if attrs.get('complete'): # this is only true for complete=1 self.person.marker.set(RelLib.MarkerType.COMPLETE) @@ -974,7 +977,7 @@ class GrampsParser(UpdateCallback): url = RelLib.Url() url.path = attrs["href"] url.set_description(attrs.get("description",'')) - url.privacy = bool(attrs.get('priv')) + url.private = bool(attrs.get('priv')) url.type.set_from_xml_str(attrs['type']) if self.person: self.person.add_url(url) @@ -999,6 +1002,7 @@ class GrampsParser(UpdateCallback): # Here we need to support old format of if attrs.has_key('type'): self.family.type.set_from_xml_str(attrs["type"]) + self.family.private = bool(attrs.get("priv")) # Old and new markers: complete=1 and marker=word both have to work if attrs.get('complete'): # this is only true for complete=1 @@ -1106,6 +1110,8 @@ class GrampsParser(UpdateCallback): self.source_ref.ref = handle self.source_ref.confidence = int(attrs.get("conf",self.conf)) + self.source_ref.private = bool(attrs.get("priv")) + if self.photo: self.photo.add_source_reference(self.source_ref) elif self.ord: @@ -1142,7 +1148,6 @@ class GrampsParser(UpdateCallback): self.source.set_gramps_id(gramps_id) except KeyError: self.source = self.find_source_by_gramps_id(gramps_id) - self.source.private = bool(attrs.get("priv")) def start_reporef(self,attrs): @@ -1191,6 +1196,7 @@ class GrampsParser(UpdateCallback): self.object.set_gramps_id(gramps_id) except KeyError: self.object = self.find_object_by_gramps_id(gramps_id) + self.object.private = bool(attrs.get("priv")) # GRAMPS LEGACY: src, mime, and description attributes # now belong to the tag. Here we are supporting @@ -1213,7 +1219,6 @@ class GrampsParser(UpdateCallback): self.repo.set_gramps_id(gramps_id) except KeyError: self.repo = self.find_repository_by_gramps_id(gramps_id) - self.repo.private = bool(attrs.get("priv")) def stop_people(self,*tag): diff --git a/gramps2/src/GrampsDb/_WriteXML.py b/gramps2/src/GrampsDb/_WriteXML.py index 067549aab..f6185a3f8 100644 --- a/gramps2/src/GrampsDb/_WriteXML.py +++ b/gramps2/src/GrampsDb/_WriteXML.py @@ -614,7 +614,9 @@ class XmlWriter(UpdateCallback): sp = " " * index sp2 = " " * (index+1) - self.g.write('%s\n' % (sp,name)) + + priv = conf_priv(ord) + self.g.write('%s\n' % (sp,name,priv)) dateobj = ord.get_date_object() if dateobj and not dateobj.is_empty(): self.write_date(dateobj,index+1) @@ -643,13 +645,17 @@ class XmlWriter(UpdateCallback): d = source_ref.get_date_object() q = source_ref.get_confidence_level() self.g.write(" " * index) + + priv = conf_priv(source_ref) + if p == "" and c == "" and t == "" and d.is_empty() and q == 2: - self.g.write('\n' % ("_"+source.get_handle())) + self.g.write('\n' % ("_"+source.get_handle(), priv)) else: if q == 2: - self.g.write('\n' % ("_"+source.get_handle())) + self.g.write('\n' % ("_"+source.get_handle(), priv)) else: - self.g.write('\n' % ("_"+source.get_handle(),q)) + self.g.write('\n' % ( + "_"+source.get_handle(),q, priv)) self.write_line("spage",p,index+1) self.write_text("scomments",c,index+1) self.write_text("stext",t,index+1) diff --git a/gramps2/src/LdsUtils.py b/gramps2/src/LdsUtils.py index 04269e594..2f7788c84 100644 --- a/gramps2/src/LdsUtils.py +++ b/gramps2/src/LdsUtils.py @@ -20,148 +20,153 @@ # $Id$ -#------------------------------------------------------------------------- -#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 -#------------------------------------------------------------------------- temples = ( - # Temple Name , Code , [Old Codes...] - ("Aba, Nigeria" , "ABA", ), - ("Accra, Ghana" , "ACCRA", ), - ("Adelaide, Australia" , "ADELA", ), - ("Albuquerque, New Mexico" , "ALBUQ", ), - ("Anchorage, Alaska" , "ANCHO", ), - ("Apia, Samoa" , "APIA", "AP"), - ("Asuncion, Paraguay" , "ASUNC", ), - ("Atlanta, Georgia" , "ATLAN", "AT"), - ("Baton Rouge, Louisiana" , "BROUG", ), - ("Bern, Switzerland" , "SWISS", "SW"), - ("Billings, Montana" , "BILLI", ), - ("Birmingham, Alabama" , "BIRMI", ), - ("Bismarck, North Dakota" , "BISMA", ), - ("Bogota, Columbia" , "BOGOT", "BG"), - ("Boise, Idaho" , "BOISE", "BO"), - ("Boston, Massachusetts" , "BOSTO", ), - ("Bountiful, Utah" , "BOUNT", ), - ("Brisban, Australia" , "BRISB", ), - ("Buenos Aires, Argentina" , "BAIRE", "BA"), - ("Campinas, Brazil" , "CAMPI", ), - ("Caracas, Venezuela" , "CARAC", ), - ("Cardston, Alberta" , "ALBER", "AL", "ALBR"), - ("Chicago, Illinois" , "CHICA", "CH"), - ("Ciudad Juarez, Chihuahua" , "CIUJU", ), - ("Cochabamba, Boliva" , "COCHA", ), - ("Colonia Juarez, Chihuahua" , "COLJU", ), - ("Columbia, South Carolina" , "COLSC", ), - ("Columbia River, Washington" , "CRIVE", ), - ("Columbus, Ohio" , "COLUM", ), - ("Copenhagen, Denmark" , "COPEN", ), - ("Curitiba, Brazil" , "CURIT", ), - ("Manhattan, New York" , "MANHA", ), - ("Panama City, Panama" , "PCITY", ), - ("Dallas, Texas" , "DALLA", "DA"), - ("Denver, Colorado" , "DENVE", "DV"), - ("Detroit, Michigan" , "DETRO", ), - ("Edmonton, Alberta" , "EDMON", ), - ("Frankfurt, Germany" , "FRANK", "FR"), - ("Fresno, California" , "FRESN", ), - ("Freiberg, Germany" , "FREIB", "FD"), - ("Fukuoka, Japan" , "FUKUO", ), - ("Guadalajara, Jalisco" , "GUADA", ), - ("Guatamala City, Guatamala" , "GUATE", "GA"), - ("Guayaquil, Ecuador" , "GUAYA", "GY"), - ("Halifax, Noca Scotia" , "HALIF", ), - ("Hamilton, New Zealand" , "NZEAL", "NZ"), - ("Harrison, New York" , "NYORK", ), - ("Hartford, Connecticut" , "HARTF", ), - ("Helsinki, Finland" , "HELSI", ), - ("Hermosillo, Sonora" , "HERMO", ), - ("Hong Kong, China" , "HKONG", ), - ("Houston, Texas" , "HOUST", ), - ("Idaho Falls, Idaho" , "IFALL", ), - ("Johannesburg, South Africa" , "JOHAN", "JO"), - ("Jordan River, Utah" , "JRIVE", "JR"), - ("Kialua Kona, Hawaii" , "KONA", ), - ("Kiev, Ukraine" , "KIEV", ), - ("Laie, Hawaii" , "HAWAI", "HA"), - ("Las Vegas, Nevada" , "LVEGA", "LV"), - ("Lima, Peru" , "LIMA" , "LI"), - ("Logan, Utah" , "LOGAN", "LG"), - ("London, England" , "LONDO", "LD"), - ("Los Angeles, California" , "LANGE", "LA"), - ("Louisville, Kentucky" , "LOUIS", ), - ("Lubbock, Texas" , "LUBBO", ), - ("Madrid, Spain" , "MADRI", ), - ("Manila, Philippines" , "MANIL", "MA"), - ("Manti, Utah" , "MANTI", "MT"), - ("Medford, Oregon" , "MEDFO", ), - ("Melbourne, Australia" , "MELBO", ), - ("Melphis, Tennessee" , "MEMPH", ), - ("Merida, Yucatan" , "MERID", ), - ("Mesa, Arizona" , "ARIZO", "AZ"), - ("Mexico City, Mexico" , "MEXIC", "MX"), - ("Monterrey, Nuevo Leon" , "MONTE", ), - ("Montevideo, Uruguay" , "MNTVD", ), - ("Monticello, Utah" , "MONTI", ), - ("Montreal, Quebec" , "MONTR", ), - ("Mt. Timpanogos, Utah" , "MTIMP", ), - ("Nashville, Tennessee" , "NASHV", ), - ("Nauvoo, Illinois" , "NAUVO", ), - ("Nauvoo, Illinois (New)," , "NAUV2", ), - ("Newport Beach, California" , "NBEAC", ), - ("Nuku'alofa, Tonga" , "NUKUA", "TG"), - ("Oakland, California" , "OAKLA", "OK"), - ("Oaxaca, Oaxaca" , "OAKAC", ), - ("Ogden, Utah" , "OGDEN", "OG"), - ("Oklahoma City, Oklahoma" , "OKLAH", ), - ("Orlando, Florida" , "ORLAN", ), - ("Palmayra, New York" , "PALMY", ), - ("Papeete, Tahiti" , "PAPEE", "TA"), - ("Perth, Australia" , "PERTH", ), - ("Portland, Oregon" , "PORTL", "PT"), - ("Porto Alegre, Brazil" , "PALEG", ), - ("Preston, England" , "PREST", ), - ("Provo, Utah" , "PROVO", "PV"), - ("Raleigh, North Carolina" , "RALEI", ), - ("Recife, Brazil" , "RECIF", ), - ("Redlands, California" , "REDLA", ), - ("Regina, Saskatchewan" , "REGIN", ), - ("Reno, Nevada" , "RENO", ), - ("Sacramento, California" , "SACRA", ), - ("St. George, Utah" , "SGEOR", "SG"), - ("St. Louis, Missouri" , "SLOUI", ), - ("St. Paul, Minnesota" , "SPMIN", ), - ("Salt Lake City, Utah" , "SLAKE", "SL"), - ("San Diego, California" , "SDIEG", "SA"), - ("San Antonio, Texas" , "SANTO", ), - ("San Jose, Costa Rica" , "SJOSE", ), - ("Santiago, Chile" , "SANTI", "SN"), + # Temple Name , Code , [Old Codes...] + ("Aba, Nigeria" , "ABA", ), + ("Accra, Ghana" , "ACCRA", ), + ("Adelaide, Australia" , "ADELA", ), + ("Albuquerque, New Mexico" , "ALBUQ", ), + ("Anchorage, Alaska" , "ANCHO", ), + ("Apia, Samoa" , "APIA", "SAMOA", "AP"), + ("Asuncion, Paraguay" , "ASUNC", ), + ("Atlanta, Georgia" , "ATLAN", "AT"), + ("Baton Rouge, Louisiana" , "BROUG", ), + ("Bern, Switzerland" , "SWISS", "SW"), + ("Billings, Montana" , "BILLI", ), + ("Birmingham, Alabama" , "BIRMI", ), + ("Bismarck, North Dakota" , "BISMA", ), + ("Bogota, Columbia" , "BOGOT", "BG"), + ("Boise, Idaho" , "BOISE", "BO"), + ("Boston, Massachusetts" , "BOSTO", ), + ("Bountiful, Utah" , "BOUNT", ), + ("Brisbane, Australia" , "BRISB", ), + ("Buenos Aires, Argentina" , "BAIRE", "BA"), + ("Campinas, Brazil" , "CAMPI", ), + ("Caracas, Venezuela" , "CARAC", ), + ("Cardston, Alberta" , "ALBER", "AL", "ALBR"), + ("Cebu, Philippines" , "CEBU", ), + ("Chicago, Illinois" , "CHICA", "CH"), + ("Ciudad Juarez, Mexico" , "CIUJU", ), + ("Cochabamba, Boliva" , "COCHA", ), + ("Colonia Juarez, Chihuahua, Mexico" , "COLJU", ), + ("Columbia, South Carolina" , "COLSC", ), + ("Columbia River, Washington" , "CRIVE", ), + ("Columbus, Ohio" , "COLUM", ), + ("Copenhagen, Denmark" , "COPEN", ), + ("Curitiba, Brazil" , "CURIT", ), + ("Dallas, Texas" , "DALLA", "DA"), + ("Denver, Colorado" , "DENVE", "DV"), + ("Detroit, Michigan" , "DETRO", ), + ("Draper, Utah" , "DRAPE", ), + ("Edmonton, Alberta" , "EDMON", ), + ("Frankfurt, Germany" , "FRANK", "FR"), + ("Freiberg, Germany" , "FREIB", "FD"), + ("Fresno, California" , "FRESN", ), + ("Fukuoka, Japan" , "FUKUO", ), + ("Guadalajara, Mexico" , "GUADA", ), + ("Guatemala City, Guatemala" , "GUATE", "GA", "GU"), + ("Guayaquil, Ecuador" , "GUAYA", "GY"), + ("Halifax, Nova Scotia" , "HALIF", ), + ("Hamilton, New Zealand" , "NZEAL", "NZ"), + ("Harrison, New York" , "HARRI", "NYORK"), + ("Hartford, Connecticut" , "HARTF", ), + ("Helsinki, Finland" , "HELSI", ), + ("Hermosillo, Sonora, Mexico" , "HERMO", ), + ("Hong Kong, China" , "HKONG", ), + ("Houston, Texas" , "HOUST", ), + ("Idaho Falls, Idaho" , "IFALL", "IF"), + ("Johannesburg, South Africa" , "JOHAN", "JO"), + ("Jordan River, Utah" , "JRIVE", "JR"), + ("Kona, Hawaii" , "KONA", ), + ("Kiev, Ukraine" , "KIEV", ), + ("Kirtland, Ohio" , "KIRTL", ), + ("Laie, Hawaii" , "HAWAI", "HA"), + ("Las Vegas, Nevada" , "LVEGA", "LV"), + ("Lima, Peru" , "LIMA" , "LI"), + ("Logan, Utah" , "LOGAN", "LG"), + ("London, England" , "LONDO", "LD"), + ("Los Angeles, California" , "LANGE", "LA"), + ("Louisville, Kentucky" , "LOUIS", ), + ("Lubbock, Texas" , "LUBBO", ), + ("Madrid, Spain" , "MADRI", ), + ("Manhattan, New York" , "MANHA", ), + ("Manila, Philippines" , "MANIL", "MA"), + ("Manti, Utah" , "MANTI", "MT"), + ("Medford, Oregon" , "MEDFO", ), + ("Melbourne, Australia" , "MELBO", ), + ("Memphis, Tennessee" , "MEMPH", ), + ("Merida, Mexico" , "MERID", ), + ("Mesa, Arizona" , "ARIZO", "AZ"), + ("Mexico City, Mexico" , "MEXIC", "MX"), + ("Monterrey, Mexico" , "MONTE", ), + ("Montevideo, Uruguay" , "MNTVD", ), + ("Monticello, Utah" , "MONTI", ), + ("Montreal, Quebec" , "MONTR", ), + ("Mt. Timpanogos, Utah" , "MTIMP", ), + ("Nashville, Tennessee" , "NASHV", ), + ("Nauvoo, Illinois" , "NAUVO", "NV"), + ("Nauvoo, Illinois (New)" , "NAUV2", ), + ("Newport Beach, California" , "NBEAC", ), + ("Nuku'alofa, Tonga" , "NUKUA", "TG"), + ("Oakland, California" , "OAKLA", "OK"), + ("Oaxaca, Mexico" , "OAXAC", ), + ("Ogden, Utah" , "OGDEN", "OG"), + ("Oklahoma City, Oklahoma" , "OKLAH", ), + ("Oquirrh Mountain, Utah" , "OMOUN", ), + ("Orlando, Florida" , "ORLAN", ), + ("Palmyra, New York" , "PALMY", ), + ("Panama City, Panama" , "PANAM", ), + ("Papeete, Tahiti" , "PAPEE", "TA"), + ("Perth, Australia" , "PERTH", ), + ("Portland, Oregon" , "PORTL", "PT"), + ("Porto Alegre, Brazil" , "PALEG", ), + ("Preston, England" , "PREST", ), + ("Provo, Utah" , "PROVO", "PV"), + ("Quetzaltenango, Guatemala" , "QUETZ", ), + ("Raleigh, North Carolina" , "RALEI", ), + ("Recife, Brazil" , "RECIF", ), + ("Redlands, California" , "REDLA", ), + ("Regina, Saskatchewan" , "REGIN", ), + ("Reno, Nevada" , "RENO", ), + ("Rexburg, Idaho" , "REXBU", ), + ("Sacramento, California" , "SACRA", ), + ("St. George, Utah" , "SGEOR", "SG"), + ("St. Louis, Missouri" , "SLOUI", ), + ("St. Paul, Minnesota" , "SPMIN", ), + ("Salt Lake City, Utah" , "SLAKE", "SL"), + ("San Antonio, Texas" , "SANTO", ), + ("San Diego, California" , "SDIEG", "SA"), + ("San Jose, Costa Rica" , "SJOSE", ), + ("Santiago, Chile" , "SANTI", "SN"), ("Santo Domingo, Dominican Republic" , "SDOMI", ), - ("Sao Paulo, Brazil" , "SPAUL", "SP"), - ("Seattle, Washington" , "SEATT", "SE"), - ("Seoul, South Korea" , "SEOUL", "SO"), - ("Snowflake, Arizona" , "SNOWF", ), - ("Spokane, Washington" , "SPOKA", ), - ("Stockholm, Sweden" , "STOCK", "ST"), - ("Suva, Fiji" , "SUVA", ), - ("Sydney, Australia" , "SYDNE", "SD"), - ("Taipei, Taiwan" , "TAIPE", "TP"), - ("Tampico, Tamaulipas" , "TAMPI", ), - ("The Hague, Netherlands" , "HAGUE", ), - ("Tokyo, Japan" , "TOKYO", "TK"), - ("Toronto, Ontario" , "TORNO", "TR"), - ("Tuxtla Gutierrez, Chiapas" , "TGUTI", ), - ("Vera Cruz, Vera Cruz" , "VERAC", ), - ("Vernal, Utah" , "VERNA", ), - ("Villahermosa, Tabasco" , "VILLA", ), - ("Washington, D.C." , "WASHI", "WA"), - ("Winter Quarters, Nebraska" , "WINTE", ), + ("Sao Paulo, Brazil" , "SPAUL", "SP"), + ("Seattle, Washington" , "SEATT", "SE"), + ("Seoul, South Korea" , "SEOUL", "SO"), + ("Snowflake, Arizona" , "SNOWF", ), + ("Spokane, Washington" , "SPOKA", ), + ("Stockholm, Sweden" , "STOCK", "ST"), + ("Suva, Fiji" , "SUVA", ), + ("Sydney, Australia" , "SYDNE", "SD"), + ("Taipei, Taiwan" , "TAIPE", "TP"), + ("Tampico, Mexico" , "TAMPI", ), + ("Tegucigalpa, Honduras" , "TEGUC", ), + ("The Hague, Netherlands" , "HAGUE", ), + ("Tokyo, Japan" , "TOKYO", "TK"), + ("Toronto, Ontario" , "TORON", "TORNO", "TR"), + ("Tuxtla Gutierrez, Mexico" , "TGUTI", ), + ("Twin Falls, Idaho" , "TFALL", "TWINF"), + ("Vancouver, British Columbia" , "VANCO", ), + ("Veracruz, Mexico" , "VERAC", ), + ("Vernal, Utah" , "VERNA", ), + ("Villahermosa, Mexico" , "VILLA", ), + ("Washington, D.C." , "WASHI", "WA"), + ("Winter Quarters, Nebraska" , "WINTE", "WQUAR"), -#Other Places, Not temples. - ("Endowment House" , "EHOUS", "EH"), - ("President's Office" , "POFFI", ), +# Other places. Not temples. + ("Endowment House" , "EHOUS", "EH"), + ("President's Office" , "POFFI", "PO"), + ("Historian's Office" , "HOFFI", "HO"), + ("Other" , "OTHER", ), ) temple_codes = {} diff --git a/gramps2/src/RelLib/_LdsOrd.py b/gramps2/src/RelLib/_LdsOrd.py index e13dc240e..2486480f9 100644 --- a/gramps2/src/RelLib/_LdsOrd.py +++ b/gramps2/src/RelLib/_LdsOrd.py @@ -161,7 +161,6 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase, @rtype: list """ return [self.temple] - #return [self.temple,self.get_date()] def get_text_data_child_list(self): """