Enhanced support for GEDCOM writing.
svn: r591
This commit is contained in:
parent
63848c4c70
commit
492d2cc56a
@ -459,10 +459,8 @@ class SingleDate:
|
|||||||
return "%s%s%s" % (y,m,d)
|
return "%s%s%s" % (y,m,d)
|
||||||
|
|
||||||
def getSaveDate(self):
|
def getSaveDate(self):
|
||||||
retval = ""
|
|
||||||
|
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
pass
|
return ""
|
||||||
elif self.day == UNDEF:
|
elif self.day == UNDEF:
|
||||||
if self.month == UNDEF:
|
if self.month == UNDEF:
|
||||||
retval = str(self.year)
|
retval = str(self.year)
|
||||||
@ -485,11 +483,9 @@ class SingleDate:
|
|||||||
retval = "BEFORE" + " " + retval
|
retval = "BEFORE" + " " + retval
|
||||||
elif self.mode == SingleDate.after:
|
elif self.mode == SingleDate.after:
|
||||||
retval = "AFTER" + " " + retval
|
retval = "AFTER" + " " + retval
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def getFmt1(self):
|
def get_fmt1(self):
|
||||||
|
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
return ""
|
return ""
|
||||||
elif self.day == UNDEF:
|
elif self.day == UNDEF:
|
||||||
@ -514,10 +510,9 @@ class SingleDate:
|
|||||||
retval = _("before") + ' ' + retval
|
retval = _("before") + ' ' + retval
|
||||||
elif self.mode == SingleDate.after:
|
elif self.mode == SingleDate.after:
|
||||||
retval = _("after") + ' ' + retval
|
retval = _("after") + ' ' + retval
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def getFmt2(self):
|
def get_fmt2(self):
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
return ""
|
return ""
|
||||||
elif self.month != UNDEF and self.month != UNDEF:
|
elif self.month != UNDEF and self.month != UNDEF:
|
||||||
@ -547,7 +542,7 @@ class SingleDate:
|
|||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def getFmt3(self):
|
def get_fmt3(self):
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
return ""
|
return ""
|
||||||
elif self.day == UNDEF:
|
elif self.day == UNDEF:
|
||||||
@ -574,10 +569,9 @@ class SingleDate:
|
|||||||
retval = "%s %s" % (_("BEFORE"),retval)
|
retval = "%s %s" % (_("BEFORE"),retval)
|
||||||
elif self.mode == SingleDate.after:
|
elif self.mode == SingleDate.after:
|
||||||
retval = "%s %s" % (_("AFTER"),retval)
|
retval = "%s %s" % (_("AFTER"),retval)
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def getFmt10(self):
|
def get_fmt10(self):
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
return ""
|
return ""
|
||||||
elif self.day == UNDEF:
|
elif self.day == UNDEF:
|
||||||
@ -663,13 +657,13 @@ class SingleDate:
|
|||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def getFmt4(self):
|
def get_fmt4(self):
|
||||||
return self.get_mmddyyyy("/")
|
return self.get_mmddyyyy("/")
|
||||||
|
|
||||||
def getFmt5(self):
|
def get_fmt5(self):
|
||||||
return self.get_mmddyyyy("-")
|
return self.get_mmddyyyy("-")
|
||||||
|
|
||||||
def getFmt8(self):
|
def get_fmt8(self):
|
||||||
return self.get_mmddyyyy(".")
|
return self.get_mmddyyyy(".")
|
||||||
|
|
||||||
def get_ddmmyyyy(self,sep):
|
def get_ddmmyyyy(self,sep):
|
||||||
@ -701,22 +695,22 @@ class SingleDate:
|
|||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def getFmt6(self):
|
def get_fmt6(self):
|
||||||
return self.get_ddmmyyyy("/")
|
return self.get_ddmmyyyy("/")
|
||||||
|
|
||||||
def getFmt7(self):
|
def get_fmt7(self):
|
||||||
return self.get_ddmmyyyy("-")
|
return self.get_ddmmyyyy("-")
|
||||||
|
|
||||||
def getFmt9(self):
|
def get_fmt9(self):
|
||||||
return self.get_ddmmyyyy(".")
|
return self.get_ddmmyyyy(".")
|
||||||
|
|
||||||
def getFmt11(self):
|
def get_fmt11(self):
|
||||||
return self.get_yyyymmdd("/")
|
return self.get_yyyymmdd("/")
|
||||||
|
|
||||||
def getFmt12(self):
|
def get_fmt12(self):
|
||||||
return self.get_yyyymmdd("-")
|
return self.get_yyyymmdd("-")
|
||||||
|
|
||||||
def getFmt13(self):
|
def get_fmt13(self):
|
||||||
return self.get_yyyymmdd(".")
|
return self.get_yyyymmdd(".")
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@ -724,9 +718,9 @@ class SingleDate:
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
fmtFunc = [ getFmt1, getFmt2, getFmt3, getFmt4, getFmt5, getFmt6,
|
fmtFunc = [ get_fmt1, get_fmt2, get_fmt3, get_fmt4, get_fmt5, get_fmt6,
|
||||||
getFmt7, getFmt8, getFmt9, getFmt10, getFmt11, getFmt12,
|
get_fmt7, get_fmt8, get_fmt9, get_fmt10, get_fmt11, get_fmt12,
|
||||||
getFmt13]
|
get_fmt13]
|
||||||
|
|
||||||
def display_calendar(self,month_map):
|
def display_calendar(self,month_map):
|
||||||
if self.year==UNDEF:
|
if self.year==UNDEF:
|
||||||
@ -735,7 +729,7 @@ class SingleDate:
|
|||||||
elif self.day == UNDEF:
|
elif self.day == UNDEF:
|
||||||
return month_map[self.month]
|
return month_map[self.month]
|
||||||
else:
|
else:
|
||||||
return "%02 %s" % (self.day,month_map[self.month])
|
return "%02d %s" % (self.day,month_map[self.month])
|
||||||
elif self.month == UNDEF:
|
elif self.month == UNDEF:
|
||||||
return str(self.year)
|
return str(self.year)
|
||||||
elif self.day == UNDEF:
|
elif self.day == UNDEF:
|
||||||
|
@ -871,7 +871,7 @@ def birth_dates_in_order(list):
|
|||||||
for i in range(len(list)):
|
for i in range(len(list)):
|
||||||
child = list[i]
|
child = list[i]
|
||||||
bday = child.getBirth().getDateObj()
|
bday = child.getBirth().getDateObj()
|
||||||
child_date = sort.build_sort_birth(bday)
|
child_date = sort.build_sort_event(bday)
|
||||||
if (child_date == "99999999"):
|
if (child_date == "99999999"):
|
||||||
continue
|
continue
|
||||||
if (prev_date <= child_date): # <= allows for twins
|
if (prev_date <= child_date): # <= allows for twins
|
||||||
@ -895,13 +895,13 @@ def reorder_child_list(person, list):
|
|||||||
return(list)
|
return(list)
|
||||||
|
|
||||||
# Build the person's date string once
|
# Build the person's date string once
|
||||||
person_bday = sort.build_sort_birth(person.getBirth().getDateObj())
|
person_bday = sort.build_sort_event(person.getBirth().getDateObj())
|
||||||
|
|
||||||
# First, see if the person needs to be moved forward in the list
|
# First, see if the person needs to be moved forward in the list
|
||||||
index = list.index(person)
|
index = list.index(person)
|
||||||
target = index
|
target = index
|
||||||
for i in range(index-1, -1, -1):
|
for i in range(index-1, -1, -1):
|
||||||
other_bday = sort.build_sort_birth(list[i].getBirth().getDateObj())
|
other_bday = sort.build_sort_event(list[i].getBirth().getDateObj())
|
||||||
if (other_bday == "99999999"):
|
if (other_bday == "99999999"):
|
||||||
continue;
|
continue;
|
||||||
if (person_bday < other_bday):
|
if (person_bday < other_bday):
|
||||||
@ -910,7 +910,7 @@ def reorder_child_list(person, list):
|
|||||||
# Now try moving to a later position in the list
|
# Now try moving to a later position in the list
|
||||||
if (target == index):
|
if (target == index):
|
||||||
for i in range(index, len(list)):
|
for i in range(index, len(list)):
|
||||||
other_bday = sort.build_sort_birth(list[i].getBirth().getDateObj())
|
other_bday = sort.build_sort_event(list[i].getBirth().getDateObj())
|
||||||
if (other_bday == "99999999"):
|
if (other_bday == "99999999"):
|
||||||
continue;
|
continue;
|
||||||
if (person_bday > other_bday):
|
if (person_bday > other_bday):
|
||||||
|
@ -434,7 +434,7 @@ class Photo(SourceNote):
|
|||||||
self.attrlist = list
|
self.attrlist = list
|
||||||
|
|
||||||
class ObjectRef:
|
class ObjectRef:
|
||||||
|
"""Object reference class"""
|
||||||
def __init__(self,source=None):
|
def __init__(self,source=None):
|
||||||
self.attrlist = []
|
self.attrlist = []
|
||||||
if source:
|
if source:
|
||||||
|
@ -90,7 +90,7 @@ gtkrcFile = "%s/gtkrc" % rootDir
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
progName = "gramps"
|
progName = "gramps"
|
||||||
version = "0.6.2"
|
version = "0.7.0pre"
|
||||||
copyright = "© 2001 Donald N. Allingham"
|
copyright = "© 2001 Donald N. Allingham"
|
||||||
authors = ["Donald N. Allingham", "David Hampton"]
|
authors = ["Donald N. Allingham", "David Hampton"]
|
||||||
comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program.")
|
comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program.")
|
||||||
|
@ -43,10 +43,8 @@ else:
|
|||||||
for c in s:
|
for c in s:
|
||||||
try:
|
try:
|
||||||
cv = code_to_utf8(1,c)
|
cv = code_to_utf8(1,c)
|
||||||
except Exception,e:
|
except Exception:
|
||||||
from traceback import print_exc
|
cv = '?'
|
||||||
print_exc()
|
|
||||||
cv = ''
|
|
||||||
buff.write(cv)
|
buff.write(cv)
|
||||||
ans = buff.getvalue()
|
ans = buff.getvalue()
|
||||||
buff.close()
|
buff.close()
|
||||||
|
@ -33,9 +33,9 @@ import string
|
|||||||
import const
|
import const
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
from gtk import *
|
import gtk
|
||||||
from gnome.ui import *
|
import gnome.ui
|
||||||
from libglade import *
|
import libglade
|
||||||
import gnome.mime
|
import gnome.mime
|
||||||
|
|
||||||
ANSEL = 1
|
ANSEL = 1
|
||||||
@ -104,14 +104,13 @@ def importData(database, filename):
|
|||||||
global callback
|
global callback
|
||||||
global topDialog
|
global topDialog
|
||||||
global glade_file
|
global glade_file
|
||||||
global statusWindow
|
|
||||||
|
|
||||||
# add some checking here
|
# add some checking here
|
||||||
|
|
||||||
if clear_data == 1:
|
if clear_data == 1:
|
||||||
database.new()
|
database.new()
|
||||||
|
|
||||||
statusTop = GladeXML(glade_file,"status")
|
statusTop = libglade.GladeXML(glade_file,"status")
|
||||||
statusWindow = statusTop.get_widget("status")
|
statusWindow = statusTop.get_widget("status")
|
||||||
statusTop.get_widget("close").set_sensitive(0)
|
statusTop.get_widget("close").set_sensitive(0)
|
||||||
statusTop.signal_autoconnect({
|
statusTop.signal_autoconnect({
|
||||||
@ -122,11 +121,11 @@ def importData(database, filename):
|
|||||||
g = GedcomParser(database,filename,statusTop)
|
g = GedcomParser(database,filename,statusTop)
|
||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
utils.destroy_passed_object(statusWindow)
|
utils.destroy_passed_object(statusWindow)
|
||||||
GnomeErrorDialog(_("%s could not be opened\n") % filename + str(msg))
|
gnome.ui.GnomeErrorDialog(_("%s could not be opened\n") % filename + str(msg))
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
utils.destroy_passed_object(statusWindow)
|
utils.destroy_passed_object(statusWindow)
|
||||||
GnomeErrorDialog(_("%s could not be opened\n") % filename)
|
gnome.ui.GnomeErrorDialog(_("%s could not be opened\n") % filename)
|
||||||
return
|
return
|
||||||
|
|
||||||
g.parse_gedcom_file()
|
g.parse_gedcom_file()
|
||||||
@ -199,8 +198,8 @@ class GedcomParser:
|
|||||||
|
|
||||||
def update(self,field,text):
|
def update(self,field,text):
|
||||||
field.set_text(text)
|
field.set_text(text)
|
||||||
while events_pending():
|
while gtk.events_pending():
|
||||||
mainiteration()
|
gtk.mainiteration()
|
||||||
|
|
||||||
def get_next(self):
|
def get_next(self):
|
||||||
if self.backoff == 0:
|
if self.backoff == 0:
|
||||||
@ -283,18 +282,18 @@ class GedcomParser:
|
|||||||
elif matches[1] == "DATA" or matches[1] == "TEXT":
|
elif matches[1] == "DATA" or matches[1] == "TEXT":
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "TITL":
|
elif matches[1] == "TITL":
|
||||||
title = matches[2] + self.parse_continue_data(2)
|
title = matches[2] + self.parse_continue_data()
|
||||||
title = string.replace(title,'\n',' ')
|
title = string.replace(title,'\n',' ')
|
||||||
self.source.setTitle(title)
|
self.source.setTitle(title)
|
||||||
elif matches[1] == "AUTH":
|
elif matches[1] == "AUTH":
|
||||||
self.source.setAuthor(matches[2] + self.parse_continue_data(2))
|
self.source.setAuthor(matches[2] + self.parse_continue_data())
|
||||||
elif matches[1] == "PUBL":
|
elif matches[1] == "PUBL":
|
||||||
self.source.setPubInfo(matches[2] + self.parse_continue_data(2))
|
self.source.setPubInfo(matches[2] + self.parse_continue_data())
|
||||||
elif matches[1] == "OBJE":
|
elif matches[1] == "OBJE":
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
if matches[2] and matches[2][0] != "@":
|
if matches[2] and matches[2][0] != "@":
|
||||||
note = matches[1] + self.parse_continue_data(1)
|
note = matches[1] + self.parse_continue_data()
|
||||||
self.source.setNote(note)
|
self.source.setNote(note)
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
@ -346,9 +345,9 @@ class GedcomParser:
|
|||||||
self.nmap[matches[1]] = noteobj
|
self.nmap[matches[1]] = noteobj
|
||||||
text = matches[2][4:]
|
text = matches[2][4:]
|
||||||
if text == "":
|
if text == "":
|
||||||
noteobj.set(self.parse_continue_data(1))
|
noteobj.set(self.parse_continue_data())
|
||||||
else:
|
else:
|
||||||
noteobj.set(text + self.parse_continue_data(1))
|
noteobj.set(text + self.parse_continue_data())
|
||||||
self.parse_note_data(1)
|
self.parse_note_data(1)
|
||||||
elif matches[2] == "OBJE":
|
elif matches[2] == "OBJE":
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
@ -417,7 +416,7 @@ class GedcomParser:
|
|||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "ADDR":
|
elif matches[1] == "ADDR":
|
||||||
self.addr = Address()
|
self.addr = Address()
|
||||||
self.addr.setStreet(matches[2] + self.parse_continue_data(2))
|
self.addr.setStreet(matches[2] + self.parse_continue_data())
|
||||||
self.parse_address(self.addr,2)
|
self.parse_address(self.addr,2)
|
||||||
elif matches[1] == "CHIL":
|
elif matches[1] == "CHIL":
|
||||||
mrel,frel = self.parse_ftw_relations(2)
|
mrel,frel = self.parse_ftw_relations(2)
|
||||||
@ -448,7 +447,7 @@ class GedcomParser:
|
|||||||
self.parse_family_object(2)
|
self.parse_family_object(2)
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
if matches[2] and matches[2][0] != "@":
|
if matches[2] and matches[2][0] != "@":
|
||||||
note = matches[1] + self.parse_continue_data(1)
|
note = matches[1] + self.parse_continue_data()
|
||||||
self.family.setNote(note)
|
self.family.setNote(note)
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
@ -514,7 +513,7 @@ class GedcomParser:
|
|||||||
self.parse_person_object(2)
|
self.parse_person_object(2)
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||||
note = matches[2] + self.parse_continue_data(1)
|
note = matches[2] + self.parse_continue_data()
|
||||||
self.person.setNote(note)
|
self.person.setNote(note)
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
@ -558,7 +557,7 @@ class GedcomParser:
|
|||||||
self.parse_residence(addr,2)
|
self.parse_residence(addr,2)
|
||||||
elif matches[1] == "ADDR":
|
elif matches[1] == "ADDR":
|
||||||
addr = Address()
|
addr = Address()
|
||||||
addr.setStreet(matches[2] + self.parse_continue_data(2))
|
addr.setStreet(matches[2] + self.parse_continue_data())
|
||||||
self.parse_address(addr,2)
|
self.parse_address(addr,2)
|
||||||
self.person.addAddress(addr)
|
self.person.addAddress(addr)
|
||||||
elif matches[1] == "BIRT":
|
elif matches[1] == "BIRT":
|
||||||
@ -631,7 +630,7 @@ class GedcomParser:
|
|||||||
return note
|
return note
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data()
|
||||||
self.parse_note_data(level+1)
|
self.parse_note_data(level+1)
|
||||||
else:
|
else:
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
@ -653,7 +652,7 @@ class GedcomParser:
|
|||||||
type = matches[1]
|
type = matches[1]
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data()
|
||||||
self.parse_note_data(level+1)
|
self.parse_note_data(level+1)
|
||||||
else:
|
else:
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
@ -674,7 +673,7 @@ class GedcomParser:
|
|||||||
elif matches[1] == "FILE":
|
elif matches[1] == "FILE":
|
||||||
file = matches[2]
|
file = matches[2]
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data()
|
||||||
elif matches[1][0] == "_":
|
elif matches[1][0] == "_":
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
elif int(matches[0]) < level:
|
elif int(matches[0]) < level:
|
||||||
@ -720,7 +719,7 @@ class GedcomParser:
|
|||||||
elif matches[1] == "FILE":
|
elif matches[1] == "FILE":
|
||||||
file = matches[2]
|
file = matches[2]
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data()
|
||||||
elif int(matches[0]) < level:
|
elif int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
break
|
break
|
||||||
@ -759,7 +758,7 @@ class GedcomParser:
|
|||||||
elif matches[1] == "FILE":
|
elif matches[1] == "FILE":
|
||||||
file = matches[2]
|
file = matches[2]
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data()
|
||||||
elif int(matches[0]) < level:
|
elif int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
break
|
break
|
||||||
@ -792,7 +791,7 @@ class GedcomParser:
|
|||||||
elif matches[1] == "DATE":
|
elif matches[1] == "DATE":
|
||||||
address.setDateObj(self.extract_date(matches[2]))
|
address.setDateObj(self.extract_date(matches[2]))
|
||||||
elif matches[1] == "ADDR":
|
elif matches[1] == "ADDR":
|
||||||
address.setStreet(matches[2] + self.parse_continue_data(2))
|
address.setStreet(matches[2] + self.parse_continue_data())
|
||||||
self.parse_address(address,level+1)
|
self.parse_address(address,level+1)
|
||||||
elif matches[1] in ["AGE","AGNC","CAUS","STAT","TEMP","OBJE","TYPE"]:
|
elif matches[1] in ["AGE","AGNC","CAUS","STAT","TEMP","OBJE","TYPE"]:
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
@ -808,7 +807,7 @@ class GedcomParser:
|
|||||||
pass
|
pass
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||||
note = matches[1] + self.parse_continue_data(1)
|
note = matches[1] + self.parse_continue_data()
|
||||||
address.setNote(note)
|
address.setNote(note)
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
@ -830,7 +829,7 @@ class GedcomParser:
|
|||||||
return
|
return
|
||||||
elif matches[1] in [ "ADDR", "ADR1", "ADR2" ]:
|
elif matches[1] in [ "ADDR", "ADR1", "ADR2" ]:
|
||||||
val = address.getStreet()
|
val = address.getStreet()
|
||||||
data = self.parse_continue_data(level+1)
|
data = self.parse_continue_data()
|
||||||
if first == 0:
|
if first == 0:
|
||||||
val = "%s %s" % (matches[2],data)
|
val = "%s %s" % (matches[2],data)
|
||||||
first = 1
|
first = 1
|
||||||
@ -877,7 +876,7 @@ class GedcomParser:
|
|||||||
s = self.db.findSource(ref,self.smap)
|
s = self.db.findSource(ref,self.smap)
|
||||||
source_ref.setBase(s)
|
source_ref.setBase(s)
|
||||||
s.setTitle('Imported Source #%d' % self.localref)
|
s.setTitle('Imported Source #%d' % self.localref)
|
||||||
s.setNote(matches[2] + self.parse_continue_data(1))
|
s.setNote(matches[2] + self.parse_continue_data())
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||||
@ -900,10 +899,10 @@ class GedcomParser:
|
|||||||
event.setPlace(place)
|
event.setPlace(place)
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
elif matches[1] == "CAUS":
|
elif matches[1] == "CAUS":
|
||||||
info = matches[2] + self.parse_continue_data(level+1)
|
info = matches[2] + self.parse_continue_data()
|
||||||
event.setCause(info)
|
event.setCause(info)
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
info = matches[2] + self.parse_continue_data(level+1)
|
info = matches[2] + self.parse_continue_data()
|
||||||
if note == "":
|
if note == "":
|
||||||
note = info
|
note = info
|
||||||
else:
|
else:
|
||||||
@ -940,7 +939,7 @@ class GedcomParser:
|
|||||||
s = self.db.findSource(ref,self.smap)
|
s = self.db.findSource(ref,self.smap)
|
||||||
source_ref.setBase(s)
|
source_ref.setBase(s)
|
||||||
s.setTitle('Imported Source #%d' % self.localref)
|
s.setTitle('Imported Source #%d' % self.localref)
|
||||||
s.setNote(matches[2] + self.parse_continue_data(1))
|
s.setNote(matches[2] + self.parse_continue_data())
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||||
@ -969,10 +968,10 @@ class GedcomParser:
|
|||||||
event.setPlace(place)
|
event.setPlace(place)
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
elif matches[1] == "CAUS":
|
elif matches[1] == "CAUS":
|
||||||
info = matches[2] + self.parse_continue_data(level+1)
|
info = matches[2] + self.parse_continue_data()
|
||||||
event.setCause(info)
|
event.setCause(info)
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
info = matches[2] + self.parse_continue_data(level+1)
|
info = matches[2] + self.parse_continue_data()
|
||||||
if note == "":
|
if note == "":
|
||||||
note = info
|
note = info
|
||||||
else:
|
else:
|
||||||
@ -1029,7 +1028,7 @@ class GedcomParser:
|
|||||||
s = self.db.findSource(ref,self.smap)
|
s = self.db.findSource(ref,self.smap)
|
||||||
source_ref.setBase(s)
|
source_ref.setBase(s)
|
||||||
s.setTitle('Imported Source #%d' % self.localref)
|
s.setTitle('Imported Source #%d' % self.localref)
|
||||||
s.setNote(matches[2] + self.parse_continue_data(1))
|
s.setNote(matches[2] + self.parse_continue_data())
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||||
@ -1041,7 +1040,7 @@ class GedcomParser:
|
|||||||
attr.setValue(val)
|
attr.setValue(val)
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
info = matches[2] + self.parse_continue_data(level+1)
|
info = matches[2] + self.parse_continue_data()
|
||||||
if note == "":
|
if note == "":
|
||||||
note = info
|
note = info
|
||||||
else:
|
else:
|
||||||
@ -1082,7 +1081,7 @@ class GedcomParser:
|
|||||||
ref = "gsr%d" % self.localref
|
ref = "gsr%d" % self.localref
|
||||||
s = self.db.findSource(ref,self.smap)
|
s = self.db.findSource(ref,self.smap)
|
||||||
source_ref.setBase(s)
|
source_ref.setBase(s)
|
||||||
note = matches[2] + self.parse_continue_data(1)
|
note = matches[2] + self.parse_continue_data()
|
||||||
s.setTitle('Imported Source #%d' % self.localref)
|
s.setTitle('Imported Source #%d' % self.localref)
|
||||||
s.setNote(note)
|
s.setNote(note)
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
@ -1103,7 +1102,7 @@ class GedcomParser:
|
|||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||||
note = matches[1] + self.parse_continue_data(1)
|
note = matches[1] + self.parse_continue_data()
|
||||||
event.setNote(note)
|
event.setNote(note)
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
@ -1125,7 +1124,7 @@ class GedcomParser:
|
|||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] == "PAGE":
|
elif matches[1] == "PAGE":
|
||||||
source.setPage(matches[2] + self.parse_continue_data(level+1))
|
source.setPage(matches[2] + self.parse_continue_data())
|
||||||
elif matches[1] == "DATA":
|
elif matches[1] == "DATA":
|
||||||
date,text = self.parse_source_data(level+1)
|
date,text = self.parse_source_data(level+1)
|
||||||
d = Date.Date()
|
d = Date.Date()
|
||||||
@ -1142,7 +1141,7 @@ class GedcomParser:
|
|||||||
source.setConfidence(val)
|
source.setConfidence(val)
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||||
note = matches[1] + self.parse_continue_data(1)
|
note = matches[1] + self.parse_continue_data()
|
||||||
source.setComments(note)
|
source.setComments(note)
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
@ -1169,7 +1168,7 @@ class GedcomParser:
|
|||||||
date = matches[2]
|
date = matches[2]
|
||||||
|
|
||||||
elif matches[1] == "TEXT":
|
elif matches[1] == "TEXT":
|
||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data()
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
@ -1223,7 +1222,7 @@ class GedcomParser:
|
|||||||
self.parse_source_reference(source_ref,level+1)
|
self.parse_source_reference(source_ref,level+1)
|
||||||
elif matches[1][0:4] == "NOTE":
|
elif matches[1][0:4] == "NOTE":
|
||||||
if matches[2] and matches[2][0] != "@":
|
if matches[2] and matches[2][0] != "@":
|
||||||
note = matches[2] + self.parse_continue_data(1)
|
note = matches[2] + self.parse_continue_data()
|
||||||
name.setNote(note)
|
name.setNote(note)
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
@ -1301,7 +1300,7 @@ class GedcomParser:
|
|||||||
date = self.parse_date(2)
|
date = self.parse_date(2)
|
||||||
date.date = matches[2]
|
date.date = matches[2]
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = matches[2] + self.parse_continue_data(2)
|
note = matches[2] + self.parse_continue_data()
|
||||||
elif matches[1][0] == "_":
|
elif matches[1][0] == "_":
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
@ -1381,7 +1380,7 @@ class GedcomParser:
|
|||||||
elif matches[1] != "FORM":
|
elif matches[1] != "FORM":
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_continue_data(self,level):
|
def parse_continue_data(self):
|
||||||
data = ""
|
data = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
@ -1484,7 +1483,7 @@ def readData(database,active_person,cb):
|
|||||||
"on_ok_clicked" : on_ok_clicked
|
"on_ok_clicked" : on_ok_clicked
|
||||||
}
|
}
|
||||||
|
|
||||||
topDialog = GladeXML(glade_file,"gedcomImport")
|
topDialog = libglade.GladeXML(glade_file,"gedcomImport")
|
||||||
topDialog.signal_autoconnect(dic)
|
topDialog.signal_autoconnect(dic)
|
||||||
topDialog.get_widget("gedcomImport").show()
|
topDialog.get_widget("gedcomImport").show()
|
||||||
|
|
||||||
|
@ -89,5 +89,5 @@ def on_ok_clicked(obj):
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from Plugins import register_import
|
from Plugins import register_import
|
||||||
|
|
||||||
register_import(readData,_("Import from Gramps"))
|
register_import(readData,_("Import from GRAMPS"))
|
||||||
|
|
||||||
|
@ -30,16 +30,59 @@ import intl
|
|||||||
import Date
|
import Date
|
||||||
_ = intl.gettext
|
_ = intl.gettext
|
||||||
|
|
||||||
from gtk import *
|
import gtk
|
||||||
from gnome.ui import *
|
import gnome.ui
|
||||||
from libglade import *
|
import libglade
|
||||||
|
|
||||||
import const
|
|
||||||
from latin_ansel import latin_to_ansel
|
from latin_ansel import latin_to_ansel
|
||||||
from latin_utf8 import latin_to_utf8
|
from latin_utf8 import latin_to_utf8
|
||||||
|
|
||||||
_hmonth = [ "", "ELUL", "TSH", "CSH", "KSL", "TVT", "SHV", "ADR",
|
#-------------------------------------------------------------------------
|
||||||
"ADS", "NSN", "IYR", "SVN", "TMZ", "AAV", "ELL" ]
|
#
|
||||||
|
# GEDCOM feature support
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
_ADOPT_NONE = 0
|
||||||
|
_ADOPT_EVENT = 1
|
||||||
|
_ADOPT_FTW = 2
|
||||||
|
_ADOPT_LEGACY = 3
|
||||||
|
_ADOPT_PEDI = 4
|
||||||
|
_ADOPT_EVENT_EXT = 5
|
||||||
|
|
||||||
|
_CONC_OK = 0
|
||||||
|
_CONC_BROKEN = 1
|
||||||
|
|
||||||
|
_ALT_NONE = 0
|
||||||
|
_ALT_STD = 1
|
||||||
|
_ALT_ALIAS = 2
|
||||||
|
_ALT_AKA = 3
|
||||||
|
_ALT_EVENT_AKA = 4
|
||||||
|
|
||||||
|
_CAL_NO = 0
|
||||||
|
_CAL_YES = 1
|
||||||
|
|
||||||
|
targets = [
|
||||||
|
("Standard GEDCOM 5.5", "GEDCOM 5.5", _ADOPT_EVENT_EXT, _CONC_OK, _ALT_STD, _CAL_YES),
|
||||||
|
("Brother's Keeper", "BROSKEEP", _ADOPT_NONE, _CONC_BROKEN, _ALT_NONE, _CAL_NO),
|
||||||
|
("Family Origins", "FamilyOrigins", _ADOPT_EVENT, _CONC_BROKEN, _ALT_EVENT_AKA, _CAL_NO),
|
||||||
|
("Family Tree Maker", "FTW", _ADOPT_FTW, _CONC_BROKEN, _ALT_ALIAS, _CAL_NO),
|
||||||
|
("Ftree", "", _ADOPT_NONE, _CONC_BROKEN, _ALT_NONE, _CAL_NO),
|
||||||
|
("GeneWeb", "", _ADOPT_NONE, _CONC_OK, _ALT_NONE, _CAL_YES),
|
||||||
|
("Legacy", "Legacy", _ADOPT_LEGACY, _CONC_BROKEN, _ALT_STD, _CAL_NO),
|
||||||
|
("Personal Ancestral File", "PAF", _ADOPT_PEDI, _CONC_OK, _ALT_AKA, _CAL_NO),
|
||||||
|
("Reunion", "REUNION", _ADOPT_NONE, _CONC_BROKEN, _ALT_NONE, _CAL_NO),
|
||||||
|
("Visual Genealogie", "", _ADOPT_NONE, _CONC_BROKEN, _ALT_NONE, _CAL_NO),
|
||||||
|
]
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Calendar month names
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
_hmonth = [
|
||||||
|
"", "ELUL", "TSH", "CSH", "KSL", "TVT", "SHV", "ADR",
|
||||||
|
"ADS", "NSN", "IYR", "SVN", "TMZ", "AAV", "ELL" ]
|
||||||
|
|
||||||
_fmonth = [
|
_fmonth = [
|
||||||
"", "VEND", "BRUM", "FRIM", "NIVO", "PLUV", "VENT",
|
"", "VEND", "BRUM", "FRIM", "NIVO", "PLUV", "VENT",
|
||||||
@ -49,86 +92,93 @@ _month = [
|
|||||||
"", "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
|
"", "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
|
||||||
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ]
|
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ]
|
||||||
|
|
||||||
|
_calmap = {
|
||||||
|
Date.HEBREW : (_hmonth, '@#HEBREW@'),
|
||||||
|
Date.FRENCH : (_fmonth, '@#FRENCH R@'),
|
||||||
|
Date.JULIAN : (_month, '@#JULIAN@'),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Filters
|
# Filters
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def entire_database(database,person):
|
def entire_database(database,person,private):
|
||||||
plist = database.getPersonMap().values()
|
plist = database.getPersonMap().values()
|
||||||
flist = database.getFamilyMap().values()
|
flist = database.getFamilyMap().values()
|
||||||
slist = database.getSourceMap().values()
|
slist = database.getSourceMap().values()
|
||||||
return (plist,flist,slist)
|
return (plist,flist,slist)
|
||||||
|
|
||||||
def active_person_descendants(database,person):
|
def active_person_descendants(database,person,private):
|
||||||
plist = []
|
plist = []
|
||||||
flist = []
|
flist = []
|
||||||
slist = []
|
slist = []
|
||||||
descend(person,plist,flist,slist)
|
descend(person,plist,flist,slist,private)
|
||||||
return (plist,flist,slist)
|
return (plist,flist,slist)
|
||||||
|
|
||||||
def active_person_ancestors_and_descendants(database,person):
|
def active_person_ancestors_and_descendants(database,person,private):
|
||||||
plist = []
|
plist = []
|
||||||
flist = []
|
flist = []
|
||||||
slist = []
|
slist = []
|
||||||
descend(person,plist,flist,slist)
|
descend(person,plist,flist,slist,private)
|
||||||
ancestors(person,plist,flist,slist)
|
ancestors(person,plist,flist,slist,private)
|
||||||
return (plist,flist,slist)
|
return (plist,flist,slist)
|
||||||
|
|
||||||
def active_person_ancestors(database,person):
|
def active_person_ancestors(database,person,private):
|
||||||
plist = []
|
plist = []
|
||||||
flist = []
|
flist = []
|
||||||
slist = []
|
slist = []
|
||||||
ancestors(person,plist,flist,slist)
|
ancestors(person,plist,flist,slist,private)
|
||||||
return (plist,flist,slist)
|
return (plist,flist,slist)
|
||||||
|
|
||||||
def interconnected(database,person):
|
def interconnected(database,person,private):
|
||||||
plist = []
|
plist = []
|
||||||
flist = []
|
flist = []
|
||||||
slist = []
|
slist = []
|
||||||
walk(person,plist,flist,slist)
|
walk(person,plist,flist,slist,private)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def descend(person,plist,flist,slist):
|
def descend(person,plist,flist,slist,private):
|
||||||
if person == None or person in plist:
|
if person == None or person in plist:
|
||||||
return
|
return
|
||||||
plist.append(person)
|
plist.append(person)
|
||||||
add_persons_sources(person)
|
add_persons_sources(person,slist,private)
|
||||||
for family in person.getFamilyList():
|
for family in person.getFamilyList():
|
||||||
add_familys_sources(family,slist)
|
add_familys_sources(family,slist,private)
|
||||||
flist.append(family)
|
flist.append(family)
|
||||||
father = family.getFather()
|
father = family.getFather()
|
||||||
mother = family.getMother()
|
mother = family.getMother()
|
||||||
if father != None and father not in plist:
|
if father != None and father not in plist:
|
||||||
plist.append(father)
|
plist.append(father)
|
||||||
add_persons_sources(father,slist)
|
add_persons_sources(father,slist,private)
|
||||||
if mother != None and mother not in plist:
|
if mother != None and mother not in plist:
|
||||||
plist.append(mother)
|
plist.append(mother)
|
||||||
add_persons_sources(mother,slist)
|
add_persons_sources(mother,slist,private)
|
||||||
for child in family.getChildList():
|
for child in family.getChildList():
|
||||||
descend(child,plist,flist,slist)
|
descend(child,plist,flist,slist,private)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def ancestors(person,plist,flist,slist):
|
def ancestors(person,plist,flist,slist,private):
|
||||||
if person == None or person in plist:
|
if person == None or person in plist:
|
||||||
return
|
return
|
||||||
plist.append(person)
|
plist.append(person)
|
||||||
add_persons_sources(person,slist)
|
add_persons_sources(person,slist,private)
|
||||||
family = person.getMainFamily()
|
family = person.getMainFamily()
|
||||||
if family == None or family in flist:
|
if family == None or family in flist:
|
||||||
return
|
return
|
||||||
add_familys_sources(family,slist)
|
add_familys_sources(family,slist,private)
|
||||||
family_list.append(family,flist)
|
flist.append(family)
|
||||||
ancestors(family.getMother(),plist,flist,slist)
|
ancestors(family.getMother(),plist,flist,slist,private)
|
||||||
ancestors(family.getFather(),plist,flist,slist)
|
ancestors(family.getFather(),plist,flist,slist,private)
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -136,11 +186,11 @@ def ancestors(person,plist,flist,slist):
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def walk(person,plist,flist,slist):
|
def walk(person,plist,flist,slist,private):
|
||||||
if person == None or person in plist:
|
if person == None or person in plist:
|
||||||
return
|
return
|
||||||
plist.append(person)
|
plist.append(person)
|
||||||
add_persons_sources(person,slist)
|
add_persons_sources(person,slist,private)
|
||||||
families = person.getFamilyList()
|
families = person.getFamilyList()
|
||||||
families.append(person.getMainFamily())
|
families.append(person.getMainFamily())
|
||||||
for f in person.getAltFamilyList():
|
for f in person.getAltFamilyList():
|
||||||
@ -148,19 +198,40 @@ def walk(person,plist,flist,slist):
|
|||||||
for family in families:
|
for family in families:
|
||||||
if family == None or family in flist:
|
if family == None or family in flist:
|
||||||
continue
|
continue
|
||||||
add_familys_sources(family,slist)
|
add_familys_sources(family,slist,private)
|
||||||
flist.append(family)
|
flist.append(family)
|
||||||
walk(family.getFather(),plist,flist,slist)
|
walk(family.getFather(),plist,flist,slist,private)
|
||||||
walk(family.getMother(),plist,flist,slist)
|
walk(family.getMother(),plist,flist,slist,private)
|
||||||
for child in family.getChildList():
|
for child in family.getChildList():
|
||||||
walk(child,plist,flist,slist)
|
walk(child,plist,flist,slist,private)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def add_persons_sources(person,slist):
|
def add_familys_sources(family,slist,private):
|
||||||
|
for event in family.getEventList():
|
||||||
|
if private and event.getPrivacy():
|
||||||
|
continue
|
||||||
|
for source_ref in event.getSourceRefList():
|
||||||
|
sbase = source_ref.getBase()
|
||||||
|
if sbase != None and sbase not in slist:
|
||||||
|
slist.append(sbase)
|
||||||
|
for attr in family.getAttributeList():
|
||||||
|
if private and attr.getPrivacy():
|
||||||
|
continue
|
||||||
|
for source_ref in attr.getSourceRefList():
|
||||||
|
sbase = source_ref.getBase()
|
||||||
|
if sbase != None and sbase not in slist:
|
||||||
|
slist.append(sbase)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
def add_persons_sources(person,slist,private):
|
||||||
elist = person.getEventList()[:]
|
elist = person.getEventList()[:]
|
||||||
|
|
||||||
elist.append(person.getBirth())
|
elist.append(person.getBirth())
|
||||||
@ -186,7 +257,7 @@ def add_persons_sources(person,slist):
|
|||||||
sbase = source_ref.getBase()
|
sbase = source_ref.getBase()
|
||||||
if sbase != None and sbase not in slist:
|
if sbase != None and sbase not in slist:
|
||||||
slist.append(sbase)
|
slist.append(sbase)
|
||||||
for name in person.getNameList + [ person.getPrimaryName() ]:
|
for name in person.getNameList + [person.getPrimaryName()]:
|
||||||
if private and name.getPrivacy():
|
if private and name.getPrivacy():
|
||||||
continue
|
continue
|
||||||
for source_ref in name.getSourceRefList():
|
for source_ref in name.getSourceRefList():
|
||||||
@ -194,27 +265,6 @@ def add_persons_sources(person,slist):
|
|||||||
if sbase != None and sbase not in slist:
|
if sbase != None and sbase not in slist:
|
||||||
slist.append(sbase)
|
slist.append(sbase)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
def add_familys_sources(family,slist):
|
|
||||||
for event in family.getEventList():
|
|
||||||
if private and event.getPrivacy():
|
|
||||||
continue
|
|
||||||
for source_ref in event.getSourceRefList():
|
|
||||||
sbase = source_ref.getBase()
|
|
||||||
if sbase != None and sbase not in slist:
|
|
||||||
slist.append(sbase)
|
|
||||||
for attr in family.getAttributeList():
|
|
||||||
if private and attr.getPrivacy():
|
|
||||||
continue
|
|
||||||
for source_ref in attr.getSourceRefList():
|
|
||||||
sbase = source_ref.getBase()
|
|
||||||
if sbase != None and sbase not in slist:
|
|
||||||
slist.append(sbase)
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -306,24 +356,24 @@ def ged_subdate(date):
|
|||||||
if date.month == -1:
|
if date.month == -1:
|
||||||
retval = str(date.year)
|
retval = str(date.year)
|
||||||
elif date.year == -1:
|
elif date.year == -1:
|
||||||
retval = "(%s)" % SingleDate.emname[date.month]
|
retval = "(%s)" % Date.SingleDate.emname[date.month]
|
||||||
else:
|
else:
|
||||||
retval = "%s %d" % (SingleDate.emname[date.month],date.year)
|
retval = "%s %d" % (Date.SingleDate.emname[date.month],date.year)
|
||||||
elif date.month == -1:
|
elif date.month == -1:
|
||||||
retval = str(date.year)
|
retval = str(date.year)
|
||||||
else:
|
else:
|
||||||
month = SingleDate.emname[date.month]
|
month = Date.SingleDate.emname[date.month]
|
||||||
if date.year == -1:
|
if date.year == -1:
|
||||||
retval = "(%d %s)" % (date.day,month)
|
retval = "(%d %s)" % (date.day,month)
|
||||||
else:
|
else:
|
||||||
retval = "%d %s %d" % (date.day,month,date.year)
|
retval = "%d %s %d" % (date.day,month,date.year)
|
||||||
|
|
||||||
if date.mode == SingleDate.about:
|
if date.mode == Date.SingleDate.about:
|
||||||
retval = "ABT %s" % retval
|
retval = "ABT %s" % retval
|
||||||
|
|
||||||
if date.mode == SingleDate.before:
|
if date.mode == Date.SingleDate.before:
|
||||||
retval = "BEF %s" % retval
|
retval = "BEF %s" % retval
|
||||||
elif date.mode == SingleDate.after:
|
elif date.mode == Date.SingleDate.after:
|
||||||
retval = "AFT %s" % retval
|
retval = "AFT %s" % retval
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
@ -342,49 +392,69 @@ def writeData(database,person):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class GedcomWriter:
|
class GedcomWriter:
|
||||||
|
"""Writes a GEDCOM file from the passed database"""
|
||||||
|
|
||||||
def __init__(self,db,person):
|
def __init__(self,db,person):
|
||||||
self.db = db
|
self.db = db
|
||||||
self.person = person
|
self.person = person
|
||||||
self.restrict = 1
|
self.restrict = 1
|
||||||
self.private = 1
|
self.private = 1
|
||||||
self.cnvtxt = latin_to_ansel
|
self.cnvtxt = latin_to_ansel
|
||||||
self.people_list = []
|
self.plist = []
|
||||||
self.source_list = []
|
self.slist = []
|
||||||
self.family_list = []
|
self.flist = []
|
||||||
self.adopt_mode = 0
|
self.adopt = _ADOPT_EVENT
|
||||||
|
self.fidval = 0
|
||||||
|
self.fidmap = {}
|
||||||
|
self.pidval = 0
|
||||||
|
self.pidmap = {}
|
||||||
|
self.sidval = 0
|
||||||
|
self.sidmap = {}
|
||||||
|
|
||||||
glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__)
|
glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__)
|
||||||
|
|
||||||
self.topDialog = GladeXML(glade_file,"gedcomExport")
|
self.topDialog = libglade.GladeXML(glade_file,"gedcomExport")
|
||||||
self.topDialog.signal_autoconnect({
|
self.topDialog.signal_autoconnect({
|
||||||
"destroy_passed_object" : utils.destroy_passed_object,
|
"destroy_passed_object" : utils.destroy_passed_object,
|
||||||
"on_ok_clicked" : self.on_ok_clicked
|
"on_ok_clicked" : self.on_ok_clicked
|
||||||
})
|
})
|
||||||
|
|
||||||
filter_obj = self.topDialog.get_widget("filter")
|
filter_obj = self.topDialog.get_widget("filter")
|
||||||
myMenu = GtkMenu()
|
myMenu = gtk.GtkMenu()
|
||||||
menuitem = GtkMenuItem(_("Entire Database"))
|
menuitem = gtk.GtkMenuItem(_("Entire Database"))
|
||||||
myMenu.append(menuitem)
|
myMenu.append(menuitem)
|
||||||
menuitem.set_data("filter",entire_database)
|
menuitem.set_data("filter",entire_database)
|
||||||
menuitem.show()
|
menuitem.show()
|
||||||
name = person.getPrimaryName().getRegularName()
|
name = person.getPrimaryName().getRegularName()
|
||||||
menuitem = GtkMenuItem(_("Ancestors of %s") % name)
|
menuitem = gtk.GtkMenuItem(_("Ancestors of %s") % name)
|
||||||
myMenu.append(menuitem)
|
myMenu.append(menuitem)
|
||||||
menuitem.set_data("filter",active_person_ancestors)
|
menuitem.set_data("filter",active_person_ancestors)
|
||||||
menuitem.show()
|
menuitem.show()
|
||||||
menuitem = GtkMenuItem(_("Descendants of %s") % name)
|
menuitem = gtk.GtkMenuItem(_("Descendants of %s") % name)
|
||||||
myMenu.append(menuitem)
|
myMenu.append(menuitem)
|
||||||
menuitem.set_data("filter",active_person_descendants)
|
menuitem.set_data("filter",active_person_descendants)
|
||||||
menuitem.show()
|
menuitem.show()
|
||||||
menuitem = GtkMenuItem(_("Ancestors and Descendants of %s") % name)
|
menuitem = gtk.GtkMenuItem(_("Ancestors and Descendants of %s") % name)
|
||||||
myMenu.append(menuitem)
|
myMenu.append(menuitem)
|
||||||
menuitem.set_data("filter",active_person_ancestors_and_descendants)
|
menuitem.set_data("filter",active_person_ancestors_and_descendants)
|
||||||
menuitem.show()
|
menuitem.show()
|
||||||
menuitem = GtkMenuItem(_("People somehow connected to %s") % name)
|
menuitem = gtk.GtkMenuItem(_("People somehow connected to %s") % name)
|
||||||
myMenu.append(menuitem)
|
myMenu.append(menuitem)
|
||||||
menuitem.set_data("filter",interconnected)
|
menuitem.set_data("filter",interconnected)
|
||||||
menuitem.show()
|
menuitem.show()
|
||||||
filter_obj.set_menu(myMenu)
|
filter_obj.set_menu(myMenu)
|
||||||
|
self.filter_menu = myMenu
|
||||||
|
|
||||||
|
target_obj = self.topDialog.get_widget("target")
|
||||||
|
myMenu = gtk.GtkMenu()
|
||||||
|
for (name,dest,adopt,conc,alt,cal) in targets:
|
||||||
|
menuitem = gtk.GtkMenuItem(name)
|
||||||
|
myMenu.append(menuitem)
|
||||||
|
menuitem.set_data("data",(dest,adopt,conc,alt,cal))
|
||||||
|
menuitem.show()
|
||||||
|
|
||||||
|
target_obj.set_menu(myMenu)
|
||||||
|
self.target_menu = myMenu
|
||||||
|
|
||||||
self.topDialog.get_widget("gedcomExport").show()
|
self.topDialog.get_widget("gedcomExport").show()
|
||||||
|
|
||||||
@ -393,8 +463,9 @@ class GedcomWriter:
|
|||||||
self.restrict = self.topDialog.get_widget("restrict").get_active()
|
self.restrict = self.topDialog.get_widget("restrict").get_active()
|
||||||
self.private = self.topDialog.get_widget("private").get_active()
|
self.private = self.topDialog.get_widget("private").get_active()
|
||||||
|
|
||||||
filter_obj = self.topDialog.get_widget("filter").get_menu().get_active()
|
filter = self.filter_menu.get_active().get_data("filter")
|
||||||
filter = filter_obj.get_data("filter")
|
act_tgt = self.target_menu.get_active()
|
||||||
|
(self.dest,self.adopt,self.conc,self.altname,self.cal) = act_tgt.get_data("data")
|
||||||
|
|
||||||
if self.topDialog.get_widget("ansel").get_active():
|
if self.topDialog.get_widget("ansel").get_active():
|
||||||
self.cnvtxt = latin_to_ansel
|
self.cnvtxt = latin_to_ansel
|
||||||
@ -403,13 +474,13 @@ class GedcomWriter:
|
|||||||
|
|
||||||
name = self.topDialog.get_widget("filename").get_text()
|
name = self.topDialog.get_widget("filename").get_text()
|
||||||
|
|
||||||
(self.people_list,self.family_list,self.source_list) = filter(self.db,self.person)
|
(self.plist,self.flist,self.slist) = filter(self.db,self.person,self.private)
|
||||||
|
|
||||||
utils.destroy_passed_object(obj)
|
utils.destroy_passed_object(obj)
|
||||||
|
|
||||||
glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__)
|
glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__)
|
||||||
|
|
||||||
self.exprogress = GladeXML(glade_file,"exportprogress")
|
self.exprogress = libglade.GladeXML(glade_file,"exportprogress")
|
||||||
self.exprogress.signal_autoconnect({
|
self.exprogress.signal_autoconnect({
|
||||||
"on_close_clicked" : utils.destroy_passed_object
|
"on_close_clicked" : utils.destroy_passed_object
|
||||||
})
|
})
|
||||||
@ -433,11 +504,11 @@ class GedcomWriter:
|
|||||||
self.g = open(filename,"w")
|
self.g = open(filename,"w")
|
||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
msg = "%s\n%s" % (_("Could not create %s") % filename,str(msg))
|
msg = "%s\n%s" % (_("Could not create %s") % filename,str(msg))
|
||||||
GnomeErrorDialog(msg)
|
gnome.ui.GnomeErrorDialog(msg)
|
||||||
self.progress.destroy()
|
self.progress.destroy()
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
GnomeErrorDialog(_("Could not create %s") % filename)
|
gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename)
|
||||||
self.progress.destroy()
|
self.progress.destroy()
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -447,7 +518,8 @@ class GedcomWriter:
|
|||||||
self.g.write("1 SOUR GRAMPS\n")
|
self.g.write("1 SOUR GRAMPS\n")
|
||||||
self.g.write("2 VERS " + const.version + "\n")
|
self.g.write("2 VERS " + const.version + "\n")
|
||||||
self.g.write("2 NAME Gramps\n")
|
self.g.write("2 NAME Gramps\n")
|
||||||
self.g.write("1 DEST GRAMPS\n")
|
if self.dest:
|
||||||
|
self.g.write("1 DEST %s\n" % self.dest)
|
||||||
self.g.write("1 DATE %s %s %s\n" % (date[2],string.upper(date[1]),date[4]))
|
self.g.write("1 DATE %s %s %s\n" % (date[2],string.upper(date[1]),date[4]))
|
||||||
if self.cnvtxt == latin_to_ansel:
|
if self.cnvtxt == latin_to_ansel:
|
||||||
self.g.write("1 CHAR ANSEL\n");
|
self.g.write("1 CHAR ANSEL\n");
|
||||||
@ -489,28 +561,28 @@ class GedcomWriter:
|
|||||||
self.g.write('1 ADDR Not Provided\n')
|
self.g.write('1 ADDR Not Provided\n')
|
||||||
self.g.write('2 CONT Not Provided\n')
|
self.g.write('2 CONT Not Provided\n')
|
||||||
|
|
||||||
self.people_list.sort(sortById)
|
self.plist.sort(sortById)
|
||||||
nump = float(len(self.people_list))
|
nump = float(len(self.plist))
|
||||||
index = 0.0
|
index = 0.0
|
||||||
for person in self.people_list:
|
for person in self.plist:
|
||||||
self.write_person(person)
|
self.write_person(person)
|
||||||
index = index + 1
|
index = index + 1
|
||||||
self.pbar.set_value((100*index)/nump)
|
self.pbar.set_value((100*index)/nump)
|
||||||
while(events_pending()):
|
while(gtk.events_pending()):
|
||||||
mainiteration()
|
gtk.mainiteration()
|
||||||
self.pbar.set_value(100.0)
|
self.pbar.set_value(100.0)
|
||||||
|
|
||||||
nump = float(len(self.family_list))
|
nump = float(len(self.flist))
|
||||||
index = 0.0
|
index = 0.0
|
||||||
for family in self.family_list:
|
for family in self.flist:
|
||||||
self.g.write("0 @F%s@ FAM\n" % family.getId())
|
self.g.write("0 @%s@ FAM\n" % self.fid(family.getId()))
|
||||||
person = family.getFather()
|
person = family.getFather()
|
||||||
if person != None:
|
if person != None:
|
||||||
self.g.write("1 HUSB @I%s@\n" % person.getId())
|
self.g.write("1 HUSB @%s@\n" % self.pid(person.getId()))
|
||||||
|
|
||||||
person = family.getMother()
|
person = family.getMother()
|
||||||
if person != None:
|
if person != None:
|
||||||
self.g.write("1 WIFE @I%s@\n" % person.getId())
|
self.g.write("1 WIFE @%s@\n" % self.pid(person.getId()))
|
||||||
|
|
||||||
father = family.getFather()
|
father = family.getFather()
|
||||||
mother = family.getMother()
|
mother = family.getMother()
|
||||||
@ -533,8 +605,8 @@ class GedcomWriter:
|
|||||||
self.dump_event_stats(event)
|
self.dump_event_stats(event)
|
||||||
|
|
||||||
for person in family.getChildList():
|
for person in family.getChildList():
|
||||||
self.g.write("1 CHIL @I%s@\n" % person.getId())
|
self.g.write("1 CHIL @%s@\n" % self.pid(person.getId()))
|
||||||
if self.adopt_mode == 2:
|
if self.adopt == _ADOPT_FTW:
|
||||||
if person.getMainFamily() == family:
|
if person.getMainFamily() == family:
|
||||||
self.g.write('2 _FREL Natural\n')
|
self.g.write('2 _FREL Natural\n')
|
||||||
self.g.write('2 _MREL Natural\n')
|
self.g.write('2 _MREL Natural\n')
|
||||||
@ -544,7 +616,7 @@ class GedcomWriter:
|
|||||||
self.g.write('2 _FREL %s\n' % f[2])
|
self.g.write('2 _FREL %s\n' % f[2])
|
||||||
self.g.write('2 _MREL %s\n' % f[1])
|
self.g.write('2 _MREL %s\n' % f[1])
|
||||||
break
|
break
|
||||||
if self.adopt_mode == 3:
|
if self.adopt == _ADOPT_LEGACY:
|
||||||
for f in person.getAltFamilyList():
|
for f in person.getAltFamilyList():
|
||||||
if f[0] == family:
|
if f[0] == family:
|
||||||
self.g.write('2 _STAT %s\n' % f[2])
|
self.g.write('2 _STAT %s\n' % f[2])
|
||||||
@ -552,14 +624,14 @@ class GedcomWriter:
|
|||||||
|
|
||||||
index = index + 1
|
index = index + 1
|
||||||
self.fbar.set_value((100*index)/nump)
|
self.fbar.set_value((100*index)/nump)
|
||||||
while(events_pending()):
|
while(gtk.events_pending()):
|
||||||
mainiteration()
|
gtk.mainiteration()
|
||||||
self.fbar.set_value(100.0)
|
self.fbar.set_value(100.0)
|
||||||
|
|
||||||
nump = float(len(self.source_list))
|
nump = float(len(self.slist))
|
||||||
index = 0.0
|
index = 0.0
|
||||||
for source in self.source_list:
|
for source in self.slist:
|
||||||
self.g.write("0 @S%s@ SOUR\n" % source.getId())
|
self.g.write("0 @%s@ SOUR\n" % self.sid(source.getId()))
|
||||||
if source.getTitle() != "":
|
if source.getTitle() != "":
|
||||||
self.g.write("1 TITL %s\n" % fmtline(self.cnvtxt(source.getTitle()),248,1))
|
self.g.write("1 TITL %s\n" % fmtline(self.cnvtxt(source.getTitle()),248,1))
|
||||||
if source.getAuthor() != "":
|
if source.getAuthor() != "":
|
||||||
@ -571,22 +643,24 @@ class GedcomWriter:
|
|||||||
if source.getCallNumber() != "":
|
if source.getCallNumber() != "":
|
||||||
self.g.write("1 CALN %s\n" % self.cnvtxt(source.getCallNumber()))
|
self.g.write("1 CALN %s\n" % self.cnvtxt(source.getCallNumber()))
|
||||||
if source.getNote() != "":
|
if source.getNote() != "":
|
||||||
write_long_text(g,"NOTE",1,source.getNote())
|
self.write_long_text("NOTE",1,source.getNote())
|
||||||
index = index + 1
|
index = index + 1
|
||||||
self.sbar.set_value((100*index)/nump)
|
self.sbar.set_value((100*index)/nump)
|
||||||
while(events_pending()):
|
while(gtk.events_pending()):
|
||||||
mainiteration()
|
gtk.mainiteration()
|
||||||
self.sbar.set_value(100.0)
|
self.sbar.set_value(100.0)
|
||||||
|
|
||||||
self.g.write("0 TRLR\n")
|
self.g.write("0 TRLR\n")
|
||||||
self.g.close()
|
self.g.close()
|
||||||
|
|
||||||
def write_person(self,person):
|
def write_person(self,person):
|
||||||
self.g.write("0 @I%s@ INDI\n" % person.getId())
|
self.g.write("0 @%s@ INDI\n" % self.pid(person.getId()))
|
||||||
|
|
||||||
self.write_person_name(person.getPrimaryName(),person.getNickName())
|
self.write_person_name(person.getPrimaryName(),person.getNickName())
|
||||||
# for name in person.getAlternateNames():
|
|
||||||
# self.write_person_name(name,"")
|
if self.altname == _ALT_STD:
|
||||||
|
for name in person.getAlternateNames():
|
||||||
|
self.write_person_name(name,"")
|
||||||
|
|
||||||
if person.getGender() == Person.male:
|
if person.getGender() == Person.male:
|
||||||
self.g.write("1 SEX M\n")
|
self.g.write("1 SEX M\n")
|
||||||
@ -620,7 +694,7 @@ class GedcomWriter:
|
|||||||
val = const.personalConstantEvents[name]
|
val = const.personalConstantEvents[name]
|
||||||
else:
|
else:
|
||||||
val = ""
|
val = ""
|
||||||
if self.adopt_mode == 1 and val == "ADOP":
|
if self.adopt == _ADOPT_EVENT and val == "ADOP":
|
||||||
ad = 1
|
ad = 1
|
||||||
self.g.write('1 ADOP\n')
|
self.g.write('1 ADOP\n')
|
||||||
fam = None
|
fam = None
|
||||||
@ -631,7 +705,7 @@ class GedcomWriter:
|
|||||||
fam = f[0]
|
fam = f[0]
|
||||||
break
|
break
|
||||||
if fam:
|
if fam:
|
||||||
self.g.write('2 FAMC @F%s@\n' % fam.getId())
|
self.g.write('2 FAMC @%s@\n' % self.fid(fam.getId()))
|
||||||
if mrel == frel:
|
if mrel == frel:
|
||||||
self.g.write('3 ADOP BOTH\n')
|
self.g.write('3 ADOP BOTH\n')
|
||||||
elif mrel == "adopted":
|
elif mrel == "adopted":
|
||||||
@ -647,7 +721,7 @@ class GedcomWriter:
|
|||||||
|
|
||||||
self.dump_event_stats(event)
|
self.dump_event_stats(event)
|
||||||
|
|
||||||
if self.adopt_mode == 1 and ad == 0 and len(person.getAltFamilyList()) != 0:
|
if self.adopt == _ADOPT_EVENT and ad == 0 and len(person.getAltFamilyList()) != 0:
|
||||||
self.g.write('1 ADOP\n')
|
self.g.write('1 ADOP\n')
|
||||||
fam = None
|
fam = None
|
||||||
for f in person.getAltFamilyList():
|
for f in person.getAltFamilyList():
|
||||||
@ -657,7 +731,7 @@ class GedcomWriter:
|
|||||||
fam = f[0]
|
fam = f[0]
|
||||||
break
|
break
|
||||||
if fam:
|
if fam:
|
||||||
self.g.write('2 FAMC @F%s@\n' % fam.getId())
|
self.g.write('2 FAMC @%s@\n' % self.fid(fam.getId()))
|
||||||
if mrel == frel:
|
if mrel == frel:
|
||||||
self.g.write('3 ADOP BOTH\n')
|
self.g.write('3 ADOP BOTH\n')
|
||||||
elif mrel == "adopted":
|
elif mrel == "adopted":
|
||||||
@ -706,18 +780,18 @@ class GedcomWriter:
|
|||||||
self.write_source_ref(3,srcref)
|
self.write_source_ref(3,srcref)
|
||||||
|
|
||||||
family = person.getMainFamily()
|
family = person.getMainFamily()
|
||||||
if family != None and family in self.family_list:
|
if family != None and family in self.flist:
|
||||||
self.g.write("1 FAMC @F%s@\n" % family.getId())
|
self.g.write("1 FAMC @%s@\n" % self.fid(family.getId()))
|
||||||
|
|
||||||
for family in person.getAltFamilyList():
|
for family in person.getAltFamilyList():
|
||||||
self.g.write("1 FAMC @F%s@\n" % family[0].getId())
|
self.g.write("1 FAMC @%s@\n" % self.fid(family[0].getId()))
|
||||||
if self.adopt_mode == 0:
|
if self.adopt == _ADOPT_PEDI:
|
||||||
if string.lower(family[1]) == "adopted":
|
if string.lower(family[1]) == "adopted":
|
||||||
self.g.write("2 PEDI Adopted\n")
|
self.g.write("2 PEDI Adopted\n")
|
||||||
|
|
||||||
for family in person.getFamilyList():
|
for family in person.getFamilyList():
|
||||||
if family != None and family in self.family_list:
|
if family != None and family in self.flist:
|
||||||
self.g.write("1 FAMS @F%s@\n" % family.getId())
|
self.g.write("1 FAMS @%s@\n" % self.fid(family.getId()))
|
||||||
|
|
||||||
for url in person.getUrlList():
|
for url in person.getUrlList():
|
||||||
self.g.write('1 OBJE\n')
|
self.g.write('1 OBJE\n')
|
||||||
@ -731,17 +805,24 @@ class GedcomWriter:
|
|||||||
self.write_long_text("NOTE",1,person.getNote())
|
self.write_long_text("NOTE",1,person.getNote())
|
||||||
|
|
||||||
def write_long_text(self,tag,level,note):
|
def write_long_text(self,tag,level,note):
|
||||||
|
if self.conc == _CONC_OK:
|
||||||
|
self.write_conc_ok(tag,level,note)
|
||||||
|
else:
|
||||||
|
self.write_conc_broken(tag,level,note)
|
||||||
|
|
||||||
|
def write_conc_ok(self,tag,level,note):
|
||||||
prefix = "%d %s" % (level,tag)
|
prefix = "%d %s" % (level,tag)
|
||||||
textlines = string.split(note,'\n')
|
textlines = string.split(note,'\n')
|
||||||
if len(note) == 0:
|
if len(note) == 0:
|
||||||
g.write("%s\n" % prefix)
|
self.g.write("%s\n" % prefix)
|
||||||
else:
|
else:
|
||||||
for line in textlines:
|
for line in textlines:
|
||||||
ll = len(line)
|
ll = len(line)
|
||||||
while ll > 0:
|
while ll > 0:
|
||||||
brkpt = 70
|
brkpt = 70
|
||||||
if ll > brkpt:
|
if ll > brkpt:
|
||||||
while (ll > brkpt and line[brkpt] in string.whitespace):
|
while (ll > brkpt and \
|
||||||
|
(line[brkpt] in string.whitespace or line[brkpt+1] in string.whitespace)):
|
||||||
brkpt = brkpt+1
|
brkpt = brkpt+1
|
||||||
if ll == brkpt:
|
if ll == brkpt:
|
||||||
self.g.write("%s %s\n" % (prefix,line))
|
self.g.write("%s %s\n" % (prefix,line))
|
||||||
@ -753,9 +834,37 @@ class GedcomWriter:
|
|||||||
self.g.write("%s %s\n" % (prefix,line))
|
self.g.write("%s %s\n" % (prefix,line))
|
||||||
line = ""
|
line = ""
|
||||||
if len(line) > 0:
|
if len(line) > 0:
|
||||||
prefix = "%d CONC" % (level + 1)
|
prefix = "%d CONC" % (level+1)
|
||||||
else:
|
else:
|
||||||
prefix = "%d CONT" % (level + 1)
|
prefix = "%d CONT" % (level+1)
|
||||||
|
ll = len(line)
|
||||||
|
|
||||||
|
def write_conc_broken(self,tag,level,note):
|
||||||
|
prefix = "%d %s" % (level,tag)
|
||||||
|
textlines = string.split(note,'\n')
|
||||||
|
if len(note) == 0:
|
||||||
|
self.g.write("%s\n" % prefix)
|
||||||
|
else:
|
||||||
|
for line in textlines:
|
||||||
|
ll = len(line)
|
||||||
|
while ll > 0:
|
||||||
|
brkpt = 70
|
||||||
|
if ll > brkpt:
|
||||||
|
while (ll > brkpt and line[brkpt] not in string.whitespace):
|
||||||
|
brkpt = brkpt+1
|
||||||
|
if ll == brkpt:
|
||||||
|
self.g.write("%s %s\n" % (prefix,line))
|
||||||
|
line = ''
|
||||||
|
else:
|
||||||
|
self.g.write("%s %s\n" % (prefix,line[0:brkpt+1]))
|
||||||
|
line = line[brkpt+1:]
|
||||||
|
else:
|
||||||
|
self.g.write("%s %s\n" % (prefix,line))
|
||||||
|
line = ""
|
||||||
|
if len(line) > 0:
|
||||||
|
prefix = "%d CONC" % (level+1)
|
||||||
|
else:
|
||||||
|
prefix = "%d CONT" % (level+1)
|
||||||
ll = len(line)
|
ll = len(line)
|
||||||
|
|
||||||
def dump_event_stats(self,event):
|
def dump_event_stats(self,event):
|
||||||
@ -777,34 +886,33 @@ class GedcomWriter:
|
|||||||
start = date.get_start_date()
|
start = date.get_start_date()
|
||||||
|
|
||||||
if date.get_calendar() == Date.GREGORIAN:
|
if date.get_calendar() == Date.GREGORIAN:
|
||||||
cal = ''
|
|
||||||
if date.isRange():
|
if date.isRange():
|
||||||
val = "FROM %s TO %s" % (make_date(start,_month),
|
val = "FROM %s TO %s" % (make_date(start,_month),
|
||||||
make_date(date.get_stop_date(),_month))
|
make_date(date.get_stop_date(),_month))
|
||||||
else:
|
else:
|
||||||
val = make_date(start,_month)
|
val = make_date(start,_month)
|
||||||
elif date.get_calendar() == Date.HEBREW:
|
self.g.write("%s %s\n" % (prefix,val))
|
||||||
cal = '@#HEBREW@ '
|
|
||||||
if date.isRange():
|
|
||||||
val = "FROM %s TO %s" % (make_date(start,_hmonth),
|
|
||||||
make_date(date.get_stop_date(),_hmonth))
|
|
||||||
else:
|
|
||||||
val = make_date(start,_hmonth)
|
|
||||||
elif date.get_calendar() == Date.FRENCH:
|
|
||||||
cal = '@#FRENCH R@ '
|
|
||||||
if date.isRange():
|
|
||||||
val = "FROM %s TO %s" % (make_date(start,_fmonth),
|
|
||||||
make_date(date.get_stop_date(),_fmonth))
|
|
||||||
else:
|
|
||||||
val = make_date(start,_fmonth)
|
|
||||||
else:
|
else:
|
||||||
cal = '@#JULIAN@ '
|
if self.cal == _CAL_YES:
|
||||||
if date.isRange():
|
(mlist,cal) = _calmap[date.get_calendar()]
|
||||||
val = "FROM %s TO %s" % (make_date(start,_month),
|
if date.isRange():
|
||||||
make_date(date.get_stop_date(),_month))
|
stop = date.get_stop_date()
|
||||||
|
val = "FROM %s TO %s" % (make_date(start,mlist),
|
||||||
|
make_date(stop,mlist))
|
||||||
|
else:
|
||||||
|
val = make_date(start,_hmonth)
|
||||||
|
self.g.write("%s %s %s\n" % (prefix,cal,val))
|
||||||
else:
|
else:
|
||||||
val = make_date(start,_month)
|
mydate = Date.Date(date)
|
||||||
self.g.write("%s %s%s\n" % (prefix,cal,val))
|
mydate.set_calendar(Date.GREGORIAN)
|
||||||
|
start = mydate.get_start_date()
|
||||||
|
if mydate.isRange():
|
||||||
|
stop = mydate.get_stop_date()
|
||||||
|
val = "FROM %s TO %s" % (make_date(start,_month),
|
||||||
|
make_date(stop,_month))
|
||||||
|
else:
|
||||||
|
val = make_date(start,_month)
|
||||||
|
self.g.write("%s %s\n" % (prefix,val))
|
||||||
|
|
||||||
def write_person_name(self,name,nick):
|
def write_person_name(self,name,nick):
|
||||||
firstName = self.cnvtxt(name.getFirstName())
|
firstName = self.cnvtxt(name.getFirstName())
|
||||||
@ -834,7 +942,7 @@ class GedcomWriter:
|
|||||||
def write_source_ref(self,level,ref):
|
def write_source_ref(self,level,ref):
|
||||||
if ref.getBase() == None:
|
if ref.getBase() == None:
|
||||||
return
|
return
|
||||||
self.g.write("%d SOUR @S%s@\n" % (level,ref.getBase().getId()))
|
self.g.write("%d SOUR @%s@\n" % (level,self.sid(ref.getBase().getId())))
|
||||||
if ref.getPage() != "":
|
if ref.getPage() != "":
|
||||||
self.g.write("%d PAGE %s\n" % (level+1,ref.getPage()))
|
self.g.write("%d PAGE %s\n" % (level+1,ref.getPage()))
|
||||||
|
|
||||||
@ -849,10 +957,8 @@ class GedcomWriter:
|
|||||||
self.write_long_text("NOTE",level+1,ref.getComments())
|
self.write_long_text("NOTE",level+1,ref.getComments())
|
||||||
|
|
||||||
def probably_alive(self,person):
|
def probably_alive(self,person):
|
||||||
|
|
||||||
if person == None:
|
if person == None:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if self.restrict == 0:
|
if self.restrict == 0:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@ -869,6 +975,32 @@ class GedcomWriter:
|
|||||||
return 0
|
return 0
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
def fid(self,id):
|
||||||
|
if self.fidmap.has_key(id):
|
||||||
|
return self.fidmap[id]
|
||||||
|
else:
|
||||||
|
val = "F%05d" % self.fidval
|
||||||
|
self.fidval = self.fidval + 1
|
||||||
|
self.fidmap[id] = val
|
||||||
|
return val
|
||||||
|
|
||||||
|
def pid(self,id):
|
||||||
|
if self.pidmap.has_key(id):
|
||||||
|
return self.pidmap[id]
|
||||||
|
else:
|
||||||
|
val = "I%05d" % self.pidval
|
||||||
|
self.pidval = self.pidval + 1
|
||||||
|
self.pidmap[id] = val
|
||||||
|
return val
|
||||||
|
|
||||||
|
def sid(self,id):
|
||||||
|
if self.sidmap.has_key(id):
|
||||||
|
return self.sidmap[id]
|
||||||
|
else:
|
||||||
|
val = "S%05d" % self.sidval
|
||||||
|
self.sidval = self.sidval + 1
|
||||||
|
self.sidmap[id] = val
|
||||||
|
return val
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<position>GTK_WIN_POS_CENTER</position>
|
<position>GTK_WIN_POS_CENTER</position>
|
||||||
<modal>True</modal>
|
<modal>True</modal>
|
||||||
<allow_shrink>False</allow_shrink>
|
<allow_shrink>False</allow_shrink>
|
||||||
<allow_grow>False</allow_grow>
|
<allow_grow>True</allow_grow>
|
||||||
<auto_shrink>False</auto_shrink>
|
<auto_shrink>False</auto_shrink>
|
||||||
<auto_close>False</auto_close>
|
<auto_close>False</auto_close>
|
||||||
<hide_on_close>False</hide_on_close>
|
<hide_on_close>False</hide_on_close>
|
||||||
@ -244,6 +244,49 @@
|
|||||||
<homogeneous>False</homogeneous>
|
<homogeneous>False</homogeneous>
|
||||||
<spacing>0</spacing>
|
<spacing>0</spacing>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkHBox</class>
|
||||||
|
<name>hbox1</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>0</spacing>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<name>label5</name>
|
||||||
|
<label>Target</label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>0.5</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xpad>5</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkOptionMenu</class>
|
||||||
|
<name>target</name>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<items>Standard GEDCOM 5.5
|
||||||
|
</items>
|
||||||
|
<initial_choice>0</initial_choice>
|
||||||
|
<child>
|
||||||
|
<padding>5</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkCheckButton</class>
|
<class>GtkCheckButton</class>
|
||||||
<name>private</name>
|
<name>private</name>
|
||||||
|
Loading…
Reference in New Issue
Block a user