XML changes
svn: r251
This commit is contained in:
parent
ba8f365e04
commit
92b3a6375d
@ -339,21 +339,25 @@ class GrampsParser(handler.ContentHandler):
|
||||
#---------------------------------------------------------------------
|
||||
def start_photo(self,attrs):
|
||||
photo = Photo()
|
||||
if attrs.has_key("descrip"):
|
||||
photo.setDescription(u2l(attrs["descrip"]))
|
||||
src = u2l(attrs["src"])
|
||||
if src[0] != os.sep:
|
||||
photo.setPath("%s%s%s" % (self.base,os.sep,src))
|
||||
photo.setPrivate(1)
|
||||
else:
|
||||
photo.setPath(src)
|
||||
photo.setPrivate(0)
|
||||
if self.family:
|
||||
self.family.addPhoto(photo)
|
||||
elif self.source:
|
||||
self.source.addPhoto(photo)
|
||||
else:
|
||||
self.person.addPhoto(photo)
|
||||
for key in attrs.keys():
|
||||
if key == "descrip":
|
||||
photo.setDescription(u2l(attrs["descrip"]))
|
||||
elif key == "src":
|
||||
src = u2l(attrs["src"])
|
||||
if src[0] != os.sep:
|
||||
photo.setPath("%s%s%s" % (self.base,os.sep,src))
|
||||
photo.setPrivate(1)
|
||||
else:
|
||||
photo.setPath(src)
|
||||
photo.setPrivate(0)
|
||||
if self.family:
|
||||
self.family.addPhoto(photo)
|
||||
elif self.source:
|
||||
self.source.addPhoto(photo)
|
||||
else:
|
||||
self.person.addPhoto(photo)
|
||||
else:
|
||||
photo.addProperty(key,attrs[key])
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
|
@ -46,6 +46,7 @@ class Photo:
|
||||
self.path = ""
|
||||
self.desc = ""
|
||||
self.private = 0
|
||||
self.proplist = None
|
||||
|
||||
def setPath(self,path):
|
||||
self.path = path
|
||||
@ -65,6 +66,15 @@ class Photo:
|
||||
def getDescription(self):
|
||||
return self.desc
|
||||
|
||||
def addProperty(self,key,value):
|
||||
if self.proplist == None:
|
||||
self.proplist = { key: value}
|
||||
else:
|
||||
self.proplist[key] = value;
|
||||
|
||||
def getPropertyList(self):
|
||||
return self.proplist
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -854,7 +864,10 @@ class RelDataBase:
|
||||
return self.sourceMap
|
||||
|
||||
def addPerson(self,person):
|
||||
index = str(self.pmapIndex)
|
||||
index = "I%d" % self.pmapIndex
|
||||
while self.personMap.has_key(index):
|
||||
self.pmapIndex = self.pmapIndex + 1
|
||||
index = "I%d" % self.pmapIndex
|
||||
person.setId(index)
|
||||
self.personMap[index] = person
|
||||
self.pmapIndex = self.pmapIndex + 1
|
||||
@ -917,11 +930,7 @@ class RelDataBase:
|
||||
id = str(id)
|
||||
person.setId(id)
|
||||
self.personMap[id] = person
|
||||
try:
|
||||
val = int(id)
|
||||
self.pmapIndex = max(self.pmapIndex,val)+1
|
||||
except:
|
||||
pass
|
||||
self.pmapIndex = self.pmapIndex+1
|
||||
return id
|
||||
|
||||
def findPersonNoMap(self,idVal):
|
||||
@ -943,7 +952,10 @@ class RelDataBase:
|
||||
return self.smapIndex
|
||||
|
||||
def addSource(self,source):
|
||||
index = str(self.smapIndex)
|
||||
index = "S%d" % self.smapIndex
|
||||
while self.sourceMap.has_key(index):
|
||||
self.smapIndex = self.smapIndex + 1
|
||||
index = "S%d" % self.smapIndex
|
||||
source.setId(index)
|
||||
self.sourceMap[index] = source
|
||||
self.smapIndex = self.smapIndex + 1
|
||||
@ -962,11 +974,7 @@ class RelDataBase:
|
||||
index = str(index)
|
||||
source.setId(index)
|
||||
self.sourceMap[index] = source
|
||||
try:
|
||||
val = int(index)
|
||||
self.smapIndex = max(self.smapIndex,val) + 1
|
||||
except:
|
||||
pass
|
||||
self.smapIndex = self.smapIndex + 1
|
||||
return index
|
||||
|
||||
def findSourceNoMap(self,idVal):
|
||||
@ -979,11 +987,14 @@ class RelDataBase:
|
||||
return source
|
||||
|
||||
def newFamily(self):
|
||||
id = str(self.fmapIndex)
|
||||
index = "F%d" % self.fmapIndex
|
||||
while self.familyMap.has_key(index):
|
||||
self.fmapIndex = self.fmapIndex + 1
|
||||
index = "F%d" % self.fmapIndex
|
||||
self.fmapIndex = self.fmapIndex + 1
|
||||
family = Family()
|
||||
family.setId(id)
|
||||
self.familyMap[id] = family
|
||||
family.setId(index)
|
||||
self.familyMap[index] = family
|
||||
return family
|
||||
|
||||
def newFamilyNoMap(self,id):
|
||||
@ -991,11 +1002,7 @@ class RelDataBase:
|
||||
id = str(id)
|
||||
family.setId(id)
|
||||
self.familyMap[id] = family
|
||||
try:
|
||||
val = int(id)
|
||||
self.fmapIndex = max(self.fmapIndex,val) + 1
|
||||
except:
|
||||
pass
|
||||
self.fmapIndex = self.fmapIndex + 1
|
||||
return family
|
||||
|
||||
def findFamily(self,idVal,map):
|
||||
|
@ -262,7 +262,12 @@ def exportData(database, filename, callback):
|
||||
if os.path.dirname(path) == fileroot:
|
||||
path = os.path.basename(path)
|
||||
g.write("<img src=\"" + fix(path) + "\"")
|
||||
g.write(" descrip=\"" + fix(photo.getDescription()) + "\"/>\n")
|
||||
g.write(" descrip=\"" + fix(photo.getDescription()) + "\"")
|
||||
proplist = photo.getPropertyList()
|
||||
if proplist:
|
||||
for key in proplist.keys():
|
||||
g.write(' %s="%s"' % (key,proplist[key]))
|
||||
g.write("/>\n")
|
||||
|
||||
if len(person.getAddressList()) > 0:
|
||||
g.write("<addresses>\n")
|
||||
@ -338,7 +343,12 @@ def exportData(database, filename, callback):
|
||||
if os.path.dirname(path) == fileroot:
|
||||
path = os.path.basename(path)
|
||||
g.write("<img src=\"" + fix(path) + "\"")
|
||||
g.write(" descrip=\"" + fix(photo.getDescription()) + "\"/>\n")
|
||||
g.write(" descrip=\"" + fix(photo.getDescription()) + "\"")
|
||||
proplist = photo.getPropertyList()
|
||||
if proplist:
|
||||
for key in proplist.keys():
|
||||
g.write(' %s="%s"' % (key,proplist[key]))
|
||||
g.write("/>\n")
|
||||
|
||||
if len(family.getChildList()) > 0:
|
||||
g.write("<childlist>\n")
|
||||
@ -374,7 +384,11 @@ def exportData(database, filename, callback):
|
||||
if os.path.dirname(path) == fileroot:
|
||||
path = os.path.basename(path)
|
||||
g.write("<img src=\"" + fix(path) + "\"")
|
||||
g.write(" descrip=\"" + fix(photo.getDescription()) + "\"/>\n")
|
||||
g.write(" descrip=\"" + fix(photo.getDescription()) + "\"")
|
||||
proplist = photo.getPropertyList()
|
||||
if proplist:
|
||||
for key in proplist.keys():
|
||||
g.write(' %s="%s"' % (key,proplist[key]))
|
||||
g.write("</source>\n")
|
||||
g.write("</sources>\n")
|
||||
|
||||
|
@ -707,7 +707,7 @@
|
||||
<last_modification_time>Thu, 07 Dec 2000 14:37:54 GMT</last_modification_time>
|
||||
</signal>
|
||||
<columns>5</columns>
|
||||
<column_widths>250,40,70,150,100</column_widths>
|
||||
<column_widths>250,60,70,150,100</column_widths>
|
||||
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
|
||||
<show_titles>True</show_titles>
|
||||
<shadow_type>GTK_SHADOW_IN</shadow_type>
|
||||
@ -1743,7 +1743,7 @@
|
||||
<last_modification_time>Thu, 21 Dec 2000 20:47:47 GMT</last_modification_time>
|
||||
</signal>
|
||||
<columns>6</columns>
|
||||
<column_widths>210,50,50,150,75,50</column_widths>
|
||||
<column_widths>210,60,50,150,75,50</column_widths>
|
||||
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
|
||||
<show_titles>True</show_titles>
|
||||
<shadow_type>GTK_SHADOW_IN</shadow_type>
|
||||
|
@ -875,9 +875,9 @@ def save_file(filename):
|
||||
except OSError, msg:
|
||||
GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg))
|
||||
return
|
||||
except:
|
||||
GnomeErrorDialog(_("Could not create %s") % filename)
|
||||
return
|
||||
# except:
|
||||
# GnomeErrorDialog(_("Could not create %s") % filename)
|
||||
# return
|
||||
|
||||
database.setSavePath(old_file)
|
||||
utils.clearModified()
|
||||
@ -1954,11 +1954,11 @@ def load_tree_values(person,index,max,pv_text,tip):
|
||||
bdate = person.getBirth().getDate()
|
||||
ddate = person.getDeath().getDate()
|
||||
if bdate and ddate:
|
||||
text = msg + "\nb. " + bdate + "\n" + "d. " + ddate
|
||||
text = "%s\nb. %s\nd. %s" % (msg, bdate,ddate)
|
||||
elif bdate and not ddate:
|
||||
text = msg + "\nb. " + bdate
|
||||
text = "%s\nb. %s" % (msg, bdate)
|
||||
elif not bdate and ddate:
|
||||
text = msg + "\nd. " + ddate
|
||||
text = "%s\nb. %s" % (msg, ddate)
|
||||
else:
|
||||
text = msg
|
||||
tip[index] = text
|
||||
|
Loading…
Reference in New Issue
Block a user