* src/GrampsDb/_ReadXML.py (start_attribute): Support attributes

in event and eventref;
	(stop_cause): Create attribute on cause tag.
	* src/Editors/_EditEventRef.py (_create_tabbed_pages): Typos.
	* src/Editors/_EditEvent.py (_create_tabbed_pages): Typo.
	* data/grampsxml.rng: Document XML changes (xml 1.1.2).
	* data/grampsxml.dtd: Document XML changes (xml 1.1.2).
	* src/GrampsDb/_WriteXML.py (dump_event_ref): Write attributes;
	(write_event): write attributes, remove cause.


svn: r7182
This commit is contained in:
Alex Roitman 2006-08-15 20:59:12 +00:00
parent bd18b2f976
commit 8f188fee5e
7 changed files with 39 additions and 15 deletions

View File

@ -1,4 +1,13 @@
2006-08-15 Alex Roitman <shura@gramps-project.org> 2006-08-15 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_ReadXML.py (start_attribute): Support attributes
in event and eventref;
(stop_cause): Create attribute on cause tag.
* src/Editors/_EditEventRef.py (_create_tabbed_pages): Typos.
* src/Editors/_EditEvent.py (_create_tabbed_pages): Typo.
* data/grampsxml.rng: Document XML changes (xml 1.1.2).
* data/grampsxml.dtd: Document XML changes (xml 1.1.2).
* src/GrampsDb/_WriteXML.py (dump_event_ref): Write attributes;
(write_event): write attributes, remove cause.
* src/GrampsDb/_GrampsBSDDB.py: Cleanup on upgrades. * src/GrampsDb/_GrampsBSDDB.py: Cleanup on upgrades.
2006-08-14 Alex Roitman <shura@gramps-project.org> 2006-08-14 Alex Roitman <shura@gramps-project.org>

View File

@ -24,15 +24,15 @@
--> -->
<!-- <!--
This is the Document Type Definition file for v1.1.1 This is the Document Type Definition file for v1.1.2
of the GRAMPS XML genealogy data format. of the GRAMPS XML genealogy data format.
Please use the following formal public identifier to identify it: Please use the following formal public identifier to identify it:
"-//GRAMPS//DTD GRAMPS XML V1.1.1//EN" "-//GRAMPS//DTD GRAMPS XML V1.1.2//EN"
For example: For example:
<!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML V1.1.1//EN" <!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML V1.1.2//EN"
"http://gramps-project.org/xml/1.1.1/grampsxml.dtd" "http://gramps-project.org/xml/1.1.2/grampsxml.dtd"
[...]> [...]>
--> -->
@ -53,7 +53,7 @@ DATABASE
<!ELEMENT database (header, name-formats?, events?, people?, families?, <!ELEMENT database (header, name-formats?, events?, people?, families?,
sources?, places?, objects?, repositories?, bookmark?)> sources?, places?, objects?, repositories?, bookmark?)>
<!ATTLIST database xmlns CDATA #FIXED "http://gramps-project.org/xml/1.1.1/"> <!ATTLIST database xmlns CDATA #FIXED "http://gramps-project.org/xml/1.1.2/">
<!-- ************************************************************ <!-- ************************************************************
HEADER HEADER
@ -198,7 +198,7 @@ EVENT
<!ELEMENT events (event)*> <!ELEMENT events (event)*>
<!ELEMENT event (type?,(daterange|dateval|datestr)?,place?,cause?, <!ELEMENT event (type?,(daterange|dateval|datestr)?,place?,cause?,
description?,note?,sourceref*,objref*)> description?,attribute*,note?,sourceref*,objref*)>
<!ATTLIST event <!ATTLIST event
id CDATA #REQUIRED id CDATA #REQUIRED
handle ID #REQUIRED handle ID #REQUIRED
@ -356,7 +356,7 @@ SHARED ELEMENTS
conf CDATA #IMPLIED conf CDATA #IMPLIED
> >
<!ELEMENT eventref (note?)> <!ELEMENT eventref (attribute*,note?)>
<!ATTLIST eventref <!ATTLIST eventref
hlink IDREF #REQUIRED hlink IDREF #REQUIRED
priv (0|1) #IMPLIED priv (0|1) #IMPLIED

View File

@ -31,7 +31,7 @@
<grammar <grammar
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="http://gramps-project.org/xml/1.1.1/" ns="http://gramps-project.org/xml/1.1.2/"
xmlns="http://relaxng.org/ns/structure/1.0"> xmlns="http://relaxng.org/ns/structure/1.0">
<start><element name="database"> <start><element name="database">
@ -325,8 +325,10 @@
<optional><element name="place"> <optional><element name="place">
<attribute name="hlink"><data type="IDREF"/></attribute> <attribute name="hlink"><data type="IDREF"/></attribute>
</element></optional> </element></optional>
<optional><element name="cause"><text/></element></optional>
<optional><element name="description"><text/></element></optional> <optional><element name="description"><text/></element></optional>
<zeroOrMore><element name="attribute">
<ref name="attribute-content"/>
</element></zeroOrMore>
<optional><element name="note"> <optional><element name="note">
<ref name="note-content"/> <ref name="note-content"/>
</element></optional> </element></optional>
@ -470,6 +472,9 @@
<ref name="priv-content"/> <ref name="priv-content"/>
</attribute></optional> </attribute></optional>
<optional><attribute name="role"><text/></attribute></optional> <optional><attribute name="role"><text/></attribute></optional>
<zeroOrMore><element name="attribute">
<ref name="attribute-content"/>
</element></zeroOrMore>
<optional><element name="note"> <optional><element name="note">
<ref name="note-content"/> <ref name="note-content"/>
</element></optional> </element></optional>

