Status page: data loader (station, dates, Analyse)

A form at the top of the Status page: station dropdown (folders of data/), start and end dates
(end excluded, as --au), and an Analyse button that builds the page for that selection and opens it.
The code is in detectors-view/data-loader/chargeur.py: the form, and its local server (port 8766)
that serves out/ and data/ like the common one, plus /analyse, which runs status.py each time.

python3 detectors-view/status.py without arguments, or detectors-view/status.sh, opens the form
alone; with a station folder it builds the page as before, now opened through the loader server.
common.page.open_served takes another port and server script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-10-29 13:07:13 +01:00
1 parent 3678997321
commit aa2578873d
5 files changed
+103 -14

No files matched your search

+7 -6
View File
@@ -70,22 +70,23 @@ PORT = 8765
SERVIS = ("out", "data")
def open_served(path):
"""Ouvre la page par le serveur local, lancé en tâche de fond s'il ne répond pas (il reste pour les pages suivantes)."""
def open_served(path, port=PORT, script=__file__):
"""Ouvre la page par le serveur local, lancé en tâche de fond s'il ne répond pas (il reste pour les pages suivantes).
Un autre serveur (port, script lancé avec « serve ») : le data loader de la page Status."""
def repond():
try:
socket.create_connection(("127.0.0.1", PORT), timeout=0.5).close()
socket.create_connection(("127.0.0.1", port), timeout=0.5).close()
return True
except OSError:
return False
if not repond(): # ponytail: un autre programme sur PORT serait pris pour le serveur ; changer PORT si besoin
subprocess.Popen([sys.executable, __file__, "serve"], start_new_session=True,
if not repond(): # ponytail: un autre programme sur port serait pris pour le serveur ; changer de port si besoin
subprocess.Popen([sys.executable, script, "serve"], start_new_session=True,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
for _ in range(50):
if repond():
break
time.sleep(0.1)
url = f"http://127.0.0.1:{PORT}/" + quote(Path(path).resolve().relative_to(ROOT).as_posix())
url = f"http://127.0.0.1:{port}/" + quote(Path(path).resolve().relative_to(ROOT).as_posix())
if shutil.which("explorer.exe"): # WSL : navigateur Windows
subprocess.run(["explorer.exe", url])
else: