]> git.donarmstrong.com Git - lilypond.git/commitdiff
Sorting of the parts in the .ly output. Currently, their order was not first staff...
authorReinhold Kainhofer <reinhold@kainhofer.com>
Sun, 19 Aug 2007 21:51:51 +0000 (23:51 +0200)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 20 Aug 2007 03:35:14 +0000 (00:35 -0300)
Basically, I use the part_list to sort the individual music voices in the order as they appear in the score before printing them out.

scripts/musicxml2ly.py

index 3a5f465087310864f7006f0141c3f2a3f1ae19fa..7307dd2d6a3b6a797e4af7322248028125c12b4e 100644 (file)
@@ -648,9 +648,13 @@ def music_xml_voice_name_to_lily_name (part, name):
     str = "Part%sVoice%s" % (part.id, name)
     return musicxml_id_to_lily (str) 
 
-def print_voice_definitions (printer, voices):
+def print_voice_definitions (printer, part_list, voices):
+    part_dict={}
     for (part, nv_dict) in voices.items():
-        
+        part_dict[part.id] = (part, nv_dict)
+
+    for part in part_list:
+        (part, nv_dict) = part_dict[part.id]
         for (name, (voice, mxlvoice)) in nv_dict.items ():
             k = music_xml_voice_name_to_lily_name (part, name)
             printer.dump ('%s = ' % k)
@@ -763,7 +767,7 @@ def convert (filename, options):
     printer.set_file (open (defs_ly_name, 'w'))
 
     print_ly_preamble (printer, filename)
-    print_voice_definitions (printer, voices)
+    print_voice_definitions (printer, part_list, voices)
     
     printer.close ()