View File

@ -173,7 +173,7 @@ class EditEvent(EditPrimary):
self.attr_ref_list = self._add_tab( self.attr_ref_list = self._add_tab(
notebook, notebook,
AttrEmbedList(self.dbstate, self.uistate, self.track, AttrEmbedList(self.dbstate, self.uistate, self.track,
self.source_ref.get_attribute_list())) self.obj.get_attribute_list()))
except AttributeError: except AttributeError:
print "Attribute list not available yet" print "Attribute list not available yet"

View File

@ -158,7 +158,7 @@ class EditEventRef(EditReference):
try: try:
self.attr_list = self._add_tab( self.attr_list = self._add_tab(
notebook_ref, notebook,
AttrEmbedList(self.dbstate, self.uistate, self.track, AttrEmbedList(self.dbstate, self.uistate, self.track,
self.source.get_attribute_list())) self.source.get_attribute_list()))
except AttributeError: except AttributeError:
@ -187,7 +187,7 @@ class EditEventRef(EditReference):
try: try:
self.attr_ref_list = self._add_tab( self.attr_ref_list = self._add_tab(
notebook, notebook_ref,
AttrEmbedList(self.dbstate, self.uistate, self.track, AttrEmbedList(self.dbstate, self.uistate, self.track,
self.source_ref.get_attribute_list())) self.source_ref.get_attribute_list()))
except AttributeError: except AttributeError:

View File

@ -804,6 +804,10 @@ class GrampsParser(UpdateCallback):
self.object.add_attribute(self.attribute) self.object.add_attribute(self.attribute)
elif self.objref: elif self.objref:
self.objref.add_attribute(self.attribute) self.objref.add_attribute(self.attribute)
elif self.event:
self.event.add_attribute(self.attribute)
elif self.eventref:
self.eventref.add_attribute(self.attribute)
elif self.person: elif self.person:
self.person.add_attribute(self.attribute) self.person.add_attribute(self.attribute)
elif self.family: elif self.family:
@ -1604,7 +1608,11 @@ class GrampsParser(UpdateCallback):
self.event.description = tag self.event.description = tag
def stop_cause(self,tag): def stop_cause(self,tag):
self.event.cause = tag # The old event's cause is now an attribute
attr = RelLib.Attribute()
attr.set_type(RelLib.AttributeType.CAUSE)
attr.set_value(tag)
self.event.add_attribute(attr)
def stop_gender(self,tag): def stop_gender(self,tag):
t = tag t = tag

View File

@ -566,12 +566,14 @@ class XmlWriter(UpdateCallback):
else: else:
role_text = '' role_text = ''
if eventref.get_note() == "": attribute_list = eventref.get_attribute_list()
if (attribute_list == []) and (eventref.get_note() == ""):
self.write_ref('eventref',eventref.ref,index, self.write_ref('eventref',eventref.ref,index,
close=True,extra_text=priv_text+role_text) close=True,extra_text=priv_text+role_text)
else: else:
self.write_ref('eventref',eventref.ref,index, self.write_ref('eventref',eventref.ref,index,
close=False,extra_text=priv_text+role_text) close=False,extra_text=priv_text+role_text)
self.write_attribute_list(attribute_list,index+1)
self.write_note("note",eventref.get_note_object(),index+1) self.write_note("note",eventref.get_note_object(),index+1)
self.g.write('%s</eventref>\n' % sp) self.g.write('%s</eventref>\n' % sp)
@ -586,8 +588,8 @@ class XmlWriter(UpdateCallback):
self.g.write(' %s<type>%s</type>\n' % (sp,self.fix(etype)) ) self.g.write(' %s<type>%s</type>\n' % (sp,self.fix(etype)) )
self.write_date(event.get_date_object(),index+1) self.write_date(event.get_date_object(),index+1)
self.write_ref("place",event.get_place_handle(),index+1) self.write_ref("place",event.get_place_handle(),index+1)
self.write_line("cause",event.get_cause(),index+1)
self.write_line("description",event.get_description(),index+1) self.write_line("description",event.get_description(),index+1)
self.write_attribute_list(event.get_attribute_list(),index+1)
if event.get_note(): if event.get_note():
self.write_note("note",event.get_note_object(),index+1) self.write_note("note",event.get_note_object(),index+1)