]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilymidi.py
Issue 3468: lilypond-book and spaces in application name
[lilypond.git] / scripts / lilymidi.py
index 357988818d13fe45d377e693a0707082e92fb3e0..20d13aa5082d754708d1168f89f749c7b7220d57 100644 (file)
@@ -1,6 +1,6 @@
 #!@TARGET_PYTHON@
 
-# Copyright (C) 2006--2011 Brailcom, o.p.s.
+# Copyright (C) 2006--2012 Brailcom, o.p.s.
 #
 # Author: Milan Zamazal <pdm@brailcom.org>
 #
@@ -87,7 +87,10 @@ class time_signature_formatter (formatter):
      return str (val2)   # TODO
 class key_signature_formatter (formatter):
    def format_vals (self, val1, val2):
-     return str (val2)   # TODO
+       key_names = ['F', 'C', 'G', 'D', 'A', 'E', 'B']
+       key = (((ord(val2[0])+128)%256)-128) + ord(val2[1])*3 + 1;
+       return (key_names[key%7] + (key/7) * "is" + (-(key/7)) * "es"
+               + " " + ['major','minor'][ord(val2[1])])
 class channel_formatter (formatter):
    def __init__ (self, txt, ch):
      formatter.__init__ (self, txt)