diff options
Diffstat (limited to 'python/progress.cc')
| -rw-r--r-- | python/progress.cc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/python/progress.cc b/python/progress.cc new file mode 100644 index 00000000..d414ca15 --- /dev/null +++ b/python/progress.cc @@ -0,0 +1,55 @@ +// Description /*{{{*/ +// $Id: progress.cc,v 1.5 2003/06/03 03:03:23 mdz Exp $ +/* ###################################################################### + + Progress - Wrapper for the progress related functions + + ##################################################################### */ + +#include "progress.h" + + +void PyOpProgress::Update() +{ + if(callbackInst == 0) + return; + + // Build up the argument list... + PyObject *arglist = Py_BuildValue("(f)", Percent); + + // ...for calling the Python compare function. + PyObject *method = PyObject_GetAttrString(callbackInst, "Update"); + if(method == NULL) { + // FIXME: make this silent + Py_DECREF(arglist); + return; + } + PyObject *result = PyEval_CallObject(method,arglist); + + Py_XDECREF(result); + Py_XDECREF(method); + Py_DECREF(arglist); + + return; +}; + +void PyOpProgress::Done() +{ + if(callbackInst == 0) + return; + + // Build up the argument list... + PyObject *arglist = Py_BuildValue("()", NULL); + + // ...for calling the Python compare function. + PyObject *method = PyObject_GetAttrString(callbackInst, "Done"); + if(method == NULL) { + Py_DECREF(arglist); + return; + } + PyObject *result = PyEval_CallObject(method,arglist); + + Py_XDECREF(result); + Py_XDECREF(method); + Py_DECREF(arglist); +} |
