Template: Create instruments tex file only if we have any instruments
authorReinhold Kainhofer <reinhold@kainhofer.com>
Sat, 3 Nov 2012 19:47:49 +0000 (3 20:47 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Sat, 3 Nov 2012 19:47:49 +0000 (3 20:47 +0100)
generate_oly_score.py

index 047fb41..c614b03 100755 (executable)
@@ -478,14 +478,19 @@ def generate_tex_files (settings, lily_files):
       #this_settings["scorenamebase"] = "Name";
     tex_files.append (write_texscore_file (settings, this_settings, "TeX_Score.tex", score))
 
-  this_settings = copy.deepcopy (tex_settings);
-  this_settings["scoretype"] = "InstrumentalParts";
-  tmpopts = this_settings.get ("tex_options", [])
-  tmpopts.append (tex_options_map.get (this_settings["scoretype"], ""))
-  this_settings["tex_options"] = tmpopts
-  if "createCriticalComments" not in tex_settings:
-    this_settings["createCriticalComments"] = score not in no_criticalcomments_scores;
-  tex_files.append (write_texscore_file (settings, this_settings, "TeX_Instruments.tex", "Instruments"))
+
+  # Create the tex instruments file only if we have instruments!
+  if set(this_settings["instruments"]) != set(this_settings["noscore_instruments"]):
+    this_settings = copy.deepcopy (tex_settings);
+    this_settings["scoretype"] = "InstrumentalParts";
+    tmpopts = this_settings.get ("tex_options", [])
+    tmpopts.append (tex_options_map.get (this_settings["scoretype"], ""))
+    this_settings["tex_options"] = tmpopts
+    if "createCriticalComments" not in tex_settings:
+      this_settings["createCriticalComments"] = score not in no_criticalcomments_scores;
+    tex_files.append (write_texscore_file (settings, this_settings, "TeX_Instruments.tex", "Instruments"))
+  else:
+    print "     No separate instrumental scores, not creating instruments tex file."
 
   return [tex_files, tex_includes];