Labeling tool: the expert labels ranges in plain text, one plot at a time (D-098, point 68)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a0467e4c82
commit
fcd9191a95
7 files changed
+337
-8
No files matched your search
@@ -34,13 +34,13 @@ def formulaire(station="", du="", au=""):
|
||||
<button>Analyse</button></form>"""
|
||||
|
||||
|
||||
def accueil():
|
||||
"""Le formulaire seul, dans out/data-loader.html -> son chemin."""
|
||||
chemin = ROOT / "out" / "data-loader.html"
|
||||
def accueil(titre="Status", nom="data-loader"):
|
||||
"""Le formulaire seul, dans out/<nom>.html -> son chemin."""
|
||||
chemin = ROOT / "out" / f"{nom}.html"
|
||||
chemin.parent.mkdir(exist_ok=True)
|
||||
chemin.write_text(f"""<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Status loader</title>
|
||||
chemin.write_text(f"""<!doctype html><html lang="en"><head><meta charset="utf-8"><title>{titre} loader</title>
|
||||
<style>body{{font-family:system-ui,sans-serif;margin:16px;background:#fff;color:#1a1a19}}</style></head><body>
|
||||
<h2>Status</h2>{formulaire()}</body></html>""", encoding="utf-8")
|
||||
<h2>{titre}</h2>{formulaire()}</body></html>""", encoding="utf-8")
|
||||
return chemin
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ def ouvrir(chemin):
|
||||
|
||||
|
||||
class Chargeur(_Pages):
|
||||
SCRIPT = STATUS # le script que lance « Analyse » ; labeling/labeling.py a le sien
|
||||
|
||||
def do_GET(self):
|
||||
url = urlsplit(self.path)
|
||||
if url.path != "/analyse":
|
||||
@@ -58,7 +60,7 @@ class Chargeur(_Pages):
|
||||
station = q.get("station")
|
||||
if station not in stations(): # le nom devient un chemin : une station de data/, rien d'autre
|
||||
return self.send_error(400, "Unknown station")
|
||||
args = [sys.executable, str(STATUS), str(ROOT / "data" / station), "--sans-ouvrir"]
|
||||
args = [sys.executable, str(self.SCRIPT), str(ROOT / "data" / station), "--sans-ouvrir"]
|
||||
args += [f"--{k}={q[k]}" for k in ("du", "au") if q.get(k)]
|
||||
r = subprocess.run(args, capture_output=True, text=True)
|
||||
if r.returncode:
|
||||
|
||||
Reference in new issue
Block a user