| 1060 | } |
| 1061 | |
| 1062 | void PythonShell::RunScript() |
| 1063 | { |
| 1064 | PythonContext *context = newContext(); |
| 1065 | |
| 1066 | ANALYTIC_SET(UIFeatures.PythonInterop, true); |
| 1067 | |
| 1068 | ui->outputHelpTabs->setCurrentIndex(0); |
| 1069 | |
| 1070 | ui->scriptOutput->clear(); |
| 1071 | |
| 1072 | QString script = QString::fromUtf8(scriptEditor->getText(scriptEditor->textLength() + 1)); |
| 1073 | |
| 1074 | enableButtons(false); |
| 1075 | |
| 1076 | LambdaThread *thread = new LambdaThread([this, script, context]() { |
| 1077 | scriptContext = context; |
| 1078 | context->executeString(lit("script.py"), script); |
| 1079 | scriptContext = NULL; |
| 1080 | |
| 1081 | GUIInvoke::call(this, [this, context]() { |
| 1082 | context->Finish(); |
| 1083 | enableButtons(true); |
| 1084 | }); |
| 1085 | }); |
| 1086 | |
| 1087 | thread->setName(lit("Python script")); |
| 1088 | thread->selfDelete(true); |
| 1089 | thread->start(); |
| 1090 | } |
| 1091 | |
| 1092 | void PythonShell::on_execute_clicked() |
| 1093 | { |
no test coverage detected