From ebdf82d603befc24e13a061eaffa6dc183a72f14 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Wed, 26 Feb 2025 21:44:02 +0100 Subject: Improve web UI --- solo-tool-project/src/solo_tool/handlers.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'solo-tool-project/src/solo_tool/handlers.py') diff --git a/solo-tool-project/src/solo_tool/handlers.py b/solo-tool-project/src/solo_tool/handlers.py index ab7309e..0b38968 100644 --- a/solo-tool-project/src/solo_tool/handlers.py +++ b/solo-tool-project/src/solo_tool/handlers.py @@ -18,6 +18,14 @@ def changeSong(st: SoloTool, delta: int) -> Callable[[], None]: st.song += delta return f +def restartOrPreviousSong(st: SoloTool, threshold: float) -> Callable[[], None]: + def f(): + if st.position < threshold and st.song > 0: + st.song -= 1 + else: + st.position = 0.0 + return f + def setSong(st: SoloTool, index: int, followUp: Callable[[], None]=None) -> Callable[[], None]: def f(): st.song = index -- cgit v1.2.3