summaryrefslogtreecommitdiff
path: root/python/progress.h
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-03-09 16:16:37 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-03-09 16:16:37 +0000
commit59902bad90ed9192ad9b2def78f588cdefe1080c (patch)
tree859896b89dc8a332c8c39d0960eb3f59128e465e /python/progress.h
parent6d42024c88d207c35718f4f8458e58fc44951830 (diff)
downloadpython-apt-59902bad90ed9192ad9b2def78f588cdefe1080c.tar.gz
* Implemented OpProgress support
Diffstat (limited to 'python/progress.h')
-rw-r--r--python/progress.h38
1 files changed, 18 insertions, 20 deletions
diff --git a/python/progress.h b/python/progress.h
index 5859eea0..b18778b1 100644
--- a/python/progress.h
+++ b/python/progress.h
@@ -1,31 +1,29 @@
-#ifndef PROGRESS_H
-#define PROGRESS_H
+// Description /*{{{*/
+// $Id: progress.h,v 1.5 2003/06/03 03:03:23 mdz Exp $
+/* ######################################################################
-#include<iostream>
-
-struct PyOpProgressStruct : public OpProgress
-{
+ Progress - Wrapper for the progress related functions
- PyObject *py_update_callback_func;
- PyObject *py_update_callback_args;
+ ##################################################################### */
- virtual void Update() {
- if(py_update_callback_func == 0)
- return;
+#ifndef PROGRESS_H
+#define PROGRESS_H
- // Build up the argument list...
- PyObject *arglist = Py_BuildValue("fO", Percent,py_update_callback_args);
+#include <apt-pkg/progress.h>
+#include <Python.h>
- // ...for calling the Python compare function.
- PyObject *result = PyEval_CallObject(py_update_callback_func,arglist);
+struct PyOpProgress : public OpProgress
+{
+ PyObject *callbackInst;
- Py_XDECREF(result);
- Py_DECREF(arglist);
+ void setCallbackInst(PyObject *o) {
+ callbackInst = o;
+ }
- return;
- };
+ virtual void Update();
+ virtual void Done();
- PyOpProgressStruct() : OpProgress(), py_update_callback_func(0) {};
+ PyOpProgress() : OpProgress(), callbackInst(0) {};
};
#endif