2007-05-11 Benny Malengier <bm@cage.ugent.be>

* src/GrampsDbUtils/_ReadXML.py:
	* src/GrampsDb/_GrampsDbWriteXML.py:
        Merge gramps2 privacy changes of Don, add privacy to note of sourceref and lds_ord

	* src/GrampsDbUtils/_ReadXML.py: partly fix #1053, import privacy of person, family,


svn: r8463
This commit is contained in:
Benny Malengier 2007-05-11 22:31:39 +00:00
parent 11190e66d9
commit 04df3f6e89
3 changed files with 23 additions and 9 deletions

View File

@ -1,5 +1,10 @@
2007-05-11 Benny Malengier <bm@cage.ugent.be>
* src/GrampsDbUtils/_ReadXML.py:
* src/GrampsDb/_GrampsDbWriteXML.py:
Merge gramps2 privacy changes of Don, add privacy to note of sourceref and lds_ord
2007-05-10 Benny Malengier <bm@cage.ugent.be> 2007-05-10 Benny Malengier <bm@cage.ugent.be>
* src/GrampsDb/_ReadXML.py: partly fix #1053, import privacy of person, family, * src/GrampsDbUtils/_ReadXML.py: partly fix #1053, import privacy of person, family,
media, source, place and repo correct. Still to do: sourceref and lds_ordinance media, source, place and repo correct. Still to do: sourceref and lds_ordinance
2007-05-08 Don Allingham <don@gramps-project.org> 2007-05-08 Don Allingham <don@gramps-project.org>

View File

@ -649,7 +649,9 @@ class GrampsDbXmlWriter(object):
sp = " " * index sp = " " * index
sp2 = " " * (index+1) sp2 = " " * (index+1)
self.g.write('%s<lds_ord type="%s">\n' % (sp,name))
priv = conf_priv(ord)
self.g.write('%s<lds_ord type="%s"%s>\n' % (sp,name,priv))
dateobj = ord.get_date_object() dateobj = ord.get_date_object()
if dateobj and not dateobj.is_empty(): if dateobj and not dateobj.is_empty():
self.write_date(dateobj,index+1) self.write_date(dateobj,index+1)
@ -677,13 +679,17 @@ class GrampsDbXmlWriter(object):
d = source_ref.get_date_object() d = source_ref.get_date_object()
q = source_ref.get_confidence_level() q = source_ref.get_confidence_level()
self.g.write(" " * index) self.g.write(" " * index)
priv = conf_priv(source_ref)
if p == "" and n == [] and t == "" and d.is_empty() and q == 2: if p == "" and n == [] and t == "" and d.is_empty() and q == 2:
self.g.write('<sourceref hlink="%s"/>\n' % ("_"+source.get_handle())) self.g.write('<sourceref hlink="%s"%s/>\n' % ("_"+source.get_handle(), priv))
else: else:
if q == 2: if q == 2:
self.g.write('<sourceref hlink="%s">\n' % ("_"+source.get_handle())) self.g.write('<sourceref hlink="%s"%s>\n' % ("_"+source.get_handle(), priv))
else: else:
self.g.write('<sourceref hlink="%s" conf="%d">\n' % ("_"+source.get_handle(),q)) self.g.write('<sourceref hlink="%s" conf="%d"%s>\n' % (
"_"+source.get_handle(),q, priv))
self.write_line("spage",p,index+1) self.write_line("spage",p,index+1)
self.write_note_list(n,index+1) self.write_note_list(n,index+1)
self.write_text("stext",t,index+1) self.write_text("stext",t,index+1)

View File

@ -666,6 +666,7 @@ class GrampsParser(UpdateCallback):
def start_lds_ord(self,attrs): def start_lds_ord(self,attrs):
self.ord = RelLib.LdsOrd() self.ord = RelLib.LdsOrd()
self.ord.set_type_from_xml(attrs['type']) self.ord.set_type_from_xml(attrs['type'])
self.ord.private = bool(attrs.get("priv"))
if self.person: if self.person:
self.person.lds_ord_list.append(self.ord) self.person.lds_ord_list.append(self.ord)
elif self.family: elif self.family:
@ -702,6 +703,7 @@ class GrampsParser(UpdateCallback):
except KeyError: except KeyError:
gramps_id = self.map_pid(attrs['ref']) gramps_id = self.map_pid(attrs['ref'])
self.placeobj = self.find_place_by_gramps_id(gramps_id) self.placeobj = self.find_place_by_gramps_id(gramps_id)
self.placeobj.private = bool(attrs.get("priv"))
def start_placeobj(self,attrs): def start_placeobj(self,attrs):
gramps_id = self.map_pid(attrs['id']) gramps_id = self.map_pid(attrs['id'])
@ -1006,7 +1008,7 @@ class GrampsParser(UpdateCallback):
url = RelLib.Url() url = RelLib.Url()
url.path = attrs["href"] url.path = attrs["href"]
url.set_description(attrs.get("description",'')) url.set_description(attrs.get("description",''))
url.privacy = bool(attrs.get('priv')) url.private = bool(attrs.get('priv'))
url.type.set_from_xml_str(attrs['type']) url.type.set_from_xml_str(attrs['type'])
if self.person: if self.person:
self.person.add_url(url) self.person.add_url(url)
@ -1147,13 +1149,13 @@ class GrampsParser(UpdateCallback):
self.note.format = int(attrs.get('format',RelLib.Note.FLOWED)) self.note.format = int(attrs.get('format',RelLib.Note.FLOWED))
if self.source_ref: if self.source_ref:
self.note.type.set(RelLib.NoteType.SOURCEREF) self.note.type.set(RelLib.NoteType.SOURCEREF)
# self.note.private = ... sourceref has no private ?? self.note.private = self.source_ref.private
elif self.address: elif self.address:
self.note.type.set(RelLib.NoteType.ADDRESS) self.note.type.set(RelLib.NoteType.ADDRESS)
self.note.private = self.address.private self.note.private = self.address.private
elif self.ord: elif self.ord:
self.note.type.set(elLib.NoteType.LDS) self.note.type.set(elLib.NoteType.LDS)
# self.note.private = ... lds_ord has no private ?? self.note.private = self.ord.private
elif self.attribute: elif self.attribute:
self.note.type.set(RelLib.NoteType.ATTRIBUTE) self.note.type.set(RelLib.NoteType.ATTRIBUTE)
self.note.private = self.attribute.private self.note.private = self.attribute.private
@ -1254,6 +1256,8 @@ class GrampsParser(UpdateCallback):
self.source_ref.ref = handle self.source_ref.ref = handle
self.source_ref.confidence = int(attrs.get("conf",self.conf)) self.source_ref.confidence = int(attrs.get("conf",self.conf))
self.source_ref.private = bool(attrs.get("priv"))
if self.photo: if self.photo:
self.photo.add_source_reference(self.source_ref) self.photo.add_source_reference(self.source_ref)
elif self.ord: elif self.ord:
@ -1290,7 +1294,6 @@ class GrampsParser(UpdateCallback):
self.source.set_gramps_id(gramps_id) self.source.set_gramps_id(gramps_id)
except KeyError: except KeyError:
self.source = self.find_source_by_gramps_id(gramps_id) self.source = self.find_source_by_gramps_id(gramps_id)
self.source.private = bool(attrs.get("priv")) self.source.private = bool(attrs.get("priv"))
def start_reporef(self,attrs): def start_reporef(self,attrs):