4692, 4519, 4390: try to avoid empty event types with a better support for web addresses on individual

svn: r16748
This commit is contained in:
Jérôme Rapinat 2011-03-03 09:27:07 +00:00
parent 62a951147b
commit 5cb86e70a5

View File

@ -248,6 +248,7 @@ TOKEN_LONG = 122
TOKEN_FACT = 123
TOKEN_EMAIL = 124
TOKEN_WWW = 125
TOKEN_URL = 126
TOKENS = {
"HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI,
@ -349,6 +350,7 @@ TOKENS = {
"_PAREN" : TOKEN_IGNORE,"_PLACE" : TOKEN_IGNORE,
"FACT" : TOKEN_FACT, "EMAIL" : TOKEN_EMAIL,
"EMAI" : TOKEN_EMAIL, "WWW" : TOKEN_WWW,
"_URL" : TOKEN_URL, "URL" : TOKEN_URL,
}
ADOPT_NONE = 0
@ -1850,7 +1852,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,
}
@ -3113,6 +3117,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 <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 <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):
"""