]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/musicexp.py
Merge branch 'master' of ssh://jneem@git.sv.gnu.org/srv/git/lilypond into tmp
[lilypond.git] / python / musicexp.py
index cab3c8d67f4303e70601e2ae920a020601ee0a19..b1df9417f7531cfadcddf8bd72f9cd87d6852ccd 100644 (file)
@@ -991,7 +991,11 @@ class OctaveShiftEvent (SpanEvent):
         self.span_type = {'up': 1, 'down': -1}.get (type, 0)
     def ly_octave_shift_indicator (self):
         # convert 8/15 to lilypond indicators (+-1/+-2)
-        value = {8: 1, 15: 2}.get (self.size, 0)
+        try:
+            value = {8: 1, 15: 2}[self.size]
+        except KeyError:
+            warning (_ ("Invalid octave shift size found: %s. Using no shift.") % self.size)
+            value = 0
         # negative values go up!
         value *= -1*self.span_type
         return value
@@ -1478,6 +1482,13 @@ class TimeSignatureChange (Music):
         Music.__init__ (self)
         self.fractions = [4,4]
         self.style = None
+    def format_fraction (self, frac):
+        if isinstance (frac, list):
+            l = [self.format_fraction (f) for f in frac]
+            return "(" + string.join (l, " ") + ")"
+        else:
+            return "%s" % frac
+
     def ly_expression (self):
         st = ''
         # Print out the style if we have ome, but the '() should only be 
@@ -1489,17 +1500,15 @@ class TimeSignatureChange (Music):
                 st = "\\defaultTimeSignature"
             elif (self.style != "'()"):
                 st = "\\once \\override Staff.TimeSignature #'style = #%s " % self.style
-            if (self.style != "'()") or is_common_signature:
+            elif (self.style != "'()") or is_common_signature:
                 st = "\\numericTimeSignature"
 
         # Easy case: self.fractions = [n,d] => normal \time n/d call:
         if len (self.fractions) == 2 and isinstance (self.fractions[0], int):
             return st + '\\time %d/%d ' % tuple (self.fractions)
-        elif self.fractions and not isinstance (self.fractions[0], list):
-            # TODO: Implement non-standard time-signatures
-            return st + ''
+        elif self.fractions:
+            return st + "\\compoundMeter #'%s" % self.format_fraction (self.fractions)
         else:
-            # TODO: Implement non-standard time-signatures
             return st + ''
     
 class ClefChange (Music):