MCPcopy Create free account
hub / github.com/El-EnderJ/NeoCalculator / runScript

Method runScript

src/apps/PythonApp.cpp:487–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485}
486
487void PythonApp::runScript(int idx) {
488 if (idx < 0 || idx >= _scriptCount) return;
489
490 char code[MAX_CODE_LEN];
491 if (!loadScript(_scriptNames[idx], code, MAX_CODE_LEN)) {
492 clearConsole();
493 appendConsole("Error: Could not load script\n");
494 switchTab(Tab::CONSOLE);
495 return;
496 }
497
498 clearConsole();
499 appendConsole(">>> Running ");
500 appendConsole(_scriptNames[idx]);
501 appendConsole("...\n");
502
503 bool ok = _engine.execute(code);
504 const char* out = _engine.getOutput();
505 if (out && out[0]) {
506 appendConsole(out);
507 }
508 if (!ok) {
509 const char* err = _engine.getError();
510 if (err && err[0]) {
511 appendConsole(err);
512 }
513 }
514 appendConsole("\n>>> Done.\n");
515
516 switchTab(Tab::CONSOLE);
517 _focus = Focus::CONTENT;
518}
519
520// ═════════════════════════════════════════════════════════════════
521// Editor helpers

Callers

nothing calls this directly

Calls 4

loadScriptFunction · 0.85
executeMethod · 0.80
getErrorMethod · 0.80
getOutputMethod · 0.45

Tested by

no test coverage detected