summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-05-11 14:33:05 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-05-11 14:33:05 +0000
commit5ba2ebc40f8137df28c07b52ab76e7c3d4352e8d (patch)
tree0acb8556e1c6b1c8dac0763610df1eac5d83f5cd
parente78e4b71fc600cf251eead62cec6a7c07165e38b (diff)
downloadpython-apt-5ba2ebc40f8137df28c07b52ab76e7c3d4352e8d.tar.gz
* support Op and SubOp in the progress wrapper
-rw-r--r--python/progress.cc14
1 files changed, 12 insertions, 2 deletions
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()