GEDCOM import improvements
svn: r1061
This commit is contained in:
parent
99e0fb61d6
commit
cff8bf2e31
@ -243,6 +243,10 @@ class Date:
|
||||
self.range = -1
|
||||
self.text = text
|
||||
|
||||
def set_text(self,text):
|
||||
self.range = -1
|
||||
self.text = text
|
||||
|
||||
def set_range(self,val):
|
||||
self.range = val
|
||||
|
||||
|
@ -220,13 +220,3 @@ class GedInfoParser:
|
||||
elif tag == "residence":
|
||||
if u2l(attrs['val']) == 'place':
|
||||
self.current.set_resi(RESIDENCE_PLAC)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
g = GedcomInfoDB()
|
||||
|
||||
print g.get_name_list()
|
||||
o = g.get_description("Family Tree Maker")
|
||||
for key in o.gramps2tag_map.keys():
|
||||
print key,o.gramps2tag(key)
|
||||
|
@ -47,14 +47,3 @@ class QuestionDialog:
|
||||
self.task2()
|
||||
self.top.destroy()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def task1(obj):
|
||||
print obj,'1'
|
||||
|
||||
def task2(obj):
|
||||
print obj,'2'
|
||||
|
||||
QuestionDialog('mytitle','This is my message','Abc',task1,'Def',task2)
|
||||
|
||||
gtk.mainloop()
|
||||
|
@ -199,18 +199,3 @@ def loadRevision(database, file, filename, revision, callback=None):
|
||||
|
||||
file.close()
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import profile
|
||||
import sys
|
||||
import time
|
||||
|
||||
database = GrampsDB()
|
||||
t1 = time.time()
|
||||
if len(sys.argv) > 2:
|
||||
profile.run('loadData(database, sys.argv[1])')
|
||||
else:
|
||||
loadData(database,sys.argv[1])
|
||||
t2 = time.time()
|
||||
print t2-t1
|
||||
|
@ -36,7 +36,10 @@ else:
|
||||
|
||||
def utf8_to_latin(s):
|
||||
y = UTF8String(s)
|
||||
return y.encode("iso-8859-1")
|
||||
try:
|
||||
return y.encode("iso-8859-1")
|
||||
except:
|
||||
return y.encode("<Invalid UNICODE>")
|
||||
|
||||
def latin_to_utf8(s):
|
||||
buff = cStringIO.StringIO()
|
||||
|
@ -66,11 +66,8 @@ class ChangeTypes:
|
||||
original = self.glade.get_widget("original_text").get_text()
|
||||
new = self.glade.get_widget("new_text").get_text()
|
||||
|
||||
print original
|
||||
print new
|
||||
for person in self.db.getPersonMap().values():
|
||||
for event in person.getEventList():
|
||||
print event.getName()
|
||||
if event.getName() == original:
|
||||
event.setName(new)
|
||||
modified = modified + 1
|
||||
|
@ -917,6 +917,7 @@ class GedcomParser:
|
||||
self.family.addPhoto(photo)
|
||||
|
||||
def parse_residence(self,address,level):
|
||||
note = ""
|
||||
while 1:
|
||||
matches = self.get_next()
|
||||
|
||||
@ -1293,6 +1294,7 @@ class GedcomParser:
|
||||
|
||||
def parse_name(self,name,level):
|
||||
"""Parses the person's name information"""
|
||||
note = ""
|
||||
while 1:
|
||||
matches = self.get_next()
|
||||
if int(matches[0]) < level:
|
||||
@ -1538,38 +1540,40 @@ class GedcomParser:
|
||||
|
||||
def extract_date(self,text):
|
||||
dateobj = Date.Date()
|
||||
match = fromtoRegexp.match(text)
|
||||
if match:
|
||||
(cal1,data1,cal2,data2) = match.groups()
|
||||
if cal1 != cal2:
|
||||
pass
|
||||
|
||||
if cal1 == "FRENCH R":
|
||||
dateobj.set_calendar(Date.FRENCH)
|
||||
elif cal1 == "JULIAN":
|
||||
dateobj.set_calendar(Date.JULIAN)
|
||||
elif cal1 == "HEBREW":
|
||||
dateobj.set_calendar(Date.HEBREW)
|
||||
dateobj.get_start_date().set(data1)
|
||||
dateobj.get_stop_date().set(data2)
|
||||
dateobj.set_range(1)
|
||||
return dateobj
|
||||
try:
|
||||
match = fromtoRegexp.match(text)
|
||||
if match:
|
||||
(cal1,data1,cal2,data2) = match.groups()
|
||||
if cal1 != cal2:
|
||||
pass
|
||||
|
||||
if cal1 == "FRENCH R":
|
||||
dateobj.set_calendar(Date.FRENCH)
|
||||
elif cal1 == "JULIAN":
|
||||
dateobj.set_calendar(Date.JULIAN)
|
||||
elif cal1 == "HEBREW":
|
||||
dateobj.set_calendar(Date.HEBREW)
|
||||
dateobj.get_start_date().set(data1)
|
||||
dateobj.get_stop_date().set(data2)
|
||||
dateobj.set_range(1)
|
||||
return dateobj
|
||||
|
||||
match = calRegexp.match(text)
|
||||
if match:
|
||||
(abt,cal,data) = match.groups()
|
||||
if cal == "FRENCH R":
|
||||
dateobj.set_calendar(Date.FRENCH)
|
||||
elif cal == "JULIAN":
|
||||
dateobj.set_calendar(Date.JULIAN)
|
||||
elif cal == "HEBREW":
|
||||
dateobj.set_calendar(Date.HEBREW)
|
||||
dateobj.set(data)
|
||||
if abt:
|
||||
dateobj.get_start_date().setMode(abt)
|
||||
else:
|
||||
dateobj.set(text)
|
||||
|
||||
match = calRegexp.match(text)
|
||||
if match:
|
||||
(abt,cal,data) = match.groups()
|
||||
if cal == "FRENCH R":
|
||||
dateobj.set_calendar(Date.FRENCH)
|
||||
elif cal == "JULIAN":
|
||||
dateobj.set_calendar(Date.JULIAN)
|
||||
elif cal == "HEBREW":
|
||||
dateobj.set_calendar(Date.HEBREW)
|
||||
dateobj.set(data)
|
||||
if abt:
|
||||
dateobj.get_start_date().setMode(abt)
|
||||
else:
|
||||
dateobj.set(text)
|
||||
except:
|
||||
dateobj.set_text(text)
|
||||
return dateobj
|
||||
|
||||
def handle_source(self,matches,level):
|
||||
|
Loading…
Reference in New Issue
Block a user