From 5ba2ebc40f8137df28c07b52ab76e7c3d4352e8d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 11 May 2005 14:33:05 +0000 Subject: * support Op and SubOp in the progress wrapper --- python/progress.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/progress.cc b/python/progress.cc index 54e2096e..b7c5854e 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -22,7 +22,7 @@ bool PyCallbackObj::RunSimpleCallback(const char* method_name, PyObject *method = PyObject_GetAttrString(callbackInst,(char*) method_name); if(method == NULL) { // FIXME: make this silent - std::cerr << "Can't find '" << method_name << "' method" << std::endl; + //std::cerr << "Can't find '" << method_name << "' method" << std::endl; Py_XDECREF(arglist); return false; } @@ -50,9 +50,19 @@ bool PyCallbackObj::RunSimpleCallback(const char* method_name, // FIXME: add "string Op, string SubOp" as attribute to the callbackInst void PyOpProgress::Update() { + + PyObject *o; + o = Py_BuildValue("s", Op.c_str()); + PyObject_SetAttrString(callbackInst, "Op", o); + o = Py_BuildValue("s", SubOp.c_str()); + PyObject_SetAttrString(callbackInst, "SubOp", o); + o = Py_BuildValue("b", MajorChange); + PyObject_SetAttrString(callbackInst, "MajorChange", o); + // Build up the argument list... PyObject *arglist = Py_BuildValue("(f)", Percent); - RunSimpleCallback("Update", arglist); + if(CheckChange(0.05)) + RunSimpleCallback("Update", arglist); }; void PyOpProgress::Done() -- cgit v1.2.3