[PyKDE] SIP...Need help

computernet2000 at mail.bg computernet2000 at mail.bg
Sat Jan 14 23:04:10 GMT 2006


Hi all !

We try to create binding for Ultimate++ lib
have most of widgets and non-gui classes (~70%)
without Callback system :(

We using SIP to wrap the code.

this is a simple code ...

Callback TheBack::THE_Callback(void *args)
{
           typedef TheBack CLASSNAME;
           PyObject *p = (PyObject *)args;
           Py_INCREF(p);
           return callback1(this, &CLASSNAME::py_call,(void
*)p);
}

void TheBack::py_call(void *data)
{
		    PyObject *p = (PyObject *)data;

		    PyObject *func = PyTuple_GetItem(p, 0);
		    PyObject *args = PyTuple_GetItem(p, 1);
		    PyObject *kw = PyTuple_GetItem(p, 2);
		    PyObject_Call(func, args, kw);
}


"return THISBACK1(py_call, (void *)p)"
This line is part from the Callback system,
take a pointer-function and return Callback object.


In Python i want wrap something like this  :

def test(*args, **kw):
	print "bla-bla"
module.THE_Callback(test,"some args...")


After that, call the Python function and pass her into
"module.THE_Callback(...)"
but this not work.I dont know how to implement this in SIP.
In the moment "*args" from "module.THE_Callback" is not a
valid python-function argument

Question is :
How to wrap this method "THE_Callback(void *args)" in SIP ?



-----------------------------

Някои книги в СЛОН.БГ:
· Хари Потър и нечистокръвния принц, Роулинг
· Изкуството на света на Диска, Пратчет
· Орки, Стен Никълс
http://www.slon.bg




More information about the PyQt mailing list