]> 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 d53815b03c11788feb67662fb4aba38e92704bfb..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 
@@ -1485,17 +1496,19 @@ class TimeSignatureChange (Music):
         # signatures anyway despite the default 'C signature style!
         is_common_signature = self.fractions in ([2,2], [4,4], [4,2])
         if self.style:
-            if (self.style != "'()") or is_common_signature:
+            if self.style == "common":
+                st = "\\defaultTimeSignature"
+            elif (self.style != "'()"):
                 st = "\\once \\override Staff.TimeSignature #'style = #%s " % self.style
+            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):