Add Flet desktop client

This commit is contained in:
sarah committed 2026-10-08 23:25:41 +02:00
1 parent 16787aba14
commit 0eecfba224
18 files changed
+2588

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
#!/bin/bash
# Builds dist/SaraView-x86_64.AppImage: a PyInstaller one-file build (with
# the font and icon bundled) wrapped by appimagetool, the same way SaraSort's,
# SaraSuite's and SaraFem's AppImages are made. Needs appimagetool on PATH.
set -euo pipefail
cd "$(dirname "$(readlink -f "$0")")/.."
[ -d .venv ] || python3 -m venv .venv
.venv/bin/pip install --quiet --disable-pip-version-check -r requirements.txt pyinstaller
# --collect-data flet: without it ft.Icons crashes when frozen.
.venv/bin/pyinstaller --noconfirm --clean --log-level WARN \
--onefile --windowed --name SaraView --collect-data flet \
--add-data "$PWD/assets:assets" \
--distpath build/PyInstaller/dist --workpath build/PyInstaller/work --specpath build/PyInstaller \
"$PWD/Main.py"
AppDir=build/AppDir
rm -rf "$AppDir"
mkdir -p "$AppDir/usr/bin"
cp build/PyInstaller/dist/SaraView "$AppDir/usr/bin/SaraView"
ln -s usr/bin/SaraView "$AppDir/AppRun"
cp assets/Icon.png "$AppDir/SaraView.png"
ln -s SaraView.png "$AppDir/.DirIcon"
cat > "$AppDir/SaraView.desktop" << DESKTOP
[Desktop Entry]
Type=Application
Name=SaraView
Comment=View and edit files, locally or on a SaraView server
Exec=SaraView
Icon=SaraView
Terminal=false
Categories=Utility;
DESKTOP
mkdir -p dist
ARCH=x86_64 appimagetool --no-appstream "$AppDir" dist/SaraView-x86_64.AppImage
echo "Built dist/SaraView-x86_64.AppImage"
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
# Desktop-entry launcher: resolves the venv relative to this script rather
# than the caller's cwd, since .desktop Exec= lines are invoked with no
# guaranteed working directory.
cd "$(dirname "$(readlink -f "$0")")/.." || exit 1
exec .venv/bin/python Main.py "$@"
+37
View File
@@ -0,0 +1,37 @@
# Kept in sync between SaraSuite/Programs/SaraView/ and SaraView/Client/Packaging/SaraSuite/.
Name = "SaraView"
Description = "SaraView's desktop client: view and edit files in a local folder, or on a SaraView server."
[Source]
Git = "{GitHost}/SaraView"
# Only the Flet client; the server (Backend/, Frontend/) runs in Docker on SpineS.
Include = ["Client/*.py", "Client/requirements.txt", "Client/assets/**"]
Exclude = ["Client/Packaging"]
[Python]
RequirementsFile = "Client/requirements.txt"
[[Templates]]
Source = "Launch.sh"
Target = "{AppDir}/Client/Packaging/Launch.sh"
Executable = true
[[Templates]]
Source = "SaraView.desktop"
Target = "{ApplicationsDir}/SaraView.desktop"
# Made by SaraView itself: Config.toml and Session.toml (your saved login).
[[Leftovers]]
Path = "{ConfigDir}"
Kind = "Config"
Note = "SaraView's settings and saved server login"
[[Leftovers]]
Path = "{CacheHome}/SaraView"
Kind = "Runtime"
Note = "server files downloaded to open in other programs"
# Shared with the other Flet programs; see Programs/FletIdentity.py.
[[Templates]]
Source = "../../FletIdentity.py"
Target = "{ProgramDir}/FletIdentity.py"
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
# Written by SaraSuite. Runs from the client's folder so Flet finds assets/.
# A Flet client copy with the window app ID srhtnin.{Name}, so the desktop
# matches the window to {Name}.desktop (StartupWMClass) instead of showing it
# as "com.appveyor.flet". Empty if that fails: Flet then uses its own client.
export FLET_VIEW_PATH="$("{Python}" "{ProgramDir}/FletIdentity.py" "srhtnin.{Name}")"
cd "{AppDir}/Client" || exit 1
exec "{Python}" Main.py "$@"
@@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
Name=SaraView
Comment=View and edit files, locally or on a SaraView server
Exec={AppDir}/Client/Packaging/Launch.sh
Icon={AppDir}/Client/assets/Icon.png
Terminal=false
Categories=Utility;
StartupNotify=true
StartupWMClass=srhtnin.{Name}