Browse Source

Add audible to track properties

master
Nils 6 years ago
parent
commit
9e388fcbd5
  1. 11
      engine/api.py
  2. 1
      engine/track.py
  3. 9
      qtgui/designer/trackWidget.py
  4. 10
      qtgui/designer/trackWidget.ui
  5. 6
      qtgui/trackEditor.py

11
engine/api.py

@ -176,7 +176,7 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks
self._dataChanged()
def _tracksChanged(self):
"""Track deleted, added or moved. Or toggled double/non-double.
"""Track deleted, added or moved. Or toggled double/non-double, visible, eudible etc.
This callback is relatively cheap because it does not generate
any item data."""
#TODO: does NOT call template.api._numberOfTracksChanged
@ -583,6 +583,15 @@ def unhideTrack(trId):
callbacks._updateTrack(trId)
#the cursor is uneffected
def trackAudible(trId, state:bool):
"""
Send midi notes or not. CCs and instrument changes are unaffected.
Not managed by undo/redo.
Does not need updateTrack. There is no new midi data to generate. cbox handles mute on its own"""
trackObject = session.data.trackById(trId)
trackObject.sequencerInterface.enable(state)
callbacks._tracksChanged() #even if there is no change the GUI needs to be notified to redraw its checkboxes that may have been enabled GUI-side.
def listOfTrackIds():
return session.data.listOfTrackIds()

1
engine/track.py

@ -903,6 +903,7 @@ class Track(object):
"index" : self.state.index(),
"upbeatInTicks": int(self.upbeatInTicks),
"double" : self.double,
"audible" : self.sequencerInterface.enabled,
"initialMidiChannel" : self.initialMidiChannel,
"initialMidiProgram" : self.initialMidiProgram,
"initialMidiBankMsb" : self.initialMidiBankMsb,

9
qtgui/designer/trackWidget.py

@ -2,12 +2,13 @@
# Form implementation generated from reading ui file 'trackWidget.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
# Created by: PyQt5 UI code generator 5.12.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_trackGroupWidget(object):
def setupUi(self, trackGroupWidget):
trackGroupWidget.setObjectName("trackGroupWidget")
@ -66,6 +67,10 @@ class Ui_trackGroupWidget(object):
self.doubleTrackCheckbox = QtWidgets.QCheckBox(self.track)
self.doubleTrackCheckbox.setObjectName("doubleTrackCheckbox")
self.horizontalLayout.addWidget(self.doubleTrackCheckbox)
self.audibleCheckbox = QtWidgets.QCheckBox(self.track)
self.audibleCheckbox.setChecked(True)
self.audibleCheckbox.setObjectName("audibleCheckbox")
self.horizontalLayout.addWidget(self.audibleCheckbox)
self.visibleCheckbox = QtWidgets.QCheckBox(self.track)
self.visibleCheckbox.setChecked(True)
self.visibleCheckbox.setObjectName("visibleCheckbox")
@ -446,6 +451,7 @@ class Ui_trackGroupWidget(object):
self.upbeatSpinBox.setSuffix(_translate("trackGroupWidget", " Upbeat Ticks"))
self.callTickWidget.setText(_translate("trackGroupWidget", "𝅘𝅥𝅮 "))
self.doubleTrackCheckbox.setText(_translate("trackGroupWidget", "Double Track"))
self.audibleCheckbox.setText(_translate("trackGroupWidget", "Audible"))
self.visibleCheckbox.setText(_translate("trackGroupWidget", "Visible"))
self.midiChannelSpinBox.setPrefix(_translate("trackGroupWidget", "Channel "))
self.ccChannelsPushButton.setText(_translate("trackGroupWidget", "CC Channels"))
@ -489,3 +495,4 @@ class Ui_trackGroupWidget(object):
self.buttonResetDynamics.setText(_translate("trackGroupWidget", "Reset to Default Dynamic Values"))
self.advancedContent.setTabText(self.advancedContent.indexOf(self.tab_2), _translate("trackGroupWidget", "Dynamic Signature Definitions"))

10
qtgui/designer/trackWidget.ui

@ -156,6 +156,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="audibleCheckbox">
<property name="text">
<string>Audible</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="visibleCheckbox">
<property name="text">

6
qtgui/trackEditor.py

@ -44,6 +44,7 @@ class TrackWidget(QtWidgets.QGroupBox):
self.trackExportObject = trackExportObject #updated on every self.updateData
self.ui.visibleCheckbox.clicked.connect(self.visibleToggled) #only user changes, not through setChecked()
self.ui.audibleCheckbox.clicked.connect(self.audibleToggled) #only user changes, not through setChecked()
self.ui.doubleTrackCheckbox.clicked.connect(self.doubleTrackToggled) #only user changes, not through setChecked()
#self.ui.upbeatSpinBox.editingFinished.connect(self.upbeatChanged) #only user changes, not through setText() etc.
self.ui.upbeatSpinBox.valueChanged.connect(self.upbeatChanged) #also through the tickWidget
@ -130,6 +131,10 @@ class TrackWidget(QtWidgets.QGroupBox):
api.unhideTrack(self.trackExportObject["id"])
else:
api.hideTrack(self.trackExportObject["id"])
def audibleToggled(self, signal):
assert signal == bool(self.ui.audibleCheckbox.checkState())
api.trackAudible(self.trackExportObject["id"], signal)
def doubleTrackToggled(self, signal):
api.setDoubleTrack(self.trackExportObject["id"], signal)
@ -284,6 +289,7 @@ class TrackWidget(QtWidgets.QGroupBox):
self.ui.deleteButton.setEnabled(False) #You cannot delete hidden tracks. see api.deleteTrack
self.ui.doubleTrackCheckbox.setChecked(trackExportObject["double"])
self.ui.audibleCheckbox.setChecked(trackExportObject["audible"])
for i in range(0,16): #without 16
self.ccChannels[i].setChecked(i in trackExportObject["ccChannels"]) #a checkbox widget

Loading…
Cancel
Save