2006-06-14 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: fix INT date format svn: r6890
This commit is contained in:
parent
76f5ce900e
commit
705d880931
@ -1,3 +1,6 @@
|
|||||||
|
2006-06-14 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/GrampsDb/_ReadGedcom.py: fix INT date format
|
||||||
|
|
||||||
2006-06-14 Alex Roitman <shura@gramps-project.org>
|
2006-06-14 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/NameDisplay.py: Factor out commont code.
|
* src/NameDisplay.py: Factor out commont code.
|
||||||
* src/Editors/_EditName.py (_setup_fields): Remove Default item.
|
* src/Editors/_EditName.py (_setup_fields): Remove Default item.
|
||||||
|
@ -182,6 +182,7 @@ modRegexp = re.compile(r"\s*(EST|CAL)\s+(.*)$")
|
|||||||
calRegexp = re.compile(r"\s*(ABT|BEF|AFT)?\s*@#D([^@]+)@\s*(.*)$")
|
calRegexp = re.compile(r"\s*(ABT|BEF|AFT)?\s*@#D([^@]+)@\s*(.*)$")
|
||||||
rangeRegexp = re.compile(r"\s*BET\s+@#D([^@]+)@\s*(.*)\s+AND\s+@#D([^@]+)@\s*(.*)$")
|
rangeRegexp = re.compile(r"\s*BET\s+@#D([^@]+)@\s*(.*)\s+AND\s+@#D([^@]+)@\s*(.*)$")
|
||||||
spanRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)$")
|
spanRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)$")
|
||||||
|
intRegexp = re.compile(r"\s*INT\s+([^(]+)\((.*)\)$")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -2109,13 +2110,9 @@ class GedcomParser(UpdateCallback):
|
|||||||
self.lexer.set_broken_conc(self.gedsource.get_conc())
|
self.lexer.set_broken_conc(self.gedsource.get_conc())
|
||||||
elif matches[1] == TOKEN_CHAR and not self.override:
|
elif matches[1] == TOKEN_CHAR and not self.override:
|
||||||
if matches[2] == "ANSEL":
|
if matches[2] == "ANSEL":
|
||||||
print "ANSEL"
|
|
||||||
self.lexer.set_charset_fn(ansel_to_utf8)
|
self.lexer.set_charset_fn(ansel_to_utf8)
|
||||||
elif matches[2] not in ("UNICODE","UTF-8","UTF8"):
|
elif matches[2] not in ("UNICODE","UTF-8","UTF8"):
|
||||||
print "ASCII/LATIN"
|
|
||||||
self.lexer.set_charset_fn(latin_to_utf8)
|
self.lexer.set_charset_fn(latin_to_utf8)
|
||||||
else:
|
|
||||||
print "UNICODE"
|
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == TOKEN_GEDC:
|
elif matches[1] == TOKEN_GEDC:
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
@ -2236,6 +2233,13 @@ class GedcomParser(UpdateCallback):
|
|||||||
def extract_date(self,text):
|
def extract_date(self,text):
|
||||||
dateobj = RelLib.Date()
|
dateobj = RelLib.Date()
|
||||||
try:
|
try:
|
||||||
|
match = intRegexp.match(text)
|
||||||
|
if match:
|
||||||
|
int_val = True
|
||||||
|
text, comment = match.groups()
|
||||||
|
else:
|
||||||
|
int_val = False
|
||||||
|
|
||||||
match = modRegexp.match(text)
|
match = modRegexp.match(text)
|
||||||
if match:
|
if match:
|
||||||
(mod, text) = match.groups()
|
(mod, text) = match.groups()
|
||||||
@ -2263,6 +2267,8 @@ class GedcomParser(UpdateCallback):
|
|||||||
stop = self.dp.parse(data2)
|
stop = self.dp.parse(data2)
|
||||||
dateobj.set(RelLib.Date.QUAL_NONE, RelLib.Date.MOD_RANGE, cal,
|
dateobj.set(RelLib.Date.QUAL_NONE, RelLib.Date.MOD_RANGE, cal,
|
||||||
start.get_start_date() + stop.get_start_date())
|
start.get_start_date() + stop.get_start_date())
|
||||||
|
if int_val:
|
||||||
|
dateobj.set_text_value(comment)
|
||||||
return dateobj
|
return dateobj
|
||||||
|
|
||||||
match = spanRegexp.match(text)
|
match = spanRegexp.match(text)
|
||||||
@ -2284,6 +2290,8 @@ class GedcomParser(UpdateCallback):
|
|||||||
stop = self.dp.parse(data2)
|
stop = self.dp.parse(data2)
|
||||||
dateobj.set(RelLib.Date.QUAL_NONE, RelLib.Date.MOD_SPAN, cal,
|
dateobj.set(RelLib.Date.QUAL_NONE, RelLib.Date.MOD_SPAN, cal,
|
||||||
start.get_start_date() + stop.get_start_date())
|
start.get_start_date() + stop.get_start_date())
|
||||||
|
if int_val:
|
||||||
|
dateobj.set_text_value(comment)
|
||||||
return dateobj
|
return dateobj
|
||||||
|
|
||||||
match = calRegexp.match(text)
|
match = calRegexp.match(text)
|
||||||
@ -2299,6 +2307,8 @@ class GedcomParser(UpdateCallback):
|
|||||||
return dateobj
|
return dateobj
|
||||||
else:
|
else:
|
||||||
dval = self.dp.parse(text)
|
dval = self.dp.parse(text)
|
||||||
|
if int_val:
|
||||||
|
dateobj.set_text_value(comment)
|
||||||
return dval
|
return dval
|
||||||
except IOError:
|
except IOError:
|
||||||
return self.dp.set_text(text)
|
return self.dp.set_text(text)
|
||||||
|
Loading…
Reference in New Issue
Block a user