dashboard: o/s shortcuts to open a script and save via a file dialog

Two new dashboard keys, mirroring the existing x=export: 'o' opens a file
picker to run a .essim script (-> source <path>), 's' opens a file picker to
write a system snapshot (-> save <path>, only when a system is loaded). Both
use OpenFileDialog with a per-key persisted last directory; the global
CatchEvent already yields to the file-dialog modal while it is open. Dashboard
help hints updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 18:44:41 +02:00
parent 29242ae016
commit 60c00eb914
2 changed files with 19 additions and 0 deletions

View File

@@ -309,6 +309,8 @@ Component Tui::BuildDashboardScreen() {
{"a", "analyze (verify + groups)"}, {"a", "analyze (verify + groups)"},
{"h", "help screen"}, {"h", "help screen"},
{"x", "export"}, {"x", "export"},
{"o", "open/run a script"},
{"s", "save system"},
{"PgUp", "scroll up"}, {"PgUp", "scroll up"},
{"PgDn", "scroll down"}, {"PgDn", "scroll down"},
{"Home", "scroll top"}, {"Home", "scroll top"},

View File

@@ -101,6 +101,23 @@ void Tui::Run() {
if (e == Event::Character("a")) { screen_idx = 5; return true; } if (e == Event::Character("a")) { screen_idx = 5; return true; }
if (e == Event::Character("h")) { screen_idx = 6; return true; } if (e == Event::Character("h")) { screen_idx = 6; return true; }
if (e == Event::Character("x")) { Dispatch("export"); return true; } if (e == Event::Character("x")) { Dispatch("export"); return true; }
if (e == Event::Character("o")) { // open / run a script
OpenFileDialog("Open script — run a .essim file",
"dashboard.source", "", {},
[this](const std::string &path) {
Dispatch("source " + path);
});
return true;
}
if (e == Event::Character("s")) { // save the system snapshot
if (sys)
OpenFileDialog("Save system snapshot",
"dashboard.save", "system.essim", {},
[this](const std::string &path) {
Dispatch("save " + path);
});
return true;
}
return false; return false;
case 3: // explore case 3: // explore