From 60fb2acc982892746dbe584cbe36d0055890bc8a Mon Sep 17 00:00:00 2001 From: Nils <> Date: Fri, 20 Mar 2020 23:17:01 +0100 Subject: [PATCH] Send save status to nsm --- engine/api.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/engine/api.py b/engine/api.py index 43783eb..3333f05 100644 --- a/engine/api.py +++ b/engine/api.py @@ -46,17 +46,18 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks export = None for func in self.quarterNotesPerMinuteChanged: func(export) + callbacks._dataChanged() def _setPlaybackTicks(self): #Differs from the template because it has subdivisions. ppqn = cbox.Transport.status().pos_ppqn * session.data.subdivisions status = playbackStatus() for func in self.setPlaybackTicks: - func(ppqn, status) + func(ppqn, status) def _loopChanged(self, measurenumber, loopStart, loopEnd): export = measurenumber for func in self.loopChanged: - func(export) + func(export) def _timeSignatureChanged(self): nr = session.data.howManyUnits @@ -69,6 +70,7 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks self._patternChanged(track) self._subdivisionsChanged() #update subdivisions. We do not include them in the score or track export on purpose. + callbacks._dataChanged() def _subdivisionsChanged(self): """Subdivisions are tricky, therefore we keep them isolated in their own callback. @@ -93,6 +95,8 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks export = session.data.subdivisions for func in self.subdivisionsChanged: func(export) + callbacks._dataChanged() + def _scoreChanged(self): """This includes the time signature as well, but is not send on a timesig change. @@ -103,6 +107,7 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks export = session.data.export() for func in self.scoreChanged: func(export) + callbacks._dataChanged() def _exportCacheChanged(self, track): """Send the export cache for GUI caching reasons. Don't react by redrawing immediately! @@ -113,7 +118,7 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks and stepChanged.""" export = track.export() for func in self.exportCacheChanged: - func(export) + func(export) def _patternChanged(self, track): """each track has only one pattern. We can identify the pattern by track and vice versa. @@ -125,6 +130,7 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks self._exportCacheChanged(track) for func in self.patternChanged: func(export) + callbacks._dataChanged() def _stepChanged(self, track, stepDict): """A simple GUI will most like not listen to that callback since they @@ -135,12 +141,14 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks self._exportCacheChanged(track) for func in self.stepChanged: func(stepDict) + callbacks._dataChanged() def _removeStep(self, track, index, pitch): """Opposite of _stepChanged""" self._exportCacheChanged(track) for func in self.stepChanged: func(index, pitch) + callbacks._dataChanged() def _trackStructureChanged(self, track): """update one track structure. Does not export cbox. @@ -148,6 +156,7 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks export = track.export() for func in self.trackStructureChanged: func(export) + callbacks._dataChanged() def _trackMetaDataChanged(self, track): """a low cost function that should not trigger anything costly to redraw @@ -155,13 +164,13 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks export = track.export() for func in self.trackMetaDataChanged: func(export) + callbacks._dataChanged() def _numberOfMeasuresChanged(self): export = session.data.export() for func in self.numberOfMeasuresChanged: func(export) - - + callbacks._dataChanged() #Inject our derived Callbacks into the parent module