From f8e545b95db72b04cad2c77e86e9d1e03c848c73 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Thu, 27 Feb 2025 13:35:05 +0100 Subject: Save button, accessible fullscreen button --- web-project/src/solo_tool_web.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'web-project/src') diff --git a/web-project/src/solo_tool_web.py b/web-project/src/solo_tool_web.py index 4e8f76d..a3143c5 100644 --- a/web-project/src/solo_tool_web.py +++ b/web-project/src/solo_tool_web.py @@ -3,7 +3,7 @@ from os.path import basename, splitext from nicegui import ui from solo_tool import SoloTool -from solo_tool.session_manager import loadSession +from solo_tool.session_manager import loadSession, saveSession from solo_tool import handlers from solo_tool.midi_controller_launchpad_mini import MidiController @@ -28,6 +28,9 @@ for f in glob(f"{SESSION_DIR}/*.json"): @ui.page('/{sessionName}') def sessionPage(sessionName: str): + if sessionName not in sessions: + return + fullscreen = ui.fullscreen() ui.dark_mode().enable() ui.colors(secondary='#ffc107') @@ -36,9 +39,14 @@ def sessionPage(sessionName: str): st = sessions[sessionName] # Header - with ui.header().classes('items-center'): - ui.button(icon='menu', on_click=lambda: song_drawer.toggle()).props('flat round dense color=white') - ui.label().bind_text_from(st, 'song', lambda index: fileName(st.songs[index]) if index is not None else "Select a song").classes('text-lg') + with ui.header().classes('items-center justify-between'): + with ui.row().classes('items-center justify-start'): + ui.button(icon='menu', on_click=lambda: song_drawer.toggle()).props('flat round dense color=white') + ui.label().bind_text_from(st, 'song', lambda index: fileName(st.songs[index]) if index is not None else "Select a song").classes('text-lg') + with ui.row().classes('items-center justify-start'): + def save(): saveSession(st, f"{SESSION_DIR}/{sessionName}.json") + ui.button(icon='save', on_click=save).props('flat dense round color=white') + ui.button(icon='fullscreen', on_click=fullscreen.toggle).props('flat dense round color=white') # Key points list with ui.right_drawer(top_corner=True, bottom_corner=True).props('width=120 behavior=desktop'): @@ -53,6 +61,7 @@ def sessionPage(sessionName: str): with ui.list().props('separator'): for i, path in enumerate(st.songs): ui.item(fileName(path), on_click=handlers.setSong(st, i, lambda: song_drawer.hide())).props('clickable v-ripple') + ui.button(icon='add', on_click=lambda e: print(e)).props('flat round dense color=white') # Playback position def setPosition(e) -> None: st.position = e.args @@ -83,8 +92,6 @@ def sessionPage(sessionName: str): volumeLabels = ",".join([f"{v}:'{int(v*100)}%'" for v in [0.0, 0.25, 0.5, 0.75, 1.0, 1.25]]) ui.slider(min=0, max=1.25, step=0.01).bind_value(st, 'volume').props(f':marker-labels="{{{volumeLabels}}}"').classes('q-px-md') - ui.button(icon='fullscreen', on_click=fullscreen.toggle).props('outline') - @ui.page('/') def landingPage(): ui.dark_mode().enable() -- cgit v1.2.3