|
|
@ -46,7 +46,7 @@ class SongEditor(QtWidgets.QGraphicsScene): |
|
|
|
self.tracks = {} #TrackID:TrackStructures |
|
|
|
self.barlines = [] #in order |
|
|
|
self.cachedCombinedTrackHeight = 0 #set by callback_tracksChanged |
|
|
|
self.trackOrder = [] #set by callback_numberOfTracksChanged |
|
|
|
self.trackOrder = [] #contains engine-ids, set by callback_numberOfTracksChanged |
|
|
|
|
|
|
|
role = QtGui.QPalette.BrightText |
|
|
|
self.brightPen = QtGui.QPen(self.parentView.parentMainWindow.fPalBlue.color(role)) |
|
|
@ -520,6 +520,8 @@ class TrackLabelEditor(QtWidgets.QGraphicsScene): |
|
|
|
self.parentView = parentView |
|
|
|
self.tracks = {} #TrackID:TrackStructures |
|
|
|
|
|
|
|
self._cachedExportDictsInOrder = [] |
|
|
|
|
|
|
|
api.callbacks.numberOfTracksChanged.append(self.callback_numberOfTracksChanged) |
|
|
|
api.callbacks.trackMetaDataChanged.append(self.callback_trackMetaDataChanged) |
|
|
|
api.callbacks.exportCacheChanged.append(self.cacheExportDict) |
|
|
@ -532,9 +534,11 @@ class TrackLabelEditor(QtWidgets.QGraphicsScene): |
|
|
|
"""This is not for the initial track creation, only for later changes""" |
|
|
|
self.tracks[exportDict["id"]].update(exportDict) |
|
|
|
|
|
|
|
def callback_numberOfTracksChanged(self, exportDictList): |
|
|
|
def callback_numberOfTracksChanged(self, exportDictList): |
|
|
|
toDelete = set(self.tracks.keys()) |
|
|
|
|
|
|
|
self._cachedExportDictsInOrder = exportDictList |
|
|
|
|
|
|
|
width = self.parentView.geometry().width() |
|
|
|
|
|
|
|
for index, exportDict in enumerate(exportDictList): |
|
|
@ -596,14 +600,14 @@ class TrackLabelEditor(QtWidgets.QGraphicsScene): |
|
|
|
menu.addAction(a) |
|
|
|
a.triggered.connect(function) |
|
|
|
|
|
|
|
#Add a submenu for merge/copy |
|
|
|
#Add a submenu for merge/cop |
|
|
|
|
|
|
|
mergeMenu = menu.addMenu(QtCore.QCoreApplication.translate("TrackLabelContext", "Merge/Copy Measure-Structure from")) |
|
|
|
|
|
|
|
def createCopyMergeLambda(srcId): |
|
|
|
return lambda: api.trackMergeCopyFrom(srcId, exportDict["id"]) |
|
|
|
|
|
|
|
for track in self.tracks.values(): |
|
|
|
sourceDict = track.exportDict |
|
|
|
|
|
|
|
for sourceDict in self._cachedExportDictsInOrder: |
|
|
|
a = QtWidgets.QAction(sourceDict["sequencerInterface"]["name"], mergeMenu) |
|
|
|
mergeMenu.addAction(a) |
|
|
|
mergeCommand = createCopyMergeLambda(sourceDict["id"]) |
|
|
@ -617,8 +621,7 @@ class TrackLabelEditor(QtWidgets.QGraphicsScene): |
|
|
|
def replacePatternWithLambda(srcId): |
|
|
|
return lambda: api.trackPatternReplaceFrom(srcId, exportDict["id"]) |
|
|
|
|
|
|
|
for track in self.tracks.values(): |
|
|
|
sourceDict = track.exportDict |
|
|
|
for sourceDict in self._cachedExportDictsInOrder: |
|
|
|
a = QtWidgets.QAction(sourceDict["sequencerInterface"]["name"], copyMenu) |
|
|
|
copyMenu.addAction(a) |
|
|
|
mergeCommand = replacePatternWithLambda(sourceDict["id"]) |
|
|
|