Browse Source

Switch to new track in the gui, after insert

master
Nils 3 years ago
parent
commit
8505135071
  1. 1
      engine/api.py
  2. 6
      qtgui/mainwindow.py

1
engine/api.py

@ -533,6 +533,7 @@ def addTrack(scale=None):
session.history.register(lambda trId=trackId: deleteTrack(trId), descriptionString="Add Track")
session.data.sortTracks() #in place sorting for groups
callbacks._numberOfTracksChanged()
return trackId
def createSiblingTrack(trackId): #aka clone track
"""Create a new track with scale, color and jack midi out the same as the given track.

6
qtgui/mainwindow.py

@ -265,10 +265,14 @@ class MainWindow(TemplateMainWindow):
#Functions depend on getting set after getting called. They need to know the old track!
self.currentTrackId = newCurrentTrackId
self.songEditor.parentView.centerOn(d[newCurrentTrackId])
def addPatternTrack(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.
api.addTrack(scale)
newTrackId = api.addTrack(scale)
self.chooseCurrentTrack(self.songEditor.tracks[newTrackId].exportDict)
def cloneSelectedTrack(self):
"""Add a new track via the template option. This is the best track add function"""

Loading…
Cancel
Save