summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-08-04 16:15:36 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-08-04 16:15:36 +0000
commit22b6039107124d9e2fb9f3185d1663fac482f25e (patch)
treee7820e51df0b152d1e750b377b8fd2cc85405523 /python
parentad3b844320f099f40c475f39579a9baf578785c6 (diff)
downloadpython-apt-22b6039107124d9e2fb9f3185d1663fac482f25e.tar.gz
* downloads can be canceld now (in FetchProgress::Pulse)
Diffstat (limited to 'python')
-rw-r--r--python/progress.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/python/progress.cc b/python/progress.cc
index 3439bfd8..33b4ed97 100644
--- a/python/progress.cc
+++ b/python/progress.cc
@@ -139,8 +139,6 @@ void PyFetchProgress::Stop()
RunSimpleCallback("stop");
}
-// FIXME: it should just set the attribute for
-// CurrentCPS, Current...
bool PyFetchProgress::Pulse(pkgAcquire * Owner)
{
pkgAcquireStatus::Pulse(Owner);
@@ -161,12 +159,17 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner)
PyObject_SetAttrString(callbackInst, "totalItems", o);
o = Py_BuildValue("f", TotalBytes);
PyObject_SetAttrString(callbackInst, "totalBytes", o);
-
- RunSimpleCallback("pulse");
-
- // this can be canceld by returning false
- return true;
+ PyObject *arglist = Py_BuildValue("()");
+ PyObject *result;
+ RunSimpleCallback("pulse", arglist, &result);
+
+ bool res = true;
+ if(!PyArg_Parse(result, "b", &res))
+ std::cerr << "result could not be parsed" << std::endl;
+
+ // fetching can be canceld by returning false
+ return res;
}