* src/GrampsDb/_WriteXML.py (write_place_obj): Always write ptitle.
* src/GrampsDb/_ReadXML.py: Prase file and ptitle tags. * example/gramps/example.gramps: Update XML example. svn: r5855
This commit is contained in:
parent
358b909333
commit
fce7809f3a
@ -1,3 +1,8 @@
|
|||||||
|
2006-01-29 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/GrampsDb/_WriteXML.py (write_place_obj): Always write ptitle.
|
||||||
|
* src/GrampsDb/_ReadXML.py: Prase file and ptitle tags.
|
||||||
|
* example/gramps/example.gramps: Update XML example.
|
||||||
|
|
||||||
2006-01-28 Don Allingham <don@gramps-project.org>
|
2006-01-28 Don Allingham <don@gramps-project.org>
|
||||||
* src/DisplayTabs.py: hook up event ref editor
|
* src/DisplayTabs.py: hook up event ref editor
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -392,13 +392,14 @@ class GrampsParser:
|
|||||||
"img" : (self.start_photo, self.stop_photo),
|
"img" : (self.start_photo, self.stop_photo),
|
||||||
"objref" : (self.start_objref, self.stop_objref),
|
"objref" : (self.start_objref, self.stop_objref),
|
||||||
"object" : (self.start_object, self.stop_object),
|
"object" : (self.start_object, self.stop_object),
|
||||||
"file" : (self.start_file, self.stop_file),
|
"file" : (self.start_file, None),
|
||||||
"place" : (self.start_place, self.stop_place),
|
"place" : (self.start_place, self.stop_place),
|
||||||
"dateval" : (self.start_dateval, None),
|
"dateval" : (self.start_dateval, None),
|
||||||
"daterange" : (self.start_daterange, None),
|
"daterange" : (self.start_daterange, None),
|
||||||
"datestr" : (self.start_datestr, None),
|
"datestr" : (self.start_datestr, None),
|
||||||
"places" : (None, self.stop_places),
|
"places" : (None, self.stop_places),
|
||||||
"placeobj" : (self.start_placeobj,self.stop_placeobj),
|
"placeobj" : (self.start_placeobj,self.stop_placeobj),
|
||||||
|
"ptitle" : (None,self.stop_ptitle),
|
||||||
"location" : (self.start_location,None),
|
"location" : (self.start_location,None),
|
||||||
"lds_ord" : (self.start_lds_ord, self.stop_lds_ord),
|
"lds_ord" : (self.start_lds_ord, self.stop_lds_ord),
|
||||||
"temple" : (self.start_temple, None),
|
"temple" : (self.start_temple, None),
|
||||||
@ -682,11 +683,8 @@ class GrampsParser:
|
|||||||
self.placeobj.set_gramps_id(handle)
|
self.placeobj.set_gramps_id(handle)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.placeobj = self.find_place_by_gramps_id(handle)
|
self.placeobj = self.find_place_by_gramps_id(handle)
|
||||||
title = attrs['title']
|
# GRAMPS LEGACY: title in the placeobj tag
|
||||||
if title == "":
|
self.placeobj.title = attrs.get('title','')
|
||||||
title = attrs['id']
|
|
||||||
|
|
||||||
self.placeobj.set_title(title)
|
|
||||||
self.locations = 0
|
self.locations = 0
|
||||||
|
|
||||||
self.update()
|
self.update()
|
||||||
@ -713,7 +711,6 @@ class GrampsParser:
|
|||||||
# Parse witnesses created by older gramps
|
# Parse witnesses created by older gramps
|
||||||
self.in_witness = 1
|
self.in_witness = 1
|
||||||
self.witness_comment = ""
|
self.witness_comment = ""
|
||||||
print "in start_witness"
|
|
||||||
if attrs.has_key('name'):
|
if attrs.has_key('name'):
|
||||||
note_text = self.event.get_note() + "\n" + \
|
note_text = self.event.get_note() + "\n" + \
|
||||||
_("Witness name: %s") % attrs['name']
|
_("Witness name: %s") % attrs['name']
|
||||||
@ -734,9 +731,7 @@ class GrampsParser:
|
|||||||
self.db.commit_person(person,self.trans,self.change)
|
self.db.commit_person(person,self.trans,self.change)
|
||||||
|
|
||||||
def start_coord(self,attrs):
|
def start_coord(self,attrs):
|
||||||
#if attrs.has_key('lat'):
|
|
||||||
self.placeobj.lat = attrs.get('lat','')
|
self.placeobj.lat = attrs.get('lat','')
|
||||||
#if attrs.has_key('long'):
|
|
||||||
self.placeobj.long = attrs.get('long','')
|
self.placeobj.long = attrs.get('long','')
|
||||||
|
|
||||||
def start_event(self,attrs):
|
def start_event(self,attrs):
|
||||||
@ -766,8 +761,6 @@ class GrampsParser:
|
|||||||
# We count here on events being already parsed prior
|
# We count here on events being already parsed prior
|
||||||
# to parsing people. This will fail if this is not true.
|
# to parsing people. This will fail if this is not true.
|
||||||
event = self.db.get_event_from_handle(self.eventref.ref)
|
event = self.db.get_event_from_handle(self.eventref.ref)
|
||||||
print self.eventref.ref
|
|
||||||
print "event", event
|
|
||||||
if event.type[0] == RelLib.Event.BIRTH:
|
if event.type[0] == RelLib.Event.BIRTH:
|
||||||
self.person.birth_ref = self.eventref
|
self.person.birth_ref = self.eventref
|
||||||
elif event.type[0] == RelLib.Event.DEATH:
|
elif event.type[0] == RelLib.Event.DEATH:
|
||||||
@ -889,13 +882,18 @@ class GrampsParser:
|
|||||||
_ConstXML.marker_types,attrs.get("marker",''))
|
_ConstXML.marker_types,attrs.get("marker",''))
|
||||||
|
|
||||||
def start_rel(self,attrs):
|
def start_rel(self,attrs):
|
||||||
pass
|
self.family.type = _ConstXML.tuple_from_xml(
|
||||||
|
_ConstXML.family_relations,attrs.get("type",'Unknown'))
|
||||||
|
|
||||||
def start_file(self,attrs):
|
def start_file(self,attrs):
|
||||||
pass
|
self.object.mime = attrs['mime']
|
||||||
|
self.object.desc = attrs['description']
|
||||||
def stop_file(self,tag):
|
src = attrs["src"]
|
||||||
pass
|
if src:
|
||||||
|
if src[0] != '/':
|
||||||
|
fullpath = os.path.abspath(self.filename)
|
||||||
|
src = os.path.dirname(fullpath) + '/' + src
|
||||||
|
self.object.path = src
|
||||||
|
|
||||||
def start_childof(self,attrs):
|
def start_childof(self,attrs):
|
||||||
try:
|
try:
|
||||||
@ -1014,9 +1012,9 @@ class GrampsParser:
|
|||||||
# GRAMPS LEGACY: src, mime, and description attributes
|
# GRAMPS LEGACY: src, mime, and description attributes
|
||||||
# now belong to the <file> tag. Here we are supporting
|
# now belong to the <file> tag. Here we are supporting
|
||||||
# the old format of <object src="blah"...>
|
# the old format of <object src="blah"...>
|
||||||
self.object.mime = attrs['mime']
|
self.object.mime = attrs.get('mime','')
|
||||||
self.object.desc = attrs['description']
|
self.object.desc = attrs.get('description','')
|
||||||
src = attrs["src"]
|
src = attrs.get("src",'')
|
||||||
if src:
|
if src:
|
||||||
if src[0] != '/':
|
if src[0] != '/':
|
||||||
fullpath = os.path.abspath(self.filename)
|
fullpath = os.path.abspath(self.filename)
|
||||||
@ -1263,14 +1261,16 @@ class GrampsParser:
|
|||||||
def stop_photo(self,*tag):
|
def stop_photo(self,*tag):
|
||||||
self.photo = None
|
self.photo = None
|
||||||
|
|
||||||
def stop_placeobj(self,*tag):
|
def stop_ptitle(self,tag):
|
||||||
if self.placeobj.get_title() == "":
|
self.placeobj.title = tag
|
||||||
loc = self.placeobj.get_main_location()
|
|
||||||
self.placeobj.set_title(build_place_title(loc))
|
|
||||||
|
|
||||||
title = self.placeobj.get_title()
|
def stop_placeobj(self,*tag):
|
||||||
if title in self.place_names:
|
if self.placeobj.title == "":
|
||||||
self.placeobj.set_title(title + " [%s]" % self.placeobj.get_gramps_id())
|
loc = self.placeobj.get_main_location()
|
||||||
|
self.placeobj.title = build_place_title(loc)
|
||||||
|
|
||||||
|
if self.placeobj.title in self.place_names:
|
||||||
|
self.placeobj.title += " [%s]" % self.placeobj.gramps_id
|
||||||
|
|
||||||
self.db.commit_place(self.placeobj,self.trans,self.change)
|
self.db.commit_place(self.placeobj,self.trans,self.change)
|
||||||
self.placeobj = None
|
self.placeobj = None
|
||||||
|
@ -952,7 +952,7 @@ class XmlWriter:
|
|||||||
if self.strip_photos:
|
if self.strip_photos:
|
||||||
path = os.path.basename(path)
|
path = os.path.basename(path)
|
||||||
self.g.write('%s<file src="%s" mime="%s"%s/>\n'
|
self.g.write('%s<file src="%s" mime="%s"%s/>\n'
|
||||||
% (" "*index,path,mime_type,desc_text))
|
% (" "*(index+1),path,mime_type,desc_text))
|
||||||
self.write_attribute_list(obj.get_attribute_list())
|
self.write_attribute_list(obj.get_attribute_list())
|
||||||
if obj.get_note() != "":
|
if obj.get_note() != "":
|
||||||
self.write_note("note",obj.get_note_object(),index+1)
|
self.write_note("note",obj.get_note_object(),index+1)
|
||||||
|
Loading…
Reference in New Issue
Block a user