Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/workflows/build-windows-executable-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
- name: Create .bat file
run: |
echo '@echo off' > ${{ env.APP_NAME }}.bat
echo 'setlocal EnableDelayedExpansion' > ${{ env.APP_NAME }}.bat
echo 'setlocal EnableDelayedExpansion' >> ${{ env.APP_NAME }}.bat
echo '' >> ${{ env.APP_NAME }}.bat
echo 'REM Set OpenMS data path for TOPP tools' >> ${{ env.APP_NAME }}.bat
echo 'set OPENMS_DATA_PATH=%~dp0share\OpenMS' >> ${{ env.APP_NAME }}.bat
Expand All @@ -96,7 +96,8 @@ jobs:
echo 'REM Create credentials.toml with empty email to disable email prompt' >> ${{ env.APP_NAME }}.bat
echo 'copy /Y ".streamlit\credentials.toml" "%USERPROFILE%\.streamlit\credentials.toml" > nul' >> ${{ env.APP_NAME }}.bat
echo '' >> ${{ env.APP_NAME }}.bat
echo 'start /min .\python-${{ env.PYTHON_VERSION }}\python -m streamlit run app.py local' >> ${{ env.APP_NAME }}.bat
echo 'REM Launch using CLI with any passed arguments (supports: toppview-lite file.mzML)' >> ${{ env.APP_NAME }}.bat
echo '.\python-${{ env.PYTHON_VERSION }}\python cli.py %*' >> ${{ env.APP_NAME }}.bat

- name: Create All-in-one executable folder
run: |
Expand All @@ -110,6 +111,7 @@ jobs:
cp -r example-data streamlit_exe
cp -r .streamlit streamlit_exe
cp app.py streamlit_exe
cp cli.py streamlit_exe
cp settings.json streamlit_exe
cp default-parameters.json streamlit_exe
cp ${{ env.APP_NAME }}.bat streamlit_exe
Expand All @@ -124,6 +126,14 @@ jobs:
1. Navigate to the installation directory.
2. Double-click on the file: ${{ env.APP_NAME }}.bat or ${{ env.APP_NAME }} shortcut.

Command Line Usage:
- Open a file directly: ${{ env.APP_NAME }}.bat path/to/file.mzML
- Check server status: ${{ env.APP_NAME }}.bat --status
- Stop background server: ${{ env.APP_NAME }}.bat --stop

The application runs a background server for fast file loading.
After the first startup, opening new files is nearly instant.

Additional Information:
- If multiple Streamlit apps are running, you can change the port in the .streamlit/config.toml file.
Example:
Expand Down Expand Up @@ -195,6 +205,7 @@ jobs:
<ComponentRef Id="CreateAppFolder" />
<ComponentRef Id="DesktopShortcutComponent" />
<ComponentRef Id="InstallDirShortcutComponent" />
<ComponentRef Id="FileAssociationComponent" />
</Feature>

<!-- Create shortcut for running app on desktop -->
Expand All @@ -209,6 +220,16 @@ jobs:
<RegistryValue Root="HKCU" Key="Software\\OpenMS\\${{ env.APP_NAME }}" Name="InstallFolderShortcut" Type="integer" Value="1" KeyPath="yes" />
</Component>

<!-- File association for .mzML files -->
<Component Id="FileAssociationComponent" Guid="d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90" Directory="AppSubFolder">
<RegistryValue Root="HKCU" Key="Software\\OpenMS\\${{ env.APP_NAME }}" Name="FileAssociation" Type="integer" Value="1" KeyPath="yes" />
<ProgId Id="TOPPViewLite.mzML" Description="mzML Mass Spectrometry File" Icon="AppIcon">
<Extension Id="mzML" ContentType="application/x-mzml">
<Verb Id="open" Command="Open with ${{ env.APP_NAME }}" TargetFile="[AppSubFolder]${{ env.APP_NAME }}.bat" Argument="&quot;%1&quot;" />
</Extension>
</ProgId>
</Component>

<!-- Provide icon here; it should exist in the SourceDir folder -->
<Icon Id="AppIcon" SourceFile="SourceDir/openms.ico" />

Expand Down
12 changes: 10 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@
st.session_state.settings = json.load(f)

if __name__ == '__main__':
# Check if a file is being loaded via CLI (load_file query parameter)
# If so, redirect directly to the viewer page
load_file = st.query_params.get("load_file")
if load_file:
default_page = Path("content", "viewer.py")
else:
default_page = Path("content", "welcome.py")

pages = {
str(st.session_state.settings["app-name"]): [
st.Page(Path("content", "welcome.py"), title="Welcome", icon="👋", default=True),
st.Page(Path("content", "welcome.py"), title="Welcome", icon="👋", default=(not load_file)),
st.Page(Path("content", "upload.py"), title="Upload", icon="📂"),
st.Page(Path("content", "viewer.py"), title="Viewer", icon="👀"),
st.Page(Path("content", "viewer.py"), title="Viewer", icon="👀", default=bool(load_file)),
],
}

Expand Down
Loading
Loading