MCPcopy Create free account
hub / github.com/Kitware/VTK / InitializePathParser

Method InitializePathParser

Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx:245–280  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

243
244//------------------------------------------------------------------------------
245bool vtkMatplotlibMathTextUtilities::InitializePathParser()
246{
247#if VTK_MODULE_ENABLE_VTK_PythonInterpreter
248 if (!Py_IsInitialized())
249 {
250 // ensure that Python is initialized.
251 vtkPythonInterpreter::Initialize();
252 }
253#endif
254 if (!Py_IsInitialized())
255 {
256 return false;
257 }
258
259 vtkPythonScopeGilEnsurer gilEnsurer;
260 vtkSmartPyObject mplTextPathLib(PyImport_ImportModule("matplotlib.textpath"));
261 if (this->CheckForError(mplTextPathLib))
262 {
263 return false;
264 }
265
266 vtkSmartPyObject textToPathClass(PyObject_GetAttrString(mplTextPathLib, "TextToPath"));
267 if (this->CheckForError(textToPathClass))
268 {
269 return false;
270 }
271
272 this->PathParser = PyObject_CallFunction(textToPathClass, nullptr);
273 if (this->CheckForError(this->PathParser))
274 {
275 Py_CLEAR(this->PathParser);
276 return false;
277 }
278
279 return true;
280}
281
282//------------------------------------------------------------------------------
283bool vtkMatplotlibMathTextUtilities::InitializeFontPropertiesClass()

Callers 1

StringToPathMethod · 0.95

Calls 2

CheckForErrorMethod · 0.95
InitializeFunction · 0.50

Tested by

no test coverage detected