------------------------------------------------------------------------------
| 205 | |
| 206 | //------------------------------------------------------------------------------ |
| 207 | bool vtkMatplotlibMathTextUtilities::InitializeMaskParser() |
| 208 | { |
| 209 | #if VTK_MODULE_ENABLE_VTK_PythonInterpreter |
| 210 | if (!Py_IsInitialized()) |
| 211 | { |
| 212 | // ensure that Python is initialized. |
| 213 | vtkPythonInterpreter::Initialize(); |
| 214 | } |
| 215 | #endif |
| 216 | if (!Py_IsInitialized()) |
| 217 | { |
| 218 | return false; |
| 219 | } |
| 220 | |
| 221 | vtkPythonScopeGilEnsurer gilEnsurer; |
| 222 | vtkSmartPyObject mplMathTextLib(PyImport_ImportModule("matplotlib.mathtext")); |
| 223 | if (this->CheckForError(mplMathTextLib)) |
| 224 | { |
| 225 | return false; |
| 226 | } |
| 227 | |
| 228 | vtkSmartPyObject mathTextParserClass(PyObject_GetAttrString(mplMathTextLib, "MathTextParser")); |
| 229 | if (this->CheckForError(mathTextParserClass)) |
| 230 | { |
| 231 | return false; |
| 232 | } |
| 233 | |
| 234 | this->MaskParser = PyObject_CallFunction(mathTextParserClass, const_cast<char*>("s"), "agg"); |
| 235 | if (this->CheckForError(this->MaskParser)) |
| 236 | { |
| 237 | Py_CLEAR(this->MaskParser); |
| 238 | return false; |
| 239 | } |
| 240 | |
| 241 | return true; |
| 242 | } |
| 243 | |
| 244 | //------------------------------------------------------------------------------ |
| 245 | bool vtkMatplotlibMathTextUtilities::InitializePathParser() |
no test coverage detected