From aaf5907863bed9a044fa0e3e2eacd1ca2de53c59 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 15 Jul 2009 21:36:58 +0200 Subject: Introduce new progress (base) classes in apt_pkg: - apt_pkg.AcquireProgress - apt_pkg.OpProgress --- python/progress.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'python/progress.cc') 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 #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); + } } }; -- cgit v1.2.3