summaryrefslogtreecommitdiffstats
path: root/wineconfig/kcm_wineconfig.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-09-23 19:40:50 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-09-23 19:40:50 -0500
commitd28ae74d212baba2c12bbb61c43a4bf348cd0153 (patch)
tree455d1bb252fc2dc6742f9a2d3afc94fbb1ffb122 /wineconfig/kcm_wineconfig.cpp
parent138f1893d0aa1fa54f9fd55674a5fc8e24aa07b5 (diff)
downloadtde-guidance-d28ae74d212baba2c12bbb61c43a4bf348cd0153.tar.gz
tde-guidance-d28ae74d212baba2c12bbb61c43a4bf348cd0153.zip
Convert remaining modules to TQt3
This relates to Bug 1995
Diffstat (limited to 'wineconfig/kcm_wineconfig.cpp')
-rw-r--r--wineconfig/kcm_wineconfig.cpp66
1 files changed, 29 insertions, 37 deletions
diff --git a/wineconfig/kcm_wineconfig.cpp b/wineconfig/kcm_wineconfig.cpp
index b275c46..cc478cf 100644
--- a/wineconfig/kcm_wineconfig.cpp
+++ b/wineconfig/kcm_wineconfig.cpp
@@ -1,10 +1,10 @@
/*
* pykcm_launcher.cpp
- *
+ *
* Launch Control Centre modules written in Python using an embedded Python
* interpreter.
- * Based on David Boddie's PyKDE-components.
+ * Based on David Boddie's PyTDE-components.
*/
// pythonize.h must be included first.
@@ -15,17 +15,15 @@
#include <klibloader.h>
#include <kstandarddirs.h>
#include <ksimpleconfig.h>
-#include <qstring.h>
+#include <tqstring.h>
#include <sip.h>
-#define MODULE_DIR "/opt/trinity/share/apps/guidance"
-#define EXTRA_MODULE_DIR "/opt/trinity/share/python-support/tde-guidance-trinity"
-#define EXTRA_MODULE_DIR_TWO "/opt/trinity/share/python-support/guidance-backends-trinity"
-#define EXTRA_MODULE_DIR_THREE "/opt/trinity/share/python-support/tde-guidance-powermanager-trinity"
+#define MODULE_DIR "/root/TEMP5/tde-guidance-trinity-14.0.0-r131/debian/tmp/opt/trinity/share/apps/guidance"
+#define EXTRA_MODULE_DIR "None"
#define MODULE_NAME "wineconfig"
#define FACTORY "create_wineconfig"
#define CPP_FACTORY create_wineconfig
-#define LIB_PYTHON "libpython2.5.so"
+#define LIB_PYTHON "libpython2.7.so"
#define debug 1
static TDECModule *report_error(char *msg) {
@@ -33,48 +31,42 @@ static TDECModule *report_error(char *msg) {
return NULL;
}
-static TDECModule* return_instance( QWidget *parent, const char *name ) {
+static TDECModule* return_instance( TQWidget *parent, const char *name ) {
TDECModule* tdecmodule;
- PyObject *pyTDECModuleTuple;
+ PyObject *pyTDECModuleTuple;
PyObject *pyTDECModule;
Pythonize *pyize; // Pythonize object to manage the Python interpreter.
int isErr;
-
+
// Try to determine what py script we're loading. Note that "name"
// typically appears to be NULL.
- QString script(MODULE_NAME);
+ TQString script(MODULE_NAME);
// Reload libpython, but this time tell the runtime linker to make the
// symbols global and available for later loaded libraries/module.
KLibLoader::self()->globalLibrary(LIB_PYTHON);
-
+
// Start the interpreter.
pyize = initialize();
if (!pyize) {
return report_error ("***Failed to start interpreter\n");
}
-
+
// Add the path to the python script to the interpreter search path.
- QString path = QString(MODULE_DIR);
- if(path == QString::null) {
+ TQString path = TQString(MODULE_DIR);
+ if(path == TQString::null) {
return report_error ("***Failed to locate script path");
}
if(!pyize->appendToSysPath (path.latin1 ())) {
return report_error ("***Failed to set sys.path\n");
}
- QString extrapath = QString(EXTRA_MODULE_DIR);
+
+ // Add the extra path to the python script to the interpreter search path.
+ TQString extrapath = TQString(EXTRA_MODULE_DIR);
if(!pyize->appendToSysPath (extrapath.latin1 ())) {
- return report_error ("***Failed to set extra sys.path\n");
- }
- QString extrapath_two = QString(EXTRA_MODULE_DIR_TWO);
- if(!pyize->appendToSysPath (extrapath_two.latin1 ())) {
- return report_error ("***Failed to set extra 2 sys.path\n");
+ return report_error ("***Failed to set extra sys.path\n");
}
- QString extrapath_three = QString(EXTRA_MODULE_DIR_THREE);
- if(!pyize->appendToSysPath (extrapath_three.latin1 ())) {
- return report_error ("***Failed to set extra 3 sys.path\n");
- }
-
+
// Load the Python script.
PyObject *pyModule = pyize->importModule ((char *)script.latin1 ());
if(!pyModule) {
@@ -83,14 +75,14 @@ static TDECModule* return_instance( QWidget *parent, const char *name ) {
}
// Inject a helper function
- QString bridge = QString("import sip\n"
- "import qt\n"
+ TQString bridge = TQString("from sip4_tqt import sip\n"
+ "from python_tqt import qt\n"
"def kcontrol_bridge_" FACTORY "(parent,name):\n"
" if parent!=0:\n"
#if SIP_VERSION >= 0x040200
- " wparent = sip.wrapinstance(parent,qt.QWidget)\n"
-#else
- " wparent = sip.wrapinstance(parent,'QWidget')\n"
+ " wparent = sip.wrapinstance(parent,qt.TQWidget)\n"
+#else
+ " wparent = sip.wrapinstance(parent,'TQWidget')\n"
#endif
" else:\n"
" wparent = None\n"
@@ -103,7 +95,7 @@ static TDECModule* return_instance( QWidget *parent, const char *name ) {
if(!kcmFactory) {
return report_error ("***failed to find module factory\n");
}
-
+
// Call the factory function. Set up the args.
PyObject *pyParent = PyLong_FromVoidPtr(parent);
PyObject *pyName = PyString_FromString(MODULE_NAME);
@@ -125,7 +117,7 @@ static TDECModule* return_instance( QWidget *parent, const char *name ) {
// Stop this from getting garbage collected.
Py_INCREF(PyTuple_GET_ITEM(pyTDECModuleTuple,0));
-
+
// convert the TDECModule PyObject to a real C++ TDECModule *.
isErr = 0;
pyTDECModule = PyTuple_GET_ITEM(pyTDECModuleTuple,1);
@@ -134,8 +126,8 @@ static TDECModule* return_instance( QWidget *parent, const char *name ) {
return report_error ("***failed sip conversion to C++ pointer\n");
}
pyize->decref(pyTDECModuleTuple);
-
- // PyKDE 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
// it back before exiting. At this point, we no longer need
// it.
@@ -150,7 +142,7 @@ static TDECModule* return_instance( QWidget *parent, const char *name ) {
extern "C" {
// Factory function that kcontrol will call.
- TDECModule* CPP_FACTORY(QWidget *parent, const char *name) {
+ TDECModule* CPP_FACTORY(TQWidget *parent, const char *name) {
return return_instance(parent, name);
}
}