Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store "numbered ending" within barline #1686

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions music21/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class Barline(base.Music21Object):
classSortOrder = -5

equalityAttributes = ('type', 'pause', 'location')

numberedEnding = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All new attributes need to be typed. numberedEnding: int | None = None


def __init__(self,
type=None, # pylint: disable=redefined-builtin
Expand Down Expand Up @@ -157,6 +159,9 @@ def _getType(self):
def _setType(self, value):
self._type = standardizeBarType(value)

def setNumberedEnding(self, value):
self.numberedEnding = value
Comment on lines +162 to +163
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Python we don't generally use setters for things that can be set directly.


type = property(_getType, _setType,
doc='''
Get and set the Barline type property.
Expand Down
1 change: 1 addition & 0 deletions music21/musicxml/xmlToM21.py
Original file line number Diff line number Diff line change
Expand Up @@ -4825,6 +4825,7 @@ def xmlBarline(self, mxBarline):
# barline objects also store ending objects, that mark begin
# and end of repeat bracket designations
mxEndingObj = mxBarline.find('ending')
barline.setNumberedEnding(mxEndingObj)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What type of variable is this storing? Is it a str? int?

if mxEndingObj is not None:
# TODO: musicxml 4: system="yes/no" -- does this apply to whole system?

Expand Down