|
|
@ -886,15 +886,15 @@ class BuildKControlModule(Command):
|
|
|
|
#define LIB_PYTHON "libpython%(python_version)s.so"
|
|
|
|
#define LIB_PYTHON "libpython%(python_version)s.so"
|
|
|
|
#define debug 1
|
|
|
|
#define debug 1
|
|
|
|
|
|
|
|
|
|
|
|
static KCModule *report_error(char *msg) {
|
|
|
|
static TDECModule *report_error(char *msg) {
|
|
|
|
if (debug) printf ("error: %%s\n", msg);
|
|
|
|
if (debug) printf ("error: %%s\n", msg);
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static KCModule* return_instance( QWidget *parent, const char *name ) {
|
|
|
|
static TDECModule* return_instance( QWidget *parent, const char *name ) {
|
|
|
|
KCModule* kcmodule;
|
|
|
|
TDECModule* kcmodule;
|
|
|
|
PyObject *pyKCModuleTuple;
|
|
|
|
PyObject *pyTDECModuleTuple;
|
|
|
|
PyObject *pyKCModule;
|
|
|
|
PyObject *pyTDECModule;
|
|
|
|
Pythonize *pyize; // Pythonize object to manage the Python interpreter.
|
|
|
|
Pythonize *pyize; // Pythonize object to manage the Python interpreter.
|
|
|
|
int isErr;
|
|
|
|
int isErr;
|
|
|
|
|
|
|
|
|
|
|
@ -957,8 +957,8 @@ static KCModule* return_instance( QWidget *parent, const char *name ) {
|
|
|
|
PyObject *args = Py_BuildValue ("NN", pyParent, pyName);
|
|
|
|
PyObject *args = Py_BuildValue ("NN", pyParent, pyName);
|
|
|
|
if(pyName && pyParent && args) {
|
|
|
|
if(pyName && pyParent && args) {
|
|
|
|
// run the factory function
|
|
|
|
// run the factory function
|
|
|
|
pyKCModuleTuple = pyize->runFunction(kcmFactory, args);
|
|
|
|
pyTDECModuleTuple = pyize->runFunction(kcmFactory, args);
|
|
|
|
if(!pyKCModuleTuple) {
|
|
|
|
if(!pyTDECModuleTuple) {
|
|
|
|
PyErr_Print();
|
|
|
|
PyErr_Print();
|
|
|
|
return report_error ("*** runFunction failure\n;");
|
|
|
|
return report_error ("*** runFunction failure\n;");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -970,16 +970,16 @@ static KCModule* return_instance( QWidget *parent, const char *name ) {
|
|
|
|
pyize->decref(kcmFactory);
|
|
|
|
pyize->decref(kcmFactory);
|
|
|
|
|
|
|
|
|
|
|
|
// Stop this from getting garbage collected.
|
|
|
|
// Stop this from getting garbage collected.
|
|
|
|
Py_INCREF(PyTuple_GET_ITEM(pyKCModuleTuple,0));
|
|
|
|
Py_INCREF(PyTuple_GET_ITEM(pyTDECModuleTuple,0));
|
|
|
|
|
|
|
|
|
|
|
|
// convert the KCModule PyObject to a real C++ KCModule *.
|
|
|
|
// convert the TDECModule PyObject to a real C++ TDECModule *.
|
|
|
|
isErr = 0;
|
|
|
|
isErr = 0;
|
|
|
|
pyKCModule = PyTuple_GET_ITEM(pyKCModuleTuple,1);
|
|
|
|
pyTDECModule = PyTuple_GET_ITEM(pyTDECModuleTuple,1);
|
|
|
|
kcmodule = (KCModule *)PyLong_AsVoidPtr(pyKCModule);
|
|
|
|
kcmodule = (TDECModule *)PyLong_AsVoidPtr(pyTDECModule);
|
|
|
|
if(!kcmodule) {
|
|
|
|
if(!kcmodule) {
|
|
|
|
return report_error ("***failed sip conversion to C++ pointer\n");
|
|
|
|
return report_error ("***failed sip conversion to C++ pointer\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pyize->decref(pyKCModuleTuple);
|
|
|
|
pyize->decref(pyTDECModuleTuple);
|
|
|
|
|
|
|
|
|
|
|
|
// PyTDE can't run the module without this - Pythonize
|
|
|
|
// PyTDE can't run the module without this - Pythonize
|
|
|
|
// grabs the lock at initialization and we have to give
|
|
|
|
// grabs the lock at initialization and we have to give
|
|
|
@ -990,13 +990,13 @@ static KCModule* return_instance( QWidget *parent, const char *name ) {
|
|
|
|
// take care of any translation info
|
|
|
|
// take care of any translation info
|
|
|
|
TDEGlobal::locale()->insertCatalogue(script);
|
|
|
|
TDEGlobal::locale()->insertCatalogue(script);
|
|
|
|
|
|
|
|
|
|
|
|
// Return the pointer to our new KCModule
|
|
|
|
// Return the pointer to our new TDECModule
|
|
|
|
return kcmodule;
|
|
|
|
return kcmodule;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern "C" {
|
|
|
|
// Factory function that kcontrol will call.
|
|
|
|
// Factory function that kcontrol will call.
|
|
|
|
KCModule* CPP_FACTORY(QWidget *parent, const char *name) {
|
|
|
|
TDECModule* CPP_FACTORY(QWidget *parent, const char *name) {
|
|
|
|
return return_instance(parent, name);
|
|
|
|
return return_instance(parent, name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|