Convert a mingus.containers.Track object to an ASCII tablature string. 'tuning' should be set to a StringTuning object or to None to use the Track's tuning (or alternatively the default if the Track hasn't got its own tuning). 'string' and 'fret' attributes on Notes are taken into
(track, maxwidth=80, tuning=None)
| 320 | |
| 321 | |
| 322 | def from_Track(track, maxwidth=80, tuning=None): |
| 323 | """Convert a mingus.containers.Track object to an ASCII tablature string. |
| 324 | |
| 325 | 'tuning' should be set to a StringTuning object or to None to use the |
| 326 | Track's tuning (or alternatively the default if the Track hasn't got its |
| 327 | own tuning). |
| 328 | |
| 329 | 'string' and 'fret' attributes on Notes are taken into account. |
| 330 | """ |
| 331 | result = [] |
| 332 | width = _get_width(maxwidth) |
| 333 | if not tuning: |
| 334 | tuning = track.get_tuning() |
| 335 | lastlen = 0 |
| 336 | for bar in track: |
| 337 | r = from_Bar(bar, width, tuning, collapse=False) |
| 338 | barstart = r[1].find("||") + 2 |
| 339 | if (len(r[0]) + lastlen) - barstart < maxwidth and result != []: |
| 340 | for i in range(1, len(r) + 1): |
| 341 | item = r[len(r) - i] |
| 342 | result[-i] += item[barstart:] |
| 343 | else: |
| 344 | result += ["", ""] + r |
| 345 | lastlen = len(result[-1]) |
| 346 | return os.linesep.join(result) |
| 347 | |
| 348 | |
| 349 | def from_Composition(composition, width=80): |
nothing calls this directly
no test coverage detected