MCPcopy Create free account
hub / github.com/Kitware/ParaView / executeScript

Method executeScript

Qt/Python/pqPythonManager.cxx:213–229  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

211
212//-----------------------------------------------------------------------------
213void pqPythonManager::executeScript(const QString& filename, vtkTypeUInt32 location)
214{
215 // read python script from file
216 auto pxm = pqApplicationCore::instance()->getActiveServer()->proxyManager();
217 const auto pyScript = pxm->LoadString(filename.toUtf8().data(), location);
218 if (pyScript.empty())
219 {
220 qCritical() << "Failed to open file : " << filename;
221 return;
222 }
223
224 const QByteArray code = QString(pyScript.c_str()).toLocal8Bit();
225 const QVector<QByteArray> pre_cmd = { "import sys",
226 QString("__file__ = r'%1'").arg(filename).toUtf8() };
227 const QVector<QByteArray> post_cmd = { "del __file__" };
228 this->executeCode(code, pre_cmd, post_cmd);
229}
230
231//-----------------------------------------------------------------------------
232void pqPythonManager::executeScriptAndRender(const QString& filename, vtkTypeUInt32 location)

Callers 1

Calls 8

executeCodeMethod · 0.95
instanceFunction · 0.85
LoadStringMethod · 0.80
QStringClass · 0.50
proxyManagerMethod · 0.45
getActiveServerMethod · 0.45
dataMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected