Python NWC tool to reverse selected notes in a staff.
Here’s the python code. Enjoy.
This code needs to import nwctxt.py see https://github.com/nwsw/nwc2ut-python
Love and peace,
Joe
"""joeSelReverse.py Reverses the Notes that are selected in a NoteWorthy Composer staff
see:
https://github.com/nwsw/nwc2ut-python
"""
import sys
# import joeNWCtxtInPythonNew as nwctxt
import nwctxt # see https://github.com/nwsw/nwc2ut-python
import logging
logging.basicConfig(filename='joeNWC_PY.log',level=logging.DEBUG) # DEBUG => print ALL msgs
clip = nwctxt.NWC2Clip()
PlayContext = nwctxt.NWC2PlayContext()
txtItemL = clip.Items
clipItemL = [nwctxt.NWC2ClipItem(txtItem) for txtItem in txtItemL]
first2 = clipItemL[:2]
reversedClipItemL = first2 + list(reversed(clipItemL[2:]))
reversedTextItemL = [item.ReconstructClipText() for item in reversedClipItemL]
print clip.GetClipHeader()
for textItem in reversedTextItemL[2:]:
#print "clipItem.GetObjType()= %s, type(clipItem.GetObjType())= %s, "%(clipItem.GetObjType(), type(clipItem.GetObjType()))
print textItem
print clip.GetClipFooter()
# TO DEBUG uncomment below to report to NWC STDOUT DIALOG & to CAUSE NO STAFF MODIFICATION
# sys.exit(nwctxt.NWC2RC_REPORT)