From 59902bad90ed9192ad9b2def78f588cdefe1080c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 9 Mar 2005 16:16:37 +0000 Subject: * Implemented OpProgress support --- python/progress.h | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'python/progress.h') diff --git a/python/progress.h b/python/progress.h index 5859eea0..b18778b1 100644 --- a/python/progress.h +++ b/python/progress.h @@ -1,31 +1,29 @@ -#ifndef PROGRESS_H -#define PROGRESS_H +// Description /*{{{*/ +// $Id: progress.h,v 1.5 2003/06/03 03:03:23 mdz Exp $ +/* ###################################################################### -#include - -struct PyOpProgressStruct : public OpProgress -{ + Progress - Wrapper for the progress related functions - PyObject *py_update_callback_func; - PyObject *py_update_callback_args; + ##################################################################### */ - virtual void Update() { - if(py_update_callback_func == 0) - return; +#ifndef PROGRESS_H +#define PROGRESS_H - // Build up the argument list... - PyObject *arglist = Py_BuildValue("fO", Percent,py_update_callback_args); +#include +#include - // ...for calling the Python compare function. - PyObject *result = PyEval_CallObject(py_update_callback_func,arglist); +struct PyOpProgress : public OpProgress +{ + PyObject *callbackInst; - Py_XDECREF(result); - Py_DECREF(arglist); + void setCallbackInst(PyObject *o) { + callbackInst = o; + } - return; - }; + virtual void Update(); + virtual void Done(); - PyOpProgressStruct() : OpProgress(), py_update_callback_func(0) {}; + PyOpProgress() : OpProgress(), callbackInst(0) {}; }; #endif -- cgit v1.2.3