aboutsummaryrefslogtreecommitdiffstats
path: root/solo-tool-project/src/solo_tool/solo_tool.py
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2025-02-24 21:45:50 +0100
committerEddy Pedroni <epedroni@pm.me>2025-02-24 21:45:50 +0100
commit4b029ddcbccb75ef9aa129fa0d726fdee24af0bb (patch)
tree44377b7357df400a3eb969520f8992f481db1fb1 /solo-tool-project/src/solo_tool/solo_tool.py
parentb65d54e662c7f7bde6d0f1d6bb195e6e7cb96af8 (diff)
Improved key points notification
Diffstat (limited to 'solo-tool-project/src/solo_tool/solo_tool.py')
-rw-r--r--solo-tool-project/src/solo_tool/solo_tool.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/solo-tool-project/src/solo_tool/solo_tool.py b/solo-tool-project/src/solo_tool/solo_tool.py
index 0f47aef..199e2ad 100644
--- a/solo-tool-project/src/solo_tool/solo_tool.py
+++ b/solo-tool-project/src/solo_tool/solo_tool.py
@@ -16,8 +16,9 @@ class SoloTool:
self._song = index
path = self._songs[index]
self._player.setCurrentSong(path)
- self._notifier.notify(Notifier.CURRENT_SONG_EVENT, index)
self._keyPoint = 0.0
+ self._notifier.notify(Notifier.CURRENT_SONG_EVENT, index)
+ self._notifier.notify(Notifier.CURRENT_KEY_POINT_EVENT, index)
@staticmethod
def _keyPointValid(kp: float) -> bool:
@@ -49,13 +50,14 @@ class SoloTool:
def keyPoints(self) -> list[float]:
if self._song is None:
return None
- return self._keyPoints[self._song]
+ return self._keyPoints[self._song].copy()
@keyPoints.setter
def keyPoints(self, new: list[float]) -> None:
if new is not None and self._song is not None:
sanitized = sorted(list(set([p for p in new if SoloTool._keyPointValid(p)])))
self._keyPoints[self._song] = sanitized
+ self._notifier.notify(Notifier.KEY_POINTS_EVENT, sanitized.copy())
@property
def keyPoint(self) -> float:
@@ -127,3 +129,5 @@ class SoloTool:
def registerCurrentKeyPointCallback(self, callback):
self._notifier.registerCallback(Notifier.CURRENT_KEY_POINT_EVENT, callback)
+ def registerKeyPointsCallback(self, callback):
+ self._notifier.registerCallback(Notifier.KEY_POINTS_EVENT, callback)