self.currentKeySwitch:int=None# Midi pitch. Default is set on load.
self.playableKeys:tuple=None#sorted tuple of ints. set by _parseKeys through chooseVariant. Set of int pitches. Used for export.
self.keyLabels={60:"Middle C",53:"𝄢",67:"𝄞"}
defexportStatus(self)->dict:
"""The call-often function to get the instrument status. Includes only data that can
@ -141,6 +142,7 @@ class Instrument(object):
result["keySwitches"]=self.currentVariantKeySwitches[0]ifself.currentVariantKeySwitcheselse{}#Internally this is a tuple with [0] being a dict: Unordered!! dict with midiPitch: (opcode, label). You need the opcode to see if it is a momentary switch or permanent.
mMidipitch=re.match("\d+",label)andnotlabel[1]=="'"andnotlabel[2]=="'"# 8' or 16' organs begin with a number as well. We sadly can't check for a space after the number so we have to check for the foot symbol
ifmMidipitchandnotlabel[1]=="'"andnotlabel[2]=="'":# 8' or 16' organs begin with a number as well. We sadly can't check for a space after the number so we have to check for the foot symbol: #could be None
label=label[mMidipitch.span()[1]:].lstrip()#remove number and potential leading space
elifmNotename:
label=label[mNotename.span()[1]:].lstrip()#remove notenames like C#6 and potential leading space
@ -375,7 +377,6 @@ class Instrument(object):
findPlayableKeys(k3AsDict,allKeys)
findKS(k3AsDict,result,others)
self.playableKeys=tuple(sorted(allKeys))
logger.info(f"Finished parsing possible keyswitches in the current variant/cbox-program for {self.name}{self.currentVariant}. Found: {len(result)} keyswitches.")
@ -102,7 +102,7 @@ class _HorizontalPianoScene(QtWidgets.QGraphicsScene):
numberX=x+4
else:
numberX=x
key.setPos(x,HEIGHT*-0.66)
key.setPos(x,HEIGHT*-0.7)
key.setZValue(4)
else:
key=WhiteKey(self,i)
@ -181,6 +181,10 @@ class _HorizontalPianoScene(QtWidgets.QGraphicsScene):
self.fakeDeactivationOverlay.hide()
forkeyPitch,keyObjectinself.allKeys.items():
ifkeyPitchininstrumentStatus["keyLabels"]:
self.numberLabels[keyPitch].setLabel(instrumentStatus["keyLabels"][keyPitch])#can be overwritten by keyswitch label. otherwise on any key, no matter if deactivated or not
@ -188,6 +188,8 @@ class _VerticalPianoScene(QtWidgets.QGraphicsScene):
#self.numberLabels[keyPitch].show()
keyObject.show()
ifkeyPitchininstrumentStatus["keyLabels"]:
self.numberLabels[keyPitch].setLabel(instrumentStatus["keyLabels"][keyPitch])#can be overwritten by keyswitch label. otherwise on any key, no matter if deactivated or not