import re
import sys
import copy
-import lilylib
+import lilylib as ly
-_ = lilylib._
+_ = ly._
def error (str):
ly.stderr_write ((_ ("error: %s") % str) + "\n")
return ''.join ([c.get_text () for c in self._children])
def message (self, msg):
- lilylib.stderr_write (msg+'\n')
+ ly.stderr_write (msg+'\n')
p = self
while p:
'half': 1,
'whole': 0,
'breve': -1,
- 'long': -2}.get (log, 0)
+ 'longa': -2}.get (log, 0)
elif self.get_maybe_exist_named_child (u'grace'):
# FIXME: is it ok to default to eight note for grace notes?
return 3
if instrument_name:
return instrument_name
else:
- lilylib.stderr_write (_ ("Unable to find find instrument for ID=%s\n") % id)
+ ly.stderr_write (_ ("Unable to find find instrument for ID=%s\n") % id)
return "Grand Piano"
class Part_group (Music_xml_node):
def lxml_demarshal_node (node):
name = node.tag
- # TODO: This is a nasty hack, but I couldn't find any other way to check
- # if the given node is a comment node (class _Comment):
- if name is None or re.match (u"^<!--.*-->$", node.__repr__()):
+ # Ignore comment nodes, which are also returned by the etree parser!
+ if name is None or node.__class__.__name__ == "_Comment":
return None
klass = get_class (name)
py_node = klass()