diff options
4 files changed, 11 insertions, 16 deletions
| 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 - diff --git a/web-project/src/solo_tool_web.py b/web-project/src/solo_tool_web.py index 8e3b576..c0c3d04 100644 --- a/web-project/src/solo_tool_web.py +++ b/web-project/src/solo_tool_web.py @@ -20,13 +20,13 @@ def fileName(path: str) -> str:  def keyPointList(st: SoloTool) -> None:      with ui.list().props('separator'):          for kp in st.keyPoints: -            ui.item(f"{kp:0.2}", on_click=handlers.setKeyPoint(st, kp)).props('clickable v-ripple').classes('text-lg') +            ui.item(f"{kp:0.2}", on_click=handlers.keyPointAbsolute(st, kp)).props('clickable v-ripple').classes('text-lg')  @ui.refreshable  def songList(st: SoloTool, songDrawer) -> None:      with ui.list().props('separator'):          for i, path in enumerate(st.songs): -            ui.item(fileName(path), on_click=handlers.setSong(st, i, lambda: songDrawer.hide())).props('clickable v-ripple') +            ui.item(fileName(path), on_click=handlers.songAbsolute(st, i, lambda: songDrawer.hide())).props('clickable v-ripple')  sessions = {}  for f in glob(f"{SESSION_DIR}/*.json"): @@ -103,7 +103,7 @@ def sessionPage(sessionName: str):          ui.button(color='positive', on_click=handlers.playPause(st)).bind_icon_from(st, "playing", lambda playing: "pause" if playing else "play_arrow").props(f"size={buttonSize}").style('flex: 1')          ui.button(icon='vertical_align_bottom', on_click=handlers.positionToKeyPoint(st), color='negative').props(f"size={buttonSize}").style('flex: 2')          ui.button(icon='undo', on_click=st.jump, color='secondary').props(f"size={buttonSize}").style('flex: 2') -        ui.button(icon='skip_next', on_click=handlers.changeSong(st, 1)).props(f"size={buttonSize}").style('flex: 1') +        ui.button(icon='skip_next', on_click=handlers.songRelative(st, 1)).props(f"size={buttonSize}").style('flex: 1')      # Playback rate      with ui.row().classes('w-full justify-between no-wrap items-center'): | 
