From: Han-Wen Nienhuys Date: Thu, 11 May 2006 08:43:51 +0000 (+0000) Subject: * python/musicxml.py (Xml_node.__init__): _attribute_dict stores X-Git-Tag: release/2.9.5~34 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=baf8c957f8021e07d5ad4503f0eb45309e77ef55;p=lilypond.git * python/musicxml.py (Xml_node.__init__): _attribute_dict stores XML attributes. (Xml_node.message): use it. * scripts/musicxml2ly.py (musicxml_voice_to_lily_voice): oops. Add duration argument. --- diff --git a/ChangeLog b/ChangeLog index fbef4a8fd7..86d8171a57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-05-11 Han-Wen Nienhuys + + * python/musicxml.py (Xml_node.__init__): _attribute_dict stores + XML attributes. + (Xml_node.message): use it. + + * scripts/musicxml2ly.py (musicxml_voice_to_lily_voice): + oops. Add duration argument. + 2006-05-10 Joe Neeman * lily/paper-column-engraver.cc (make_columns): diff --git a/VERSION b/VERSION index ff852b3e82..9c3e3cb61c 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=9 -PATCH_LEVEL=4 +PATCH_LEVEL=5 MY_PATCH_LEVEL= diff --git a/python/musicxml.py b/python/musicxml.py index 45b3523f6e..b390485c5b 100644 --- a/python/musicxml.py +++ b/python/musicxml.py @@ -8,7 +8,8 @@ class Xml_node: self._original = None self._name = 'xml_node' self._parent = None - + self._attribute_dict = {} + def get_parent (self): return self._parent @@ -34,8 +35,8 @@ class Xml_node: p = self while p: - print ' In: <%s %s>' % (p._name, ' '.join (['%s=%s' % item for item in p._original.attrib.items()])) - p = p._parent + print ' In: <%s %s>' % (p._name, ' '.join (['%s=%s' % item for item in p._attribute_dict.items()])) + p = p.get_parent () def get_typed_children (self, klass): return [c for c in self._children if isinstance(c, klass)] @@ -255,6 +256,7 @@ class Musicxml_voice: class Part (Music_xml_node): def __init__ (self): + Music_xml_node.__init__ (self) self._voices = [] def get_part_list (self): @@ -502,6 +504,7 @@ def lxml_demarshal_node (node): for (k,v) in node.items (): py_node.__dict__[k] = v + py_node._attribute_dict[k] = v return py_node @@ -518,7 +521,8 @@ def minidom_demarshal_node (node): if node.attributes: for (nm, value) in node.attributes.items(): py_node.__dict__[nm] = value - + py_node._attribute_dict[nm] = value + py_node._data = None if node.nodeType == node.TEXT_NODE and node.data: py_node._data = node.data diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index f1125b15d6..c24dccb5bd 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -6,7 +6,6 @@ import re import os import string from gettext import gettext as _ -import musicxml @@ -398,7 +397,7 @@ def musicxml_voice_to_lily_voice (voice): tuplet_events.append ((ev_chord, tuplet_event, frac)) ## force trailing mm rests to be written out. - voice_builder.add_music (musicexp.EventChord ()) + voice_builder.add_music (musicexp.EventChord (), Rational (0)) ly_voice = group_tuplets (voice_builder.elements, tuplet_events)