def createOtherRepetitions(self, attributes): r''' Repetitions like 'Coda', 'Segno' and some others. >>> nwt = noteworthy.translate.NoteworthyTranslator() >>> nwt.currentMeasure = stream.Measure() >>> nwt.createOtherRepetitions({'Style' : 'ToCoda', 'Pos': '8', ... 'Wide':'Y', 'Placement': 'BestFitForward'}) >>> 'Coda' in nwt.currentMeasure[0].classes True ''' # DaCapoAlFine - Coda - Segno - ToCoda style = attributes['Style'] if style == 'DCalFine': g = repeat.DaCapoAlFine() elif style == 'Coda': g = repeat.Coda() elif style == 'ToCoda': g = repeat.Coda() elif style == 'Segno': g = repeat.Segno() elif style == 'DSalCoda': g = repeat.DalSegnoAlCoda() elif style == 'Fine': g = repeat.Fine() else: raise NoteworthyTranslateException('Cannot get style from %s' % str(attributes)) self.currentMeasure.append(g)
def createOtherRepetitions(self, attributes): r''' Repetitions like "Coda", "Segno" and some others. >>> nwt = noteworthy.translate.NoteworthyTranslator() >>> nwt.currentMeasure = stream.Measure() >>> nwt.createOtherRepetitions({"Style" : "ToCoda", "Pos": "8", ... "Wide":"Y","Placement":"BestFitForward"}) >>> "Coda" in nwt.currentMeasure[0].classes True ''' # DaCapoAlFine - Coda - Segno - ToCoda style = attributes['Style'] if style == "DCalFine": g = repeat.DaCapoAlFine() elif style == "Coda": g = repeat.Coda() elif style == "ToCoda": g = repeat.Coda() elif style == "Segno": g = repeat.Segno() elif style == "DSalCoda": g = repeat.DalSegnoAlCoda() elif style == "Fine": g = repeat.Fine() else: raise NoteworthyTranslateException('Cannot get style from %s' % str(attributes)) self.currentMeasure.append(g)
def testTextExpressionOffset(self): '''Transfer element offset after calling getTextExpression().''' # https://github.com/cuthbertLab/music21/issues/624 s = converter.parse('tinynotation: 4/4 c1') c = repeat.Coda() c.useSymbol = False f = repeat.Fine() mm = tempo.MetronomeMark(text='Langsam') mm.placement = 'above' s.measure(1).storeAtEnd([c, f, mm]) tree = self.getET(s) for direction in tree.findall('.//direction'): self.assertIsNone(direction.find('offset')) # Also check position mxDirection = tree.find('part/measure/direction') self.assertEqual(mxDirection.get('placement'), 'above')