2007-02-10 Don Allingham <don@gramps-project.org>

* src/GrampsDb/_GrampsGEDDB.py: new GEDCOM parser module
	* src/RelLib/_BaseObject.py: new GEDCOM parser module
	* src/RelLib/_AttributeBase.py: new GEDCOM parser module
	* src/plugins/PHPGedViewConnector.py: new GEDCOM parser module
	* src/GrampsDbUtils/_GedcomParse.py: new GEDCOM parser module
	* src/GrampsDbUtils/__init__.py: new GEDCOM parser module
	* src/GrampsDbUtils/_GedcomLex.py: new GEDCOM parser module
	* src/GrampsDbUtils/_GrampsDbWRFactories.py: new GEDCOM parser module
	* src/GrampsDbUtils/_GedcomTokens.py: renamed from _GedTokens.py
	* src/GrampsDbUtils/Makefile.am: new GEDCOM parser module
	* src/ArgHandler.py: new GEDCOM parser module
	* example/gedcom/sample.ged: added test cases

	* src/docgen/OpenOfficeDoc.py: remove unused functions
	* src/docgen/HtmlDoc.py: remove unused functions
	* src/docgen/LPRDoc.py: remove unused functions
	* src/docgen/ODFDoc.py: remove unused functions


svn: r8083
This commit is contained in:
Don Allingham 2007-02-11 06:03:29 +00:00
parent 92f4e58fc0
commit fc666133b7
13 changed files with 606 additions and 596 deletions

View File

@ -1,10 +1,24 @@
2007-02-10 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_GrampsGEDDB.py: new GEDCOM parser module
* src/RelLib/_BaseObject.py: new GEDCOM parser module
* src/RelLib/_AttributeBase.py: new GEDCOM parser module
* src/plugins/PHPGedViewConnector.py: new GEDCOM parser module
* src/GrampsDbUtils/_GedcomParse.py: new GEDCOM parser module
* src/GrampsDbUtils/__init__.py: new GEDCOM parser module
* src/GrampsDbUtils/_GedcomLex.py: new GEDCOM parser module
* src/GrampsDbUtils/_GrampsDbWRFactories.py: new GEDCOM parser module
* src/GrampsDbUtils/_GedcomTokens.py: renamed from _GedTokens.py
* src/GrampsDbUtils/Makefile.am: new GEDCOM parser module
* src/ArgHandler.py: new GEDCOM parser module
* example/gedcom/sample.ged: added test cases
2007-02-10 Brian Matherly <brian@gramps-project.org> 2007-02-10 Brian Matherly <brian@gramps-project.org>
* src/BaseDoc.py: remove unused functions * src/BaseDoc.py: remove unused functions
* src/docgen/KwordDoc.py: remove unused functions * src/docgen/KwordDoc.py: remove unused functions
* src/docgen/OpenOfficeDoc.py: remove unused functions * src/docgen/OpenOfficeDoc.py: remove unused functions
* src/docgen/HtmlDoc.py: remove unused functions * src/docgen/HtmlDoc.py: remove unused functions
* src/docgen/LPRDoc.py: remove unused functions * src/docgen/LPRDoc.py: remove unused functions
* src/docgen/ODFDoc.py: remove unused functions * src/docgen/ODFDoc.py: remove unused functions
2007-02-11 Zsolt Foldvari <zfoldvar@users.sourceforge.net> 2007-02-11 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/MarkupText.py: added * src/MarkupText.py: added

View File

@ -58,11 +58,16 @@
1 NAME Edwin Michael /Smith/ 1 NAME Edwin Michael /Smith/
2 NOTE This is a note attached to a name 2 NOTE This is a note attached to a name
2 SOUR @S1600@ 2 SOUR @S1600@
1 BAPL
2 DATE MAR 1852
2 PLAC St John's Campbelltown, NSW
1 ASSO @I07@ 1 ASSO @I07@
2 RELA SomeRelationship 2 RELA SomeRelationship
2 NOTE This is a note for the ASSOC import 2 NOTE This is a note for the ASSOC import
2 SOUR @S1600@ 2 SOUR @S1600@
1 SEX M 1 SEX M
1 _UID THIS_IS_A_UID
1 AFN GXXX-XX
1 TITL Grand Poobah 1 TITL Grand Poobah
1 OBJE 1 OBJE
2 FORM jpeg 2 FORM jpeg
@ -74,6 +79,9 @@
2 FAMC @F02@ 2 FAMC @F02@
1 OCCU 1 OCCU
2 PLAC Software Engineer 2 PLAC Software Engineer
1 EVEN
2 TYPE My Custom Event
2 DATE 2000
1 EDUC 1 EDUC
2 DATE BET. 1979 - 1984 2 DATE BET. 1979 - 1984
2 PLAC UC Berkeley 2 PLAC UC Berkeley

View File

@ -462,7 +462,7 @@ class ArgHandler:
filename = os.path.normpath(os.path.abspath(filename)) filename = os.path.normpath(os.path.abspath(filename))
try: try:
# Cheating here to use default encoding # Cheating here to use default encoding
from GrampsDbUtils._ReadGedcom import import2 from GrampsDbUtils._GedcomParse import import2
import2(self.state.db,filename,None,None,False) import2(self.state.db,filename,None,None,False)
except: except:
print "Error importing %s" % filename print "Error importing %s" % filename

View File

@ -50,7 +50,7 @@ class GrampsGEDDB(GrampsInMemDB):
GrampsInMemDB.load(self,name,callback,mode) GrampsInMemDB.load(self,name,callback,mode)
try: try:
from GrampsDbUtils._ReadGedcom import importData from GrampsDbUtils._GedcomParse import importData
except: except:
log.warning("Failed to load Gedcom reader", exc_info=True) log.warning("Failed to load Gedcom reader", exc_info=True)
raise GrampsDbException("Failed to load Gedcom reader") raise GrampsDbException("Failed to load Gedcom reader")

View File

@ -7,7 +7,9 @@ pkgdatadir = $(datadir)/@PACKAGE@/GrampsDbUtils
pkgdata_PYTHON = \ pkgdata_PYTHON = \
_GedcomInfo.py\ _GedcomInfo.py\
_GedTokens.py\ _GedcomTokens.py\
_GedcomParser.py\
_GedcomLexer.py\
__init__.py\ __init__.py\
_ReadGedcom.py\ _ReadGedcom.py\
_ReadGrdb.py\ _ReadGrdb.py\

View File

@ -39,7 +39,7 @@ from gettext import gettext as _
from ansel_utf8 import ansel_to_utf8 from ansel_utf8 import ansel_to_utf8
from _GedcomInfo import * from _GedcomInfo import *
from _GedTokens import * from _GedcomTokens import *
import RelLib import RelLib
from DateHandler._DateParser import DateParser from DateHandler._DateParser import DateParser
@ -106,6 +106,7 @@ 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+([^(]+)\((.*)\)$") intRegexp = re.compile(r"\s*INT\s+([^(]+)\((.*)\)$")
snameRegexp = re.compile(r"/([^/]*)/([^/]*)")
_calendar_map = { _calendar_map = {
"FRENCH R" : RelLib.Date.CAL_FRENCH, "FRENCH R" : RelLib.Date.CAL_FRENCH,
@ -175,7 +176,7 @@ class GedLine:
self.line = data[4] self.line = data[4]
self.level = data[0] self.level = data[0]
self.token = data[1] self.token = data[1]
self.token_text = data[3] self.token_text = data[3].strip()
self.data = data[2] self.data = data[2]
if self.level == 0: if self.level == 0:
@ -232,6 +233,17 @@ class GedLine:
self.data = attr self.data = attr
self.token = TOKEN_ATTR self.token = TOKEN_ATTR
def calc_attr(self):
attr = RelLib.Attribute()
attr.set_value(self.data)
attr.set_type((RelLib.AttributeType.CUSTOM, self.token_text))
self.data = attr
self.token = TOKEN_ATTR
def calc_lds(self):
self.data = _
self.token = TOKEN_ATTR
def __repr__(self): def __repr__(self):
return "%d: %d (%d:%s) %s" % (self.line, self.level, self.token, return "%d: %d (%d:%s) %s" % (self.line, self.level, self.token,
self.token_text, self.data) self.token_text, self.data)
@ -248,6 +260,9 @@ MAP_DATA = {
TOKEN_SEX : GedLine.calc_sex, TOKEN_SEX : GedLine.calc_sex,
TOKEN_NOTE : GedLine.calc_note, TOKEN_NOTE : GedLine.calc_note,
TOKEN_NCHI : GedLine.calc_nchi, TOKEN_NCHI : GedLine.calc_nchi,
TOKEN__STAT : GedLine.calc_attr,
TOKEN__UID : GedLine.calc_attr,
TOKEN_AFN : GedLine.calc_attr,
} }
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -86,8 +86,8 @@ def gramps_db_reader_factory(db_type):
import _ReadXML as ReadXML import _ReadXML as ReadXML
md = ReadXML.importData md = ReadXML.importData
elif db_type == const.app_gedcom: elif db_type == const.app_gedcom:
import _ReadGedcom as ReadGedcom import _GedcomParse as GedcomParse
md = ReadGedcom.importData md = GedcomParse.importData
else: else:
raise GrampsDbException("Attempt to create a database " raise GrampsDbException("Attempt to create a database "
"reader for unknown format: " "reader for unknown format: "

View File

@ -41,7 +41,7 @@ from _GrampsDbWRFactories import \
gramps_db_reader_factory gramps_db_reader_factory
from _ReadGedcom import GedcomParser from _GedcomParse import GedcomParser
from _WriteGedcom import GedcomWriter from _WriteGedcom import GedcomWriter
from _WriteXML import XmlWriter from _WriteXML import XmlWriter

View File

@ -77,6 +77,7 @@ class AttributeBase:
@param attribute: L{Attribute} instance to add. @param attribute: L{Attribute} instance to add.
@type attribute: L{Attribute} @type attribute: L{Attribute}
""" """
assert type(attribute) != unicode
self.attribute_list.append(attribute) self.attribute_list.append(attribute)
def remove_attribute(self, attribute): def remove_attribute(self, attribute):

View File

@ -173,5 +173,4 @@ class BaseObject:
# Run through child objects # Run through child objects
for obj in self.get_handle_referents(): for obj in self.get_handle_referents():
ret += obj.get_referenced_handles_recursively() ret += obj.get_referenced_handles_recursively()
return ret return ret

View File

@ -319,7 +319,7 @@ class phpGedViewImporter:
gtk.main_iteration() gtk.main_iteration()
def on_next_pressed_cb(self, widget, event=None, data=None): def on_next_pressed_cb(self, widget, event=None, data=None):
import ReadGedcom import GedcomParser
if event: if event:
print event.type print event.type
@ -338,7 +338,7 @@ class phpGedViewImporter:
self.update_progressbar( _("Importing GEDCOM...")) self.update_progressbar( _("Importing GEDCOM..."))
ReadGedcom.importData(self.db, fn) GedcomParser.importData(self.db, fn)
# done. bye. # done. bye.
self.dialog.destroy() self.dialog.destroy()