summaryrefslogtreecommitdiff
path: root/python/progress.h
diff options
context:
space:
mode:
Diffstat (limited to 'python/progress.h')
-rw-r--r--python/progress.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/python/progress.h b/python/progress.h
new file mode 100644
index 00000000..d653b42d
--- /dev/null
+++ b/python/progress.h
@@ -0,0 +1,29 @@
+#ifndef PROGRESS_H
+#define PROGRESS_H
+
+struct PyOpProgressStruct : public OpProgress
+{
+
+ PyObject *py_update_callback_func;
+ PyObject *py_update_callback_args;
+
+ virtual void Update() {
+ if(py_update_callback_func == 0)
+ return;
+
+ // Build up the argument list...
+ PyObject *arglist = Py_BuildValue("(fO)", Percent, py_update_callback_args);
+
+ // ...for calling the Python compare function.
+ PyObject *result = PyEval_CallObject(py_update_callback_func,arglist);
+
+ Py_XDECREF(result);
+ Py_DECREF(arglist);
+
+ return;
+ };
+
+ PyOpProgressStruct() : OpProgress(), py_update_callback_func(0) {};
+};
+
+#endif