Do not set patronimic, just give a warning. (Not sure how it is used by
Pro-Gen.) Accept other input filenames (.PER, .REL or .MEM) as well. * src/plugins/ImportProGen.py svn: r10767
This commit is contained in:
parent
d1b284c50d
commit
a792472852
@ -158,7 +158,7 @@ def _get_defname(fname):
|
|||||||
We will strip the C: and convert the rest to a native pathname. Next, this pathname
|
We will strip the C: and convert the rest to a native pathname. Next, this pathname
|
||||||
is compared with <fname>.
|
is compared with <fname>.
|
||||||
'''
|
'''
|
||||||
lines = open( fname ).readlines()
|
lines = open(fname).readlines()
|
||||||
if not lines[0].startswith(r'\0') or len(lines) < 2:
|
if not lines[0].startswith(r'\0') or len(lines) < 2:
|
||||||
raise ProgenError(_("Not a Pro-Gen file"))
|
raise ProgenError(_("Not a Pro-Gen file"))
|
||||||
return None, '?'
|
return None, '?'
|
||||||
@ -177,8 +177,14 @@ def _get_defname(fname):
|
|||||||
dir_, f = os.path.split(os.path.abspath(fname))
|
dir_, f = os.path.split(os.path.abspath(fname))
|
||||||
while dir_:
|
while dir_:
|
||||||
newdefname = os.path.join(dir_, defname)
|
newdefname = os.path.join(dir_, defname)
|
||||||
|
|
||||||
if os.path.exists(newdefname):
|
if os.path.exists(newdefname):
|
||||||
return newdefname, defname
|
return newdefname, defname
|
||||||
|
newdefname = newdefname.upper()
|
||||||
|
if os.path.exists(newdefname):
|
||||||
|
return newdefname, defname
|
||||||
|
|
||||||
|
# One level up
|
||||||
dir_, f = os.path.split(dir_)
|
dir_, f = os.path.split(dir_)
|
||||||
|
|
||||||
return None, defname
|
return None, defname
|
||||||
@ -424,8 +430,8 @@ class PG30_Def:
|
|||||||
class ProgenParser:
|
class ProgenParser:
|
||||||
def __init__(self, dbase, file_):
|
def __init__(self, dbase, file_):
|
||||||
self.bname, ext = os.path.splitext(file_)
|
self.bname, ext = os.path.splitext(file_)
|
||||||
if ext.lower() != '.def':
|
if ext.lower() in ('.per', '.rel', '.mem'):
|
||||||
raise ProgenError(_("Expecting a file with .def extension"))
|
file_ = self.bname + '.def'
|
||||||
self.db = dbase
|
self.db = dbase
|
||||||
self.fname = file_
|
self.fname = file_
|
||||||
|
|
||||||
@ -560,7 +566,7 @@ class ProgenParser:
|
|||||||
__date_pat1 = re.compile(r'(?P<day>\d{1,2}) (-|=) (?P<month>\d{1,2}) (-|=) (?P<year>\d{2,4})', re.VERBOSE)
|
__date_pat1 = re.compile(r'(?P<day>\d{1,2}) (-|=) (?P<month>\d{1,2}) (-|=) (?P<year>\d{2,4})', re.VERBOSE)
|
||||||
__date_pat2 = re.compile(r'(?P<month>\d{1,2}) (-|=) (?P<year>\d{4})', re.VERBOSE)
|
__date_pat2 = re.compile(r'(?P<month>\d{1,2}) (-|=) (?P<year>\d{4})', re.VERBOSE)
|
||||||
__date_pat3 = re.compile(r'(?P<year>\d{4})', re.VERBOSE)
|
__date_pat3 = re.compile(r'(?P<year>\d{4})', re.VERBOSE)
|
||||||
__date_pat4 = re.compile(ur'(v|vóór|voor|na|circa|ca|rond) \s* (?P<year>\d{4})', re.VERBOSE)
|
__date_pat4 = re.compile(ur'(v|vóór|voor|na|circa|ca|rond|±) \s* (?P<year>\d{4})', re.VERBOSE)
|
||||||
__date_pat5 = re.compile(r'(oo|OO) (-|=) (oo|OO) (-|=) (?P<year>\d{2,4})', re.VERBOSE)
|
__date_pat5 = re.compile(r'(oo|OO) (-|=) (oo|OO) (-|=) (?P<year>\d{2,4})', re.VERBOSE)
|
||||||
def __create_date_from_text(self, txt, diag_msg=None):
|
def __create_date_from_text(self, txt, diag_msg=None):
|
||||||
'''
|
'''
|
||||||
@ -738,7 +744,8 @@ class ProgenParser:
|
|||||||
if recflds[call_name_ix]:
|
if recflds[call_name_ix]:
|
||||||
name.set_call_name(recflds[call_name_ix])
|
name.set_call_name(recflds[call_name_ix])
|
||||||
if patronym:
|
if patronym:
|
||||||
name.set_patronymic(patronym)
|
log.warning("Patroniem, %s: '%s'" % (diag_msg, patronym))
|
||||||
|
#name.set_patronymic(patronym)
|
||||||
person.set_primary_name(name)
|
person.set_primary_name(name)
|
||||||
person.set_gender(gender)
|
person.set_gender(gender)
|
||||||
|
|
||||||
@ -837,6 +844,14 @@ class ProgenParser:
|
|||||||
note.set_type(gen.lib.NoteType.EVENT)
|
note.set_type(gen.lib.NoteType.EVENT)
|
||||||
self.db.add_note(note, self.trans)
|
self.db.add_note(note, self.trans)
|
||||||
event.add_note(note.handle)
|
event.add_note(note.handle)
|
||||||
|
if source_text:
|
||||||
|
note_text = "Brontekst: " + source_text
|
||||||
|
log.warning("Baptism, %s: '%s'" % (diag_msg, note_text))
|
||||||
|
note = gen.lib.Note()
|
||||||
|
note.set(note_txt)
|
||||||
|
note.set_type(gen.lib.NoteType.EVENT)
|
||||||
|
self.db.add_note(note, self.trans)
|
||||||
|
event.add_note(note.handle)
|
||||||
|
|
||||||
# Death
|
# Death
|
||||||
date = self.__create_date_from_text(recflds[death_date_ix], diag_msg)
|
date = self.__create_date_from_text(recflds[death_date_ix], diag_msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user