Allow for ID values to be strings
svn: r243
This commit is contained in:
parent
1b6ce13527
commit
00f2c326c5
@ -183,7 +183,7 @@ class EditPerson:
|
||||
birth = person.getBirth()
|
||||
death = person.getDeath()
|
||||
|
||||
self.get_widget("gid").set_text(str(person.getId()))
|
||||
self.get_widget("gid").set_text(person.getId())
|
||||
self.event_list.set_column_visibility(3,Config.show_detail)
|
||||
self.name_list.set_column_visibility(1,Config.show_detail)
|
||||
self.attr_list.set_column_visibility(2,Config.show_detail)
|
||||
@ -228,7 +228,7 @@ class EditPerson:
|
||||
photo_list = person.getPhotoList()
|
||||
if len(photo_list) != 0:
|
||||
thumb = self.db.getSavePath() + os.sep + ".thumb" + \
|
||||
os.sep + "i%d.jpg" % self.person.getId()
|
||||
os.sep + "i%s.jpg" % self.person.getId()
|
||||
RelImage.check_thumb(photo_list[0].getPath(),thumb,const.picWidth)
|
||||
self.load_photo(thumb)
|
||||
|
||||
@ -934,7 +934,7 @@ def on_primary_photo_clicked(obj):
|
||||
edit_person_obj.load_images()
|
||||
|
||||
thumb = edit_person_obj.db.getSavePath() + os.sep + ".thumb" + os.sep + \
|
||||
"i%d" % edit_person_obj.person.getId()
|
||||
"i%s" % edit_person_obj.person.getId()
|
||||
|
||||
RelImage.mk_thumb(savePhoto,thumb,const.picWidth)
|
||||
edit_person_obj.load_photo(thumb)
|
||||
@ -1123,7 +1123,7 @@ def on_savephoto_clicked(obj):
|
||||
if os.path.exists(filename) == 0:
|
||||
return
|
||||
|
||||
prefix = "i" + str(edit_person_obj.person.getId())
|
||||
prefix = "i%s" % edit_person_obj.person.getId()
|
||||
if edit_person_obj.external.get_active() == 1:
|
||||
if os.path.isfile(filename):
|
||||
name = filename
|
||||
@ -1342,7 +1342,7 @@ def on_convert_to_private(obj):
|
||||
edit_person_obj = obj.get_data("m")
|
||||
photo = edit_person_obj.person.getPhotoList()[edit_person_obj.selectedIcon]
|
||||
|
||||
prefix = "i" + str(edit_person_obj.person.getId())
|
||||
prefix = "i%s" % edit_person_obj.person.getId()
|
||||
name = RelImage.import_photo(photo.getPath(),edit_person_obj.path,prefix)
|
||||
|
||||
photo.setPath(name)
|
||||
|
@ -101,7 +101,7 @@ class EditSource:
|
||||
self.top = self.top_window.get_widget("sourceEditor")
|
||||
self.top.set_data(SOURCE,self)
|
||||
|
||||
if self.source.getId() == -1:
|
||||
if self.source.getId() == "":
|
||||
self.top_window.get_widget("add_photo").set_sensitive(0)
|
||||
self.top_window.get_widget("delete_photo").set_sensitive(0)
|
||||
|
||||
@ -242,7 +242,7 @@ def on_savephoto_clicked(obj):
|
||||
if os.path.exists(filename) == 0:
|
||||
return
|
||||
|
||||
prefix = "s" + str(edit_source_obj.source.getId())
|
||||
prefix = "s%s" % edit_source_obj.source.getId()
|
||||
if edit_source_obj.external.get_active() == 1:
|
||||
if os.path.isfile(filename):
|
||||
name = filename
|
||||
@ -313,7 +313,7 @@ def on_convert_to_private(obj):
|
||||
edit_source_obj = obj.get_data("m")
|
||||
photo = edit_source_obj.source.getPhotoList()[edit_source_obj.selectedIcon]
|
||||
|
||||
prefix = "i" + str(edit_source_obj.source.getId())
|
||||
prefix = "i%s" % edit_source_obj.source.getId()
|
||||
name = RelImage.import_photo(photo.getPath(),edit_source_obj.path,prefix)
|
||||
|
||||
photo.setPath(name)
|
||||
|
@ -554,7 +554,7 @@ def on_savephoto_clicked(obj):
|
||||
if os.path.exists(filename) == 0:
|
||||
return
|
||||
|
||||
prefix = "f" + str(marriage_obj.family.getId())
|
||||
prefix = "f%s" % marriage_obj.family.getId()
|
||||
name = RelImage.import_photo(filename,marriage_obj.path,prefix)
|
||||
if name == None:
|
||||
return
|
||||
|
@ -297,7 +297,7 @@ class Person:
|
||||
female = 0
|
||||
|
||||
def __init__(self):
|
||||
self.id = -1
|
||||
self.id = ""
|
||||
self.PrimaryName = None
|
||||
self.EventList = []
|
||||
self.FamilyList = []
|
||||
@ -342,7 +342,7 @@ class Person:
|
||||
self.urls.append(url)
|
||||
|
||||
def setId(self,id) :
|
||||
self.id = id
|
||||
self.id = str(id)
|
||||
|
||||
def getId(self) :
|
||||
return self.id
|
||||
@ -581,7 +581,7 @@ class Family:
|
||||
self.Divorce = None
|
||||
self.type = ""
|
||||
self.EventList = []
|
||||
self.id = -1
|
||||
self.id = ""
|
||||
self.photoList = []
|
||||
self.note = Note()
|
||||
self.attributeList = []
|
||||
@ -613,7 +613,7 @@ class Family:
|
||||
self.note = obj
|
||||
|
||||
def setId(self,id) :
|
||||
self.id = id
|
||||
self.id = str(id)
|
||||
|
||||
def getId(self) :
|
||||
return self.id
|
||||
@ -688,10 +688,10 @@ class Source:
|
||||
self.callno = ""
|
||||
self.note = Note()
|
||||
self.photoList = []
|
||||
self.id = -1
|
||||
self.id = ""
|
||||
|
||||
def setId(self,newId):
|
||||
self.id = newId
|
||||
self.id = str(newId)
|
||||
|
||||
def getId(self):
|
||||
return self.id
|
||||
|
@ -114,9 +114,9 @@ def dump_source_ref(g,source_ref):
|
||||
t = source_ref.getText()
|
||||
d = source_ref.getDate().getSaveDate()
|
||||
if p == "" and c == "" and t == "" and d == "":
|
||||
g.write("<sourceref ref=\"%d\"/>\n" % source.getId())
|
||||
g.write("<sourceref ref=\"%s\"/>\n" % source.getId())
|
||||
else:
|
||||
g.write("<sourceref ref=\"%d\">\n" % source.getId())
|
||||
g.write("<sourceref ref=\"%s\">\n" % source.getId())
|
||||
write_line(g,"spage",p)
|
||||
writeNote(g,"scomments",c)
|
||||
writeNote(g,"stext",t)
|
||||
@ -130,7 +130,7 @@ def dump_source_ref(g,source_ref):
|
||||
#-------------------------------------------------------------------------
|
||||
def write_ref(g,label,person):
|
||||
if person:
|
||||
g.write('<%s ref="%s"/>\n' % (label,str(person.getId())))
|
||||
g.write('<%s ref="%s"/>\n' % (label,person.getId()))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -139,7 +139,7 @@ def write_ref(g,label,person):
|
||||
#-------------------------------------------------------------------------
|
||||
def write_id(g,label,person):
|
||||
if person:
|
||||
g.write('<%s id="%s">\n' % (label,str(person.getId())))
|
||||
g.write('<%s id="%s">\n' % (label,person.getId()))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -150,9 +150,9 @@ def write_family_id(g,family):
|
||||
if family:
|
||||
rel = family.getRelationship()
|
||||
if rel != "":
|
||||
g.write('<family id="%s" type="%s">\n' % (str(family.getId()),rel))
|
||||
g.write('<family id="%s" type="%s">\n' % (family.getId(),rel))
|
||||
else:
|
||||
g.write('<family id="%s">\n' % str(family.getId()))
|
||||
g.write('<family id="%s">\n' % family.getId())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -229,7 +229,7 @@ def exportData(database, filename, callback):
|
||||
g.write("<people")
|
||||
person = database.getDefaultPerson()
|
||||
if person:
|
||||
g.write(" default=\"" + str(person.getId()) + "\"")
|
||||
g.write(" default=\"" + person.getId() + "\"")
|
||||
g.write(">\n")
|
||||
|
||||
total = len(personList) + len(familyList)
|
||||
@ -308,7 +308,7 @@ def exportData(database, filename, callback):
|
||||
write_ref(g,"childof",person.getMainFamily())
|
||||
for alt in person.getAltFamilyList():
|
||||
g.write("<childof ref=\"%s\" mrel=\"%s\" frel=\"%s\"/>\n" % \
|
||||
(str(alt[0].getId()), alt[1], alt[2]))
|
||||
(alt[0].getId(), alt[1], alt[2]))
|
||||
|
||||
for family in person.getFamilyList():
|
||||
write_ref(g,"parentin",family)
|
||||
@ -362,7 +362,7 @@ def exportData(database, filename, callback):
|
||||
if len(sourceList) > 0:
|
||||
g.write("<sources>\n")
|
||||
for source in sourceList:
|
||||
g.write("<source id=\"" + str(source.getId()) + "\">\n")
|
||||
g.write("<source id=\"" + source.getId() + "\">\n")
|
||||
write_line(g,"stitle",source.getTitle())
|
||||
write_line(g,"sauthor",source.getAuthor())
|
||||
write_line(g,"spubinfo",source.getPubInfo())
|
||||
@ -381,7 +381,7 @@ def exportData(database, filename, callback):
|
||||
if len(db.getBookmarks()) > 0:
|
||||
g.write("<bookmarks>\n")
|
||||
for person in db.getBookmarks():
|
||||
g.write("<bookmark ref=\"" + str(person.getId()) + "\"/>\n")
|
||||
g.write("<bookmark ref=\"" + person.getId() + "\"/>\n")
|
||||
g.write("</bookmarks>\n")
|
||||
|
||||
g.write("</database>\n")
|
||||
|
@ -273,7 +273,7 @@ def redraw_child_list(filter):
|
||||
if filter and person.getMainFamily() != None:
|
||||
continue
|
||||
addChildList.append([utils.phonebook_name(person),birthday(person),\
|
||||
str(person.getId())])
|
||||
person.getId()])
|
||||
addChildList.set_row_data(index,person)
|
||||
index = index + 1
|
||||
|
||||
@ -1258,7 +1258,7 @@ def modify_statusbar():
|
||||
else:
|
||||
pname = Config.nameof(active_person)
|
||||
if Config.status_bar == 1:
|
||||
name = "[%s] %s" % (str(active_person.getId()),pname)
|
||||
name = "[%s] %s" % (active_person.getId(),pname)
|
||||
elif Config.status_bar == 2:
|
||||
name = pname
|
||||
for attr in active_person.getAttributeList():
|
||||
@ -1859,7 +1859,7 @@ def display_marriage(family):
|
||||
if len(child.getPhotoList()) > 0:
|
||||
attr = attr + "P"
|
||||
|
||||
clist.append([Config.nameof(child),str(child.getId()),\
|
||||
clist.append([Config.nameof(child),child.getId(),\
|
||||
gender,birthday(child),status,attr])
|
||||
clist.set_row_data(i,child)
|
||||
i=i+1
|
||||
@ -2011,7 +2011,7 @@ def apply_filter():
|
||||
gender = const.female
|
||||
bday = person.getBirth().getQuoteDate()
|
||||
dday = person.getDeath().getQuoteDate()
|
||||
clistadd([gname(name,alt),str(person.getId()), gender,bday, dday],\
|
||||
clistadd([gname(name,alt),person.getId(), gender,bday, dday],\
|
||||
person)
|
||||
i = i + 1
|
||||
|
||||
|
@ -213,12 +213,10 @@ def dump_person(person_list,file):
|
||||
continue
|
||||
father = family.getFather()
|
||||
if father and father in person_list:
|
||||
file.write('p' + str(person.getId()) + ' -> p')
|
||||
file.write(str(father.getId()) + ';\n')
|
||||
file.write('p%s -> p%s;\n' % (person.getId(), father.getId()))
|
||||
mother = family.getMother()
|
||||
if mother and mother in person_list:
|
||||
file.write('p' + str(person.getId()) + ' -> p')
|
||||
file.write(str(mother.getId()) + ';\n')
|
||||
file.write('p%s -> p%s;\n' % (person.getId(), mother.getId()))
|
||||
|
||||
#########################################################################
|
||||
#
|
||||
@ -231,9 +229,8 @@ def dump_index(person_list,file):
|
||||
for person in person_list:
|
||||
name = person.getPrimaryName().getName()
|
||||
id = person.getId()
|
||||
# file.write('p' + str(id) + ' [shape=box, fontsize=11, ')
|
||||
file.write('p' + str(id) + ' [shape=box, ')
|
||||
file.write('fontname="Arial", label="' + name + '"];\n')
|
||||
file.write('p%s [shape=box, ' % id)
|
||||
file.write('fontname="Arial", label="%s"];\n' % name)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -369,7 +369,7 @@ def name_or_link(individual, prefix):
|
||||
name = individual.getPrimaryName().getRegularName()
|
||||
if individual in ind_list:
|
||||
id = individual.getId()
|
||||
return "<A HREF=\"" + prefix + str(id) + ".html\">" + name + "</A>"
|
||||
return "<A HREF=\"" + prefix + id + ".html\">" + name + "</A>"
|
||||
else:
|
||||
return name
|
||||
|
||||
@ -392,7 +392,7 @@ def write_reference(html, parent, prefix):
|
||||
|
||||
def dump_person(person,prefix,templateTop,templateBottom,targetDir):
|
||||
|
||||
filebase = "%s%d.html" % (prefix,person.getId())
|
||||
filebase = "%s%s.html" % (prefix,person.getId())
|
||||
html = open(targetDir + os.sep + filebase,"w")
|
||||
|
||||
name = person.getPrimaryName().getRegularName()
|
||||
@ -539,7 +539,7 @@ def dump_index(person_list,filename,prefix,templateTop,templateBottom,targetDir)
|
||||
for person in person_list:
|
||||
name = person.getPrimaryName().getName()
|
||||
id = person.getId()
|
||||
html.write("<A HREF=\"%s%d.html\">%s</A><BR>\n" % (prefix,id,name))
|
||||
html.write("<A HREF=\"%s%s.html\">%s</A><BR>\n" % (prefix,id,name))
|
||||
|
||||
for line in templateBottom:
|
||||
html.write(line)
|
||||
|
@ -538,8 +538,8 @@ class Merge:
|
||||
else:
|
||||
mother2 = ""
|
||||
|
||||
label1 = "%s (%s)" % (_("First Person"),str(person1.getId()))
|
||||
label2 = "%s (%s)" % (_("Second Person"),str(person2.getId()))
|
||||
label1 = "%s (%s)" % (_("First Person"),person1.getId())
|
||||
label2 = "%s (%s)" % (_("Second Person"),person2.getId())
|
||||
|
||||
self.topDialog.get_widget("PersonFrame1").set_label(label1)
|
||||
self.topDialog.get_widget("PersonFrame2").set_label(label2)
|
||||
@ -613,7 +613,7 @@ class Merge:
|
||||
name = "unknown"
|
||||
else:
|
||||
name = spouse.getPrimaryName().getName() + \
|
||||
" (" + str(spouse.getId()) + ")"
|
||||
" (" + spouse.getId() + ")"
|
||||
self.topDialog.get_widget("spouse1").append([name])
|
||||
|
||||
length = min(len(p2list),3)
|
||||
@ -631,7 +631,7 @@ class Merge:
|
||||
name = "unknown"
|
||||
else:
|
||||
name = spouse.getPrimaryName().getName() + \
|
||||
" (" + str(spouse.getId()) + ")"
|
||||
" (" + spouse.getId() + ")"
|
||||
self.topDialog.get_widget("spouse2").append([name])
|
||||
|
||||
self.mergee = person1
|
||||
|
@ -177,7 +177,7 @@ class IndividualPage:
|
||||
self.doc.start_paragraph("Data")
|
||||
if person:
|
||||
if person in self.list:
|
||||
self.doc.start_link("i%s.html" % str(person.getId()))
|
||||
self.doc.start_link("i%s.html" % person.getId())
|
||||
self.doc.write_text(person.getPrimaryName().getRegularName())
|
||||
if person in self.list:
|
||||
self.doc.end_link()
|
||||
@ -215,7 +215,7 @@ class IndividualPage:
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def create_page(self):
|
||||
filebase = "i%d.html" % (self.person.getId())
|
||||
filebase = "i%s.html" % self.person.getId()
|
||||
self.doc.open("%s%s%s" % (self.dir,os.sep,filebase))
|
||||
|
||||
photo_list = self.person.getPhotoList()
|
||||
@ -378,7 +378,7 @@ class IndividualPage:
|
||||
self.doc.start_cell("NormalCell",2)
|
||||
self.doc.start_paragraph("Spouse")
|
||||
if spouse:
|
||||
self.doc.start_link("i%s.html" % str(spouse.getId()))
|
||||
self.doc.start_link("i%s.html" % spouse.getId())
|
||||
self.doc.write_text(spouse.getPrimaryName().getRegularName())
|
||||
self.doc.end_link()
|
||||
else:
|
||||
@ -410,7 +410,7 @@ class IndividualPage:
|
||||
first = 0
|
||||
else:
|
||||
self.doc.write_text('\n')
|
||||
self.doc.start_link("i%s.html" % str(child.getId()))
|
||||
self.doc.start_link("i%s.html" % child.getId())
|
||||
self.doc.write_text(child.getPrimaryName().getRegularName())
|
||||
self.doc.end_link()
|
||||
self.doc.end_paragraph()
|
||||
@ -760,8 +760,7 @@ def dump_index(person_list,styles,template,html_dir):
|
||||
person_list.sort(sort.by_last_name)
|
||||
for person in person_list:
|
||||
name = person.getPrimaryName().getName()
|
||||
id = person.getId()
|
||||
doc.start_link("i%s.html" % str(person.getId()))
|
||||
doc.start_link("i%s.html" % person.getId())
|
||||
doc.write_text(name)
|
||||
doc.end_link()
|
||||
doc.newline()
|
||||
|
@ -333,7 +333,7 @@ def write_person_name(g,name,nick):
|
||||
def write_source_ref(g,level,ref):
|
||||
if ref.getBase() == None:
|
||||
return
|
||||
g.write("%d SOUR @S%s@\n" % (level,str(ref.getBase().getId())))
|
||||
g.write("%d SOUR @S%s@\n" % (level,ref.getBase().getId()))
|
||||
if ref.getPage() != "":
|
||||
g.write("%d PAGE %s\n" % (level+1,ref.getPage()))
|
||||
if ref.getText() != "" or ref.getDate().getDate() != "":
|
||||
@ -425,11 +425,11 @@ def write_person(g,person):
|
||||
|
||||
family = person.getMainFamily()
|
||||
if family != None and family in family_list:
|
||||
g.write("1 FAMC @F%s@\n" % str(family.getId()))
|
||||
g.write("1 FAMC @F%s@\n" % family.getId())
|
||||
g.write("2 PEDI birth\n")
|
||||
|
||||
for family in person.getAltFamilyList():
|
||||
g.write("1 FAMC @F%s@\n" % str(family[0].getId()))
|
||||
g.write("1 FAMC @F%s@\n" % family[0].getId())
|
||||
if string.lower(family[1]) == "adopted":
|
||||
g.write("2 PEDI adopted\n")
|
||||
|
||||
@ -537,7 +537,7 @@ def exportData(database, filename):
|
||||
g.write("1 CHIL @I%s@\n" % person.getId())
|
||||
|
||||
for source in source_list:
|
||||
g.write("0 @S%s@ SOUR\n" % str(source.getId()))
|
||||
g.write("0 @S%s@ SOUR\n" % source.getId())
|
||||
if source.getTitle() != "":
|
||||
g.write("1 TITL %s\n" % cnvtxt(source.getTitle()))
|
||||
if source.getAuthor() != "":
|
||||
|
Loading…
Reference in New Issue
Block a user