Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ly/musicxml/xml_objs.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def iterate_partgroup(self, group):

def iterate_part(self, part):
"""The part is iterated."""
if part.barlist:
last_bar = part.barlist[-1]
last_bar = part.last_bar()
if last_bar:
last_bar_objs = last_bar.obj_list
part.set_first_bar(self.divisions)
self.musxml.create_part(part.name, part.abbr, part.midi)
Expand Down Expand Up @@ -458,6 +458,12 @@ def extract_global_to_section(self, name):
section.barlist.append(section_bar)
return section

def last_bar(self):
"""Returns the last Bar object in the score, or None if the score is empty."""
for obj in reversed(self.barlist):
if isinstance(obj, Bar):
return obj


class Bar():
""" Representing the bar/measure.
Expand Down
Loading