]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/musicexp.py
Translated docs: fix 'cp' error about multiple CSS files copying
[lilypond.git] / python / musicexp.py
index cab3c8d67f4303e70601e2ae920a020601ee0a19..6bf587be8ff213d184ecac9ca075c87511652de2 100644 (file)
@@ -892,10 +892,10 @@ class BarLine (Music):
         self.type = None
         
     def print_ly (self, printer):
-        bar_symbol = { 'regular': "|", 'dotted': ":", 'dashed': ":",
+        bar_symbol = { 'regular': "|", 'dotted': ":", 'dashed': "dashed",
                        'heavy': "|", 'light-light': "||", 'light-heavy': "|.",
                        'heavy-light': ".|", 'heavy-heavy': ".|.", 'tick': "'",
-                       'short': "'", 'none': "" }.get (self.type, None)
+                       'short': "'|", 'none': "" }.get (self.type, None)
         if bar_symbol <> None:
             printer.dump ('\\bar "%s"' % bar_symbol)
         else:
@@ -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):
@@ -1523,6 +1532,8 @@ class ClefChange (Music):
                 ('F', 4): "bass",
                 ('F', 5): "subbass",
                 ("percussion", 2): "percussion",
+                # Workaround: MuseScore uses PERC instead of percussion
+                ("PERC", 2): "percussion",
                 ("TAB", 5): "tab"}.get ((self.type, self.position), None)
     def ly_expression (self):
         return '\\clef "%s%s"' % (self.clef_name (), self.octave_modifier ())