@ -225,7 +225,7 @@ class MainWindow(TemplateMainWindow):
#There is always a track. Forcing that to be active is better than having to hide all the pattern widgets, or to disable them.
#However, we need the engine to be ready.
#Now in 2021-12-13 this is still necessary because of regressions! Eventhough the API sends a current track on startup as convenience for the GUI and hardware controllers
self.chooseCurrentTrack(api.session.data.tracks[0].export())#By Grabthar's hammer, by the suns of Worvan, what a hack!
self.chooseCurrentTrack(api.session.data.tracks[0].export(),sendChangeToApi=False)#By Grabthar's hammer, by the suns of Worvan, what a hack!
"""This is in mainWindow because we need access to different sections of the program.
newCurrentTrackisabackendtrackID
@ -259,7 +259,6 @@ class MainWindow(TemplateMainWindow):
"""
ifself._blockCurrentTrackSignal:
return
self._blockCurrentTrackSignal=True
newCurrentTrackId=exportDict["id"]
@ -282,20 +281,22 @@ class MainWindow(TemplateMainWindow):
#Functions depend on getting set after getting called. They need to know the old track!
self.currentTrackId=newCurrentTrackId
ifsendChangeToApi:
self._blockCurrentTrackSignal=True
api.changeCurrentTrack(newCurrentTrackId)
self._blockCurrentTrackSignal=False
api.changeCurrentTrack(newCurrentTrackId)
self._blockCurrentTrackSignal=False
defaddPatternTrack(self):
"""Add a new track and initialize it with some data from the current one"""
scale=api.session.data.trackById(self.currentTrackId).pattern.scale#TODO: Access to the sessions data structure directly instead of api. Not good. Getter function or api @property is cleaner.
ifevent.button()==QtCore.Qt.LeftButton:#Create a switch or continue to hold down mouse button and drag to draw -> mouseMoveEvent
assertnotself._mousePressOn
position=self.scenePos2switchPosition(event.scenePos().x())#measure number 0 based
@ -539,7 +539,7 @@ class TrackStructure(QtWidgets.QGraphicsRectItem):
self._highlightSwitch.show()
self.statusMessage(QtCore.QCoreApplication.translate("Statusbar","Empty Measure: Left click to activate. Middle click to show as shadows in current pattern. Right click for measure group options."))#Yes, this is the track. Empty measures are not objects.
#This seemed to be a good idea but horrible UX. If you move the mouse down to edit a pattern you end up choosing the last track