From c1487b1e59a6487bf8ea1f992469ac3b95b21e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Thu, 3 Mar 2011 09:27:43 +0000 Subject: [PATCH] 4692, 4519, 4390: try to avoid empty event types with a better support for web addresses on individual svn: r16749 --- src/plugins/lib/libgedcom.py | 40 ++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/plugins/lib/libgedcom.py b/src/plugins/lib/libgedcom.py index bcadc5ae7..e21c3b94d 100644 --- a/src/plugins/lib/libgedcom.py +++ b/src/plugins/lib/libgedcom.py @@ -244,6 +244,8 @@ TOKEN_MAP = 120 TOKEN_LATI = 121 TOKEN_LONG = 122 TOKEN_FACT = 123 +TOKEN_EMAIL = 124 +TOKEN_URL = 125 TOKENS = { "HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI, @@ -343,7 +345,9 @@ TOKENS = { "MAP" : TOKEN_MAP, "LATI" : TOKEN_LATI, "LONG" : TOKEN_LONG, "_ITALIC" : TOKEN_IGNORE, "_PAREN" : TOKEN_IGNORE,"_PLACE" : TOKEN_IGNORE, - "FACT" : TOKEN_FACT, + "FACT" : TOKEN_FACT, "EMAIL" : TOKEN_EMAIL, + "EMAI" : TOKEN_EMAIL, "_URL" : TOKEN_URL, + "URL" : TOKEN_URL, } ADOPT_NONE = 0 @@ -1827,7 +1831,9 @@ class GedcomParser(UpdateCallback): TOKEN_CHAN : self.__person_chan, TOKEN_ADDR : self.__person_addr, - TOKEN_PHON : self.__person_phon, + TOKEN_PHON : self.__person_phon, + TOKEN_EMAIL : self.__person_email, + TOKEN_URL : self.__person_url, TOKEN__TODO : self.__skip_record, TOKEN_TITL : self.__person_titl, } @@ -3084,6 +3090,36 @@ class GedcomParser(UpdateCallback): addr.set_street("Unknown") addr.set_phone(line.data) state.person.add_address(addr) + + def __person_email(self, line, state): + """ + O INDI + 1 EMAIL {0:3} + + @param line: The current line in GedLine format + @type line: GedLine + @param state: The current state + @type state: CurrentState + """ + url = gen.lib.Url() + url.set_path(line.data) + url.set_type(gen.lib.UrlType(gen.lib.UrlType.EMAIL)) + state.person.add_url(url) + + def __person_url(self, line, state): + """ + O INDI + 1 URL {0:3} + + @param line: The current line in GedLine format + @type line: GedLine + @param state: The current state + @type state: CurrentState + """ + url = gen.lib.Url() + url.set_path(line.data) + url.set_type(gen.lib.UrlType(gen.lib.UrlType.WEB_HOME)) + state.person.add_url(url) def __person_titl(self, line, state): """