From 818859c4562a5f9fef4e74964ca31e4381ce6995 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sat, 1 Mar 2025 08:30:05 +0100 Subject: Improve naming, clean up imports --- solo-tool-project/src/solo_tool/handlers.py | 8 ++++---- solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py | 8 ++++---- solo-tool-project/test/solo_tool_integrationtest.py | 5 ----- 3 files changed, 8 insertions(+), 13 deletions(-) (limited to 'solo-tool-project') diff --git a/solo-tool-project/src/solo_tool/handlers.py b/solo-tool-project/src/solo_tool/handlers.py index 0b38968..b178b3a 100644 --- a/solo-tool-project/src/solo_tool/handlers.py +++ b/solo-tool-project/src/solo_tool/handlers.py @@ -10,7 +10,7 @@ def playPause(st: SoloTool) -> Callable[[], None]: st.play() return f -def changeSong(st: SoloTool, delta: int) -> Callable[[], None]: +def songRelative(st: SoloTool, delta: int) -> Callable[[], None]: def f(): if st.song is None: st.song = 0 @@ -26,7 +26,7 @@ def restartOrPreviousSong(st: SoloTool, threshold: float) -> Callable[[], None]: st.position = 0.0 return f -def setSong(st: SoloTool, index: int, followUp: Callable[[], None]=None) -> Callable[[], None]: +def songAbsolute(st: SoloTool, index: int, followUp: Callable[[], None]=None) -> Callable[[], None]: def f(): st.song = index if followUp is not None: @@ -48,12 +48,12 @@ def positionToKeyPoint(st: SoloTool) -> Callable[[], None]: st.keyPoint = st.position return f -def setKeyPoint(st: SoloTool, kp: float) -> Callable[[], None]: +def keyPointAbsolute(st: SoloTool, kp: float) -> Callable[[], None]: def f(): st.keyPoint = kp return f -def changeKeyPoint(st: SoloTool, delta: int) -> Callable[[], None]: +def keyPointRelative(st: SoloTool, delta: int) -> Callable[[], None]: from bisect import bisect_right, bisect_left def f(): if delta > 0: diff --git a/solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py b/solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py index 08d55cd..625e2ef 100644 --- a/solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py +++ b/solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py @@ -35,17 +35,17 @@ class MidiController: 96 : handlers.seekAbsolute(self._soloTool, 0.0), 114 : self._soloTool.jump, 112 : handlers.playPause(self._soloTool), - 118 : handlers.changeKeyPoint(self._soloTool, -1), - 119 : handlers.changeKeyPoint(self._soloTool, 1), + 118 : handlers.keyPointRelative(self._soloTool, -1), + 119 : handlers.keyPointRelative(self._soloTool, 1), 117 : handlers.positionToKeyPoint(self._soloTool), - 48 : handlers.changeSong(self._soloTool, -1), + 48 : handlers.songRelative(self._soloTool, -1), 49 : handlers.seekRelative(self._soloTool, -0.25), 50 : handlers.seekRelative(self._soloTool, -0.05), 51 : handlers.seekRelative(self._soloTool, -0.01), 52 : handlers.seekRelative(self._soloTool, 0.01), 53 : handlers.seekRelative(self._soloTool, 0.05), 54 : handlers.seekRelative(self._soloTool, 0.25), - 55 : handlers.changeSong(self._soloTool, 1), + 55 : handlers.songRelative(self._soloTool, 1), } for i in range(0, 8): diff --git a/solo-tool-project/test/solo_tool_integrationtest.py b/solo-tool-project/test/solo_tool_integrationtest.py index 5d8f14c..7b274a3 100644 --- a/solo-tool-project/test/solo_tool_integrationtest.py +++ b/solo-tool-project/test/solo_tool_integrationtest.py @@ -1,7 +1,3 @@ -import pathlib -import shutil -import pytest - from fixtures import soloTool as uut, songPool, mockPlayer, testSongs def test_playerControls(uut, mockPlayer): @@ -156,4 +152,3 @@ def test_playbackRateNotification(uut, mockPlayer, testSongs): uut.rate = 0.5 assert not called - -- cgit v1.2.3