blob: d414ca1597660208ad5c9cb25ac55ca7b9c32524 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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);
}
|