svn: r8173
This commit is contained in:
parent
fa225335e6
commit
1c55edca96
@ -143,6 +143,9 @@ class NoteTab(GrampsTab):
|
|||||||
hbox.pack_start(button, False)
|
hbox.pack_start(button, False)
|
||||||
else:
|
else:
|
||||||
hbox.pack_start(gtk.VSeparator(), False)
|
hbox.pack_start(gtk.VSeparator(), False)
|
||||||
|
hbox.pack_start(gtk.Label(_('Additional Notes:')),False)
|
||||||
|
self.menu = gtk.ComboBox()
|
||||||
|
hbox.pack_start(self.menu, True)
|
||||||
|
|
||||||
if self.note_obj:
|
if self.note_obj:
|
||||||
self.empty = False
|
self.empty = False
|
||||||
|
@ -263,6 +263,49 @@ CONT_RE = re.compile(r"\s*\d+\s+CONT\s?(.*)$")
|
|||||||
CONC_RE = re.compile(r"\s*\d+\s+CONC\s?(.*)$")
|
CONC_RE = re.compile(r"\s*\d+\s+CONC\s?(.*)$")
|
||||||
PERSON_RE = re.compile(r"\s*\d+\s+\@(\S+)\@\s+INDI(.*)$")
|
PERSON_RE = re.compile(r"\s*\d+\s+\@(\S+)\@\s+INDI(.*)$")
|
||||||
|
|
||||||
|
class StageOne:
|
||||||
|
def __init__(self, ifile):
|
||||||
|
self.ifile = ifile
|
||||||
|
self.famc = {}
|
||||||
|
self.fams = {}
|
||||||
|
self.enc = ""
|
||||||
|
|
||||||
|
def parse(self):
|
||||||
|
current = ""
|
||||||
|
for line in self.ifile:
|
||||||
|
data = line.split(None,2) + ['']
|
||||||
|
(level, key, value) = data[:3]
|
||||||
|
value = value.strip()
|
||||||
|
level = int(level)
|
||||||
|
key = key.strip()
|
||||||
|
|
||||||
|
if level == 0 and value == "FAM":
|
||||||
|
current = key.strip()
|
||||||
|
current = current[1:-1]
|
||||||
|
elif key in ("HUSB", "WIFE") and value[0] == '@':
|
||||||
|
value = value[1:-1]
|
||||||
|
if self.fams.has_key(current):
|
||||||
|
self.fams[current].append(value)
|
||||||
|
else:
|
||||||
|
self.fams[current] = [value]
|
||||||
|
elif key == "CHIL" and value[0] == '@':
|
||||||
|
value = value[1:-1]
|
||||||
|
if self.famc.has_key(current):
|
||||||
|
self.famc[current].append(value)
|
||||||
|
else:
|
||||||
|
self.famc[current] = [value]
|
||||||
|
elif key == 'CHAR':
|
||||||
|
self.enc = value
|
||||||
|
|
||||||
|
def get_famc_map(self):
|
||||||
|
return self.famc
|
||||||
|
|
||||||
|
def get_fams_map(self):
|
||||||
|
return self.fams
|
||||||
|
|
||||||
|
def get_encoding(self):
|
||||||
|
return self.enc
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -26,7 +26,7 @@ import os
|
|||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
import Errors
|
import Errors
|
||||||
from _GedcomParse import GedcomParser, NoteParser
|
from _GedcomParse import GedcomParser, NoteParser, StageOne
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
from bsddb import db
|
from bsddb import db
|
||||||
|
|
||||||
@ -73,6 +73,10 @@ def import2(database, filename, callback, code_set, use_trans):
|
|||||||
# add some checking here
|
# add some checking here
|
||||||
try:
|
try:
|
||||||
ifile = open(filename,"rU")
|
ifile = open(filename,"rU")
|
||||||
|
np = StageOne(ifile)
|
||||||
|
np.parse()
|
||||||
|
print np.get_encoding()
|
||||||
|
ifile.seek(0)
|
||||||
np = NoteParser(ifile, False, code_set)
|
np = NoteParser(ifile, False, code_set)
|
||||||
ifile.seek(0)
|
ifile.seek(0)
|
||||||
gedparse = GedcomParser(database, ifile, filename, callback, code_set,
|
gedparse = GedcomParser(database, ifile, filename, callback, code_set,
|
||||||
|
Loading…
Reference in New Issue
Block a user