main.py dinamico + README generico senza valori hardcoded
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
abb01ecb07
commit
bccec166e4
2 files changed
+108
-22
No files matched your search
@@ -4,30 +4,35 @@ from pathlib import Path
|
||||
|
||||
BASE = Path(__file__).parent
|
||||
|
||||
MENU = [
|
||||
("Calcola T ambiente (calcola_t_amb)", BASE / "start" / "calcola_t_amb.py"),
|
||||
("Plot dati raw (plot_temperatura)", BASE / "start" / "plot_temperatura.py"),
|
||||
("Induttore 1 [t = 110.81–111.56 s]", BASE / "induttore1" / "app1.py"),
|
||||
("Induttore 2 [t = 112.02–113.95 s]", BASE / "induttore2" / "app2.py"),
|
||||
("Induttore 3 [t = 115.0–133.7 s]", BASE / "induttore3" / "app3.py"),
|
||||
("Report completo LaTeX", BASE / "report_completo.py"),
|
||||
]
|
||||
|
||||
def build_menu() -> list[tuple[str, Path]]:
|
||||
menu = [
|
||||
("Calcola T ambiente", BASE / "start" / "calcola_t_amb.py"),
|
||||
("Plot dati raw", BASE / "start" / "plot_temperatura.py"),
|
||||
]
|
||||
for folder in sorted(BASE.glob("induttore*/")):
|
||||
for script in sorted(folder.glob("app*.py")):
|
||||
menu.append((f"{folder.name} — {script.name}", script))
|
||||
menu.append(("Report completo (PDF + LaTeX)", BASE / "report_completo.py"))
|
||||
return menu
|
||||
|
||||
|
||||
def main():
|
||||
while True:
|
||||
menu = build_menu()
|
||||
print("\n=== Analisi Termica Forno ===\n")
|
||||
for i, (label, _) in enumerate(MENU, 1):
|
||||
for i, (label, _) in enumerate(menu, 1):
|
||||
print(f" {i}. {label}")
|
||||
print(" 0. Esci\n")
|
||||
|
||||
scelta = input("Scegli: ").strip()
|
||||
if scelta == "0":
|
||||
break
|
||||
if not scelta.isdigit() or not (1 <= int(scelta) <= len(MENU)):
|
||||
if not scelta.isdigit() or not (1 <= int(scelta) <= len(menu)):
|
||||
print("Scelta non valida.")
|
||||
continue
|
||||
|
||||
_, script = MENU[int(scelta) - 1]
|
||||
_, script = menu[int(scelta) - 1]
|
||||
subprocess.run([sys.executable, str(script)])
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user