svn: r8173

This commit is contained in:
Don Allingham 2007-02-19 22:50:09 +00:00
parent fa225335e6
commit 1c55edca96
3 changed files with 51 additions and 1 deletions

View File

@ -143,6 +143,9 @@ class NoteTab(GrampsTab):
hbox.pack_start(button, False)
else:
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:
self.empty = False

View File

@ -263,6 +263,49 @@ CONT_RE = re.compile(r"\s*\d+\s+CONT\s?(.*)$")
CONC_RE = re.compile(r"\s*\d+\s+CONC\s?(.*)$")
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
#-------------------------------------------------------------------------
#
#

View File

@ -26,7 +26,7 @@ import os
import gtk
import Errors
from _GedcomParse import GedcomParser, NoteParser
from _GedcomParse import GedcomParser, NoteParser, StageOne
from QuestionDialog import ErrorDialog
from bsddb import db
@ -73,6 +73,10 @@ def import2(database, filename, callback, code_set, use_trans):
# add some checking here
try:
ifile = open(filename,"rU")
np = StageOne(ifile)
np.parse()
print np.get_encoding()
ifile.seek(0)
np = NoteParser(ifile, False, code_set)
ifile.seek(0)
gedparse = GedcomParser(database, ifile, filename, callback, code_set,