Browse Source

Remove old code that did apparently nothing than crash. Regressions here we come :)

master
Nils 4 years ago
parent
commit
f559adf181
  1. 2
      engine/api.py
  2. 1
      engine/pattern.py
  3. 10
      qtgui/mainwindow.py
  4. 11
      qtgui/pattern_grid.py

2
engine/api.py

@ -193,6 +193,7 @@ def startEngine(nsmClient):
#Send initial Callbacks to create the first GUI state.
#The order of initial callbacks must not change to avoid GUI problems.
#For example it is important that the tracks get created first and only then the number of measures
logger.info("Sending initial callbacks to GUI")
callbacks._numberOfTracksChanged()
callbacks._timeSignatureChanged()
callbacks._numberOfMeasuresChanged()
@ -205,6 +206,7 @@ def startEngine(nsmClient):
session.data.buildAllTracks(buildSongDuration=True) #will set to max track length, we always have a song duration.
updatePlayback()
logger.info("Patroneo api startEngine complete")
def _loopOff():

1
engine/pattern.py

@ -61,6 +61,7 @@ class Pattern(object):
self.scale = scale if scale else (72, 71, 69, 67, 65, 64, 62, 60) #Scale needs to be set first because on init/load data already depends on it, at least the default scale. The scale is part of the track meta callback.
self.data = data if data else list() #For content see docstring. this cannot be the default parameter because we would set the same list for all instances.
self.simpleNoteNames = simpleNoteNames if simpleNoteNames else self.parentTrack.parentData.lastUsedNotenames[:] #This is mostly for the GUI or other kinds of representation instead midi notes
assert self.simpleNoteNames
self._processAfterInit()
def _prepareBeforeInit(self):

10
qtgui/mainwindow.py

@ -157,9 +157,6 @@ class MainWindow(TemplateMainWindow):
#Toolbar, which needs the widgets above already established
self._populateToolbar()
#MainWindow Callbacks
api.callbacks.numberOfTracksChanged.append(self.callback_numberOfTracksChanged)
self.currentTrackId = None #this is purely a GUI construct. the engine does not know a current track. On startup there is no active track
self.start() #This shows the GUI, or not, depends on the NSM gui save setting. We need to call that after the menu, otherwise the about dialog will block and then we get new menu entries, which looks strange.
#There is always a track. Forcing that to be active is better than having to hide all the pattern widgets, or to disable them.
@ -174,13 +171,6 @@ class MainWindow(TemplateMainWindow):
self.nsmClient.announceSaveStatus(isClean = True)
def callback_numberOfTracksChanged(self, exportDictList):
"""We need to find out of the current track was the deleted one or if a new track got added
automatically."""
#if self.programStarted and len(exportDictList) == 1:
if len(exportDictList) == 1:
self.chooseCurrentTrack(exportDictList[0])
def chooseCurrentTrack(self, exportDict):
"""This is in mainWindow because we need access to different sections of the program.
newCurrentTrack is a backend track ID

11
qtgui/pattern_grid.py

@ -614,7 +614,7 @@ class Scale(QtWidgets.QGraphicsRectItem):
super().__init__(0,0,0,0)
self.parentScene = parentScene
self.pitchWidgets = [] #sorted from top to bottom in Step Rect and scene coordinates
self.simpleNoteNames = [] #list of 128 notes. use index with note name. Can be changed at runtime.
self.simpleNoteNames = None #list of 128 notes. use index with note name. Can be changed at runtime. Never empty.
api.callbacks.trackMetaDataChanged.append(self.callback_trackMetaDataChanged)
self.buildScale() #also sets the positions of the buttons above
@ -802,12 +802,13 @@ class PitchWidget(QtWidgets.QGraphicsProxyWidget):
def midiToNotename(self, midipitch):
assert self.parentItem.simpleNoteNames, self.parentItem.simpleNoteNames
assert self.parentItem.simpleNoteNames, (self.parentItem, self.parentItem.simpleNoteNames)
try:
return self.parentItem.simpleNoteNames[midipitch] #includes octave names
except IndexError:
print (midipitch)
print (self.parentItem.simpleNoteNames)
except IndexError as e:
print (e)
print ("Midipitch:", midipitch)
print ("Simple Notename:", self.parentItem.simpleNoteNames)
exit()
def spinBoxValueChanged(self):

Loading…
Cancel
Save