summaryrefslogtreecommitdiff
path: root/python/progress.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-07-15 21:36:58 +0200
committerJulian Andres Klode <jak@debian.org>2009-07-15 21:36:58 +0200
commitaaf5907863bed9a044fa0e3e2eacd1ca2de53c59 (patch)
treec377cfbf951c18f8b6bb9e2998b60ee376a9f82d /python/progress.cc
parent6975079da04ae1fad51dca63b40a1aae15f45aa0 (diff)
downloadpython-apt-aaf5907863bed9a044fa0e3e2eacd1ca2de53c59.tar.gz
Introduce new progress (base) classes in apt_pkg:
- apt_pkg.AcquireProgress - apt_pkg.OpProgress
Diffstat (limited to 'python/progress.cc')
-rw-r--r--python/progress.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/python/progress.cc b/python/progress.cc
index 44f27b0c..b1845f0a 100644
--- a/python/progress.cc
+++ b/python/progress.cc
@@ -15,6 +15,7 @@
#include <apt-pkg/acquire-worker.h>
#include "progress.h"
#include "generic.h"
+#include "apt_pkgmodule.h"
// generic
bool PyCallbackObj::RunSimpleCallback(const char* method_name,
@@ -75,11 +76,20 @@ void PyOpProgress::Update()
PyObject_SetAttrString(callbackInst, "majorChange", o);
Py_XDECREF(o);
+
+
// Build up the argument list...
if(CheckChange(0.05))
{
- PyObject *arglist = Py_BuildValue("(f)", Percent);
- RunSimpleCallback("update", arglist);
+ if (PyObject_TypeCheck(callbackInst, &PyOpProgress_Type)) {
+ o = Py_BuildValue("f", Percent);
+ PyObject_SetAttrString(callbackInst, "percent", o);
+ RunSimpleCallback("update");
+ Py_XDECREF(o);
+ } else {
+ PyObject *arglist = Py_BuildValue("(f)", Percent);
+ RunSimpleCallback("update", arglist);
+ }
}
};