We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ea3c0c4 + bd4964d commit 086e55fCopy full SHA for 086e55f
1 file changed
ly/musicxml/xml_objs.py
@@ -96,8 +96,8 @@ def iterate_partgroup(self, group):
96
97
def iterate_part(self, part):
98
"""The part is iterated."""
99
- if part.barlist:
100
- last_bar = part.barlist[-1]
+ last_bar = part.last_bar()
+ if last_bar:
101
last_bar_objs = last_bar.obj_list
102
part.set_first_bar(self.divisions)
103
self.musxml.create_part(part.name, part.abbr, part.midi)
@@ -458,6 +458,12 @@ def extract_global_to_section(self, name):
458
section.barlist.append(section_bar)
459
return section
460
461
+ def last_bar(self):
462
+ """Returns the last Bar object in the score, or None if the score is empty."""
463
+ for obj in reversed(self.barlist):
464
+ if isinstance(obj, Bar):
465
+ return obj
466
+
467
468
class Bar():
469
""" Representing the bar/measure.
0 commit comments