Commit ddae0eb5 authored by David Gobbi's avatar David Gobbi
Browse files

ENH: Allow python AddObserver method to take int as first arg.

parent afd949e7
......@@ -3821,7 +3821,9 @@ static void vtkWrapPython_CustomMethods(
"static PyObject *PyvtkObject_AddObserver(PyObject *self, PyObject *args)\n"
"{\n"
" vtkObject *op;\n"
" char *temp0; // arg 0\n"
" PyObject *temp0; // arg 0\n"
" const char *temp0s = 0;\n"
" int temp0i = 0;\n"
" PyObject *temp1; // arg 1\n"
" float temp2 = 0.0f; // arg 2\n"
" unsigned long temp20 = 0; // return value\n"
......@@ -3829,21 +3831,44 @@ static void vtkWrapPython_CustomMethods(
fprintf(fp,
" op = static_cast<vtkObject *>(vtkPythonUtil::VTKParseTuple(\n"
" self, args, \"zO|f:AddObserver\", &temp0, &temp1, &temp2));\n"
" self, args, \"OO|f:AddObserver\", &temp0, &temp1, &temp2));\n"
"\n"
" if (op)\n"
" {\n"
" if (PyString_Check(temp0))\n"
" {\n"
" temp0s = PyString_AsString(temp0);\n"
" }\n"
" else if (PyInt_Check(temp0))\n"
" {\n"
" temp0i = (int)PyInt_AsLong(temp0);\n"
" }\n"
" else\n"
" {\n"
" PyErr_SetString(PyExc_ValueError,\n"
" \"first arg of AddObserver must be string or int.\");\n"
" return NULL;\n"
" }\n"
" if (!PyCallable_Check(temp1) && temp1 != Py_None)\n"
" {\n"
" PyErr_SetString(PyExc_ValueError,\n"
" \"vtk callback method passed to AddObserver was not callable.\");\n"
" return NULL;\n"
" }\n"
" }\n");
fprintf(fp,
" Py_INCREF(temp1);\n"
" vtkPythonCommand *cbc = vtkPythonCommand::New();\n"
" cbc->SetObject(temp1);\n"
" cbc->SetThreadState(PyThreadState_Get());\n"
" temp20 = op->AddObserver(temp0,cbc,temp2);\n"
" if (temp0s)\n"
" {\n"
" temp20 = op->AddObserver(temp0s,cbc,temp2);\n"
" }\n"
" else\n"
" {\n"
" temp20 = op->AddObserver(temp0i,cbc,temp2);\n"
" }\n"
" cbc->Delete();\n"
"#if (PY_VERSION_HEX >= 0x02020000)\n"
" if ((long)(temp20) >= 0)\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment