From a09121d886f75c61bdd6c4544f0b3b1215988777 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Sun, 19 Aug 2007 23:51:51 +0200 Subject: [PATCH] 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. --- scripts/musicxml2ly.py | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index 3a5f465..7307dd2 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 () -- 1.5.2.3