From: Reinhold Kainhofer Date: Sun, 19 Aug 2007 21:51:51 +0000 (+0200) Subject: Sorting of the parts in the .ly output. Currently, their order was not first staff... X-Git-Tag: release/2.11.30-1~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=758cc1a5dca66c96ed7c00c68d1ce4b4caf4fd91;p=lilypond.git Sorting of the parts in the .ly output. Currently, their order was not first staff, second staff, third, etc. but seemingly random 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. --- diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index 3a5f465087..7307dd2d6a 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -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 ()