Browse Source

add button with new track to track editor

master
Nils 2 years ago
parent
commit
43b7a2eee7
  1. 2
      qtgui/designer/trackWidget.py
  2. 16
      qtgui/trackEditor.py

2
qtgui/designer/trackWidget.py

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'trackWidget.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.

16
qtgui/trackEditor.py

@ -39,7 +39,7 @@ import engine.api as api
class TrackWidget(QtWidgets.QGroupBox):
#TODO: ideas: number of blocks, which CCs are set, review/change durationSettingsSignature, dynamicSettingsSignature
#TODO: ideas: number of blocks, list of block names which CCs are set, review/change durationSettingsSignature, dynamicSettingsSignature
def __init__(self, parentDataEditor, trackExportObject):
super().__init__()
self.parentDataEditor = parentDataEditor
@ -318,6 +318,11 @@ class TrackEditor(QtWidgets.QWidget):
api.callbacks.tracksChangedIncludingHidden.append(self.updateTrackWidgets)
self.tracks = {} #id:trackWidget. As any dict, not in order
#Add Track Button
self.addTrackButton = QtWidgets.QPushButton("add track placeholder text")
self.addTrackButton.clicked.connect(api.newEmptyTrack)
self.layout.addWidget(self.addTrackButton)
#Upbeat Tick Widget and Action-Button
allUpbeats = QtWidgets.QWidget()
allUpbeatsLayout = QtWidgets.QHBoxLayout()
@ -327,18 +332,18 @@ class TrackEditor(QtWidgets.QWidget):
self.allUpbeatsCombinedTickWidget = CombinedTickWidget(mainWindow)
allUpbeatsPushButton = QtWidgets.QPushButton(translate("trackEditorPythonFile", "set all upbeats"))
allUpbeatsPushButton = QtWidgets.QPushButton(translate("trackEditorPythonFile", "Set all Upbeats"))
allUpbeatsPushButton.clicked.connect(self.setAllUpbeats) #gets the value itself
allUpbeatsLayout.addWidget(self.allUpbeatsCombinedTickWidget)
allUpbeatsLayout.addWidget(allUpbeatsPushButton)
#Reset all Advanced Views
foldAllAdvanvced = QtWidgets.QPushButton(translate("trackEditorPythonFile", "fold all advanced"))
foldAllAdvanvced = QtWidgets.QPushButton(translate("trackEditorPythonFile", "Fold all Advanced"))
foldAllAdvanvced.clicked.connect(self.foldAllAdvanvced)
allUpbeatsLayout.addWidget(foldAllAdvanvced)
unfoldAllAdvanvced = QtWidgets.QPushButton(translate("trackEditorPythonFile", "unfold all advanced"))
unfoldAllAdvanvced = QtWidgets.QPushButton(translate("trackEditorPythonFile", "Unfold all Advanced"))
unfoldAllAdvanvced.clicked.connect(self.unfoldAllAdvanced)
allUpbeatsLayout.addWidget(unfoldAllAdvanvced)
@ -371,6 +376,9 @@ class TrackEditor(QtWidgets.QWidget):
if trackExportObject["hiddenPosition"] is None:
visibleTracks.append(trackExportObject)
numberOfTracks = trackExportObject["index"]+1
self.addTrackButton.setText(translate("trackEditorPythonFile", "Add new Track (currently: ") + str(numberOfTracks) + ")")
for trId in leftOver: #track still exist here but not in the backend. Delete.
w = self.tracks[trId]
del self.tracks[trId]

Loading…
Cancel
Save