| 485 | } |
| 486 | |
| 487 | void 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 |
nothing calls this directly
no test coverage detected