Add install.sh / run.sh / bundled icon; fully pin requirements

- install.sh: one-time Linux Mint setup (apt, .venv, requirements, .desktop
  entry with absolute paths). Re-runnable.
- run.sh: launches the app from .venv (called by the menu entry).
- icon.png: bundled 256px red-cross launcher/window icon; app prefers it over
  the runtime-drawn fallback (data/icon.png).
- requirements.txt: fully pinned incl. transitive deps, tested on Python 3.12;
  numpy held at 2.2.6 so it installs on Python 3.10 too.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-07 22:16:52 +02:00
parent 1bed723363
commit 08232bda9b
10 changed files with 173 additions and 129 deletions
+52 -97
View File
@@ -1,116 +1,63 @@
# Setup & running
Target machine: **Linux Mint laptop**, single non-technical user. The goal is
that day-to-day use is a **double-click**, with the terminal only needed once
during install.
Target machine: **Linux Mint laptop**, single non-technical user. Day-to-day use
is a **double-click from the menu**; the terminal is needed once, for install.
## 1. System packages
Tkinter is not bundled with the system Python on Mint and must be installed
separately. `git` is needed for the in-app updater:
```bash
sudo apt update
sudo apt install python3-tk python3-venv python3-pip git
```
## 2. Get the code
**Clone it** (don't download a zip) the in-app "Nach Update suchen" only works
from a git clone:
## Quick install (Linux Mint)
```bash
mkdir -p ~/Apps && cd ~/Apps
git clone <repo-url> DRK_Blutspende_Orte
git clone https://git.plutodev.de/Paddy/drk-blutspende-orte DRK_Blutspende_Orte
cd DRK_Blutspende_Orte
./install.sh
```
Put it somewhere stable, e.g. `~/Apps/DRK_Blutspende_Orte`.
`install.sh` does everything:
## 3. Create a virtual environment and install dependencies
1. `sudo apt install python3-tk python3-venv python3-pip git` (asks for the
password),
2. creates `.venv` and installs the pinned `requirements.txt`,
3. writes `~/.local/share/applications/drk-blutspende-orte.desktop` with the
correct absolute paths and the bundled `icon.png`.
After it finishes, **"DRK Blutspende Arbeitsorte"** is in the application menu
(log out/in once if it doesn't show immediately). First manual test: `./run.sh`.
> Clone it — don't download a zip. The in-app updater and `run.sh` both rely on
> it being a real git checkout.
## What the pieces are
| File | Purpose |
|------|---------|
| `install.sh` | one-time setup (above). Safe to re-run. |
| `run.sh` | launches the app from `.venv`; the `.desktop` entry calls this. |
| `icon.png` | bundled launcher/window icon (red cross). Replace with the real DRK logo if wanted. |
| `requirements.txt` | fully pinned, tested on Python 3.12. |
## Running manually
```bash
cd ~/Apps/DRK_Blutspende_Orte
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
./run.sh # or: .venv/bin/python app.py
```
`requirements.txt`:
```
ttkbootstrap==1.10.1
geopy>=2.4.1
folium>=0.17.0
pandas>=2.2.0
```
> Only `ttkbootstrap` is pinned exactly. For a machine you hand to someone else,
> consider pinning all four (see [improvements.md](improvements.md#5-packaging--distribution)).
## 4. Run it
```bash
.venv/bin/python app.py
```
The window should open. `data/orte.csv` is created automatically on first run if
it is missing.
## 5. Make it a double-click launcher
### Launcher script
Create `run.sh` in the project root:
```bash
#!/usr/bin/env bash
cd "$(dirname "$0")"
exec .venv/bin/python app.py
```
```bash
chmod +x run.sh
```
### Desktop entry
Create `~/.local/share/applications/drk-blutspende-orte.desktop`:
```ini
[Desktop Entry]
Type=Application
Name=DRK Blutspende Arbeitsorte
Comment=Einsatzorte protokollieren und auf der Karte anzeigen
Exec=/home/USER/Apps/DRK_Blutspende_Orte/run.sh
Icon=/home/USER/Apps/DRK_Blutspende_Orte/data/icon.png
Terminal=false
Categories=Utility;
```
Replace `USER` with the real username. The app writes a simple red-cross
`data/icon.png` on first run; drop in the real DRK logo at that path if you have
one. The entry then shows up in the Mint menu and can be pinned to the panel or
the desktop.
`data/orte.csv` is created automatically on first run if missing.
## Python / Tk version
Python 3.9+ is fine (the code uses `from __future__ import annotations`). The
system Python on current Mint releases is well above that.
`ttkbootstrap` needs **Tk 8.6 or newer**. Linux Mint's `python3-tk` provides
that. The macOS CommandLineTools Python used during development ships Tk 8.5 and
**cannot run the GUI** — see [dev-notes.md](dev-notes.md).
Python 3.103.12 (Mint's `python3`). `ttkbootstrap` needs **Tk 8.6+**, which
Mint's `python3-tk` provides. The macOS CommandLineTools Python 3.9 ships Tk 8.5
and can't run the GUI — for dev on macOS use a Homebrew Python, see
[dev-notes.md](dev-notes.md).
## Updating
**From inside the app:** menu **Hilfe ▸ Nach Update suchen**. The app also
checks quietly on start and offers the update if there is one. It fast-forwards
to the server version, reinstalls dependencies if `requirements.txt` changed,
and restarts itself. `data/` is never touched.
For this to work the app must run from a **git clone** (step 2) whose `.venv`
was made with the same Python it runs on, and `git` must be installed. The
updater only ever fast-forwards if the local copy has been changed by hand it
refuses and says to get in touch.
**From inside the app:** menu **Hilfe ▸ Nach Update suchen**. It also checks
quietly on start and offers the update if there is one. It fast-forwards to the
server version, reinstalls dependencies if `requirements.txt` changed, and
restarts itself. `data/` is never touched. The updater only fast-forwards — if
the local copy was hand-edited it refuses and says to get in touch.
**Manually** (equivalent):
@@ -120,8 +67,16 @@ git pull --ff-only
.venv/bin/pip install -r requirements.txt
```
## Data location
Publishing an update, from the dev machine: `git push` to
`https://git.plutodev.de/Paddy/drk-blutspende-orte` (branch `main`).
All state is in `data/orte.csv` next to `app.py`. To back up the app, copy that
one file (plus `data/backups/` if you want the history). To move to a new
laptop, clone the repo again and redo steps 1 & 3; copy `data/orte.csv` across.
## Data location & backup
All state is in `data/` next to `app.py`:
- `orte.csv` — the data (git-ignored).
- `backups/` — automatic timestamped copies, newest 20 kept.
- `app.log`, `window.json`, `icon.png` (runtime fallback) — git-ignored.
To back up: copy `data/orte.csv` (and `data/backups/` for history). To move to a
new laptop: clone the repo, run `./install.sh`, copy `data/orte.csv` across.