MCPcopy Create free account
hub / github.com/commontk/CTK / executeString

Method executeString

Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp:303–322  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

301
302//-----------------------------------------------------------------------------
303QVariant ctkAbstractPythonManager::executeString(const QString& code,
304 ctkAbstractPythonManager::ExecuteStringMode mode)
305{
306 int start = -1;
307 switch(mode)
308 {
309 case ctkAbstractPythonManager::FileInput: start = Py_file_input; break;
310 case ctkAbstractPythonManager::SingleInput: start = Py_single_input; break;
311 case ctkAbstractPythonManager::EvalInput:
312 default: start = Py_eval_input; break;
313 }
314
315 QVariant ret;
316 PythonQtObjectPtr main = ctkAbstractPythonManager::mainContext();
317 if (main)
318 {
319 ret = main.evalScript(code, start);
320 }
321 return ret;
322}
323
324//-----------------------------------------------------------------------------
325void ctkAbstractPythonManager::executeFile(const QString& filename)

Callers 7

executeFileMethod · 0.95
testExecuteStringMethod · 0.45
testPythonModuleMethod · 0.45
testPythonObjectMethod · 0.45

Calls

no outgoing calls

Tested by 6

testExecuteStringMethod · 0.36
testPythonModuleMethod · 0.36
testPythonObjectMethod · 0.36