From 9ba04742771370f59740e32e11c5f3a1e6a1b70a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 5 Dec 2011 15:55:57 -0600 Subject: Initial TQt conversion --- dcoppython/README | 8 +- dcoppython/lib/pydcop.py | 2 +- dcoppython/shell/gen_marshal_code.py | 6 +- dcoppython/shell/marshal_funcs.data | 84 ++++++++--------- dcoppython/shell/marshaller.cpp | 40 ++++---- dcoppython/shell/marshaller.h | 36 ++++---- dcoppython/shell/pcop.cpp | 102 ++++++++++----------- dcoppython/shell/pcop.h | 54 +++++------ dcoppython/test/README-server | 6 +- dcoppython/test/dcopserver/gen.py | 4 +- .../test/dcopserver/hi32-app-kdedcoptest.png | Bin 2749 -> 2750 bytes dcoppython/test/dcopserver/kdedcoptest.cpp | 2 +- dcoppython/test/server.py | 2 +- dcoppython/test/signal.py | 6 +- 14 files changed, 176 insertions(+), 176 deletions(-) (limited to 'dcoppython') diff --git a/dcoppython/README b/dcoppython/README index e5b8c3e8..e5ea18cd 100644 --- a/dcoppython/README +++ b/dcoppython/README @@ -19,13 +19,13 @@ pcop.cpp includes a header file marshal_funcs.h, which is generated from a data file called marshal_funcs.data by a converter script, gen_marshal_funcs.py marshal_funcs.data contains the basic code necessary to marshal and demarshal the different -types that DCOP can handle. For example, it codes how to convert a QString for use by Python +types that DCOP can handle. For example, it codes how to convert a TQString for use by Python (in this case, a Python string) and the reverse - what the user may supply in Python when -DCOP requires a QString. In addition to the fundemental types, more complex QT classes are -coded, such as QRect (which converts to a Python tuple ( (x1,y1), (x2,y2) ) ). +DCOP retquires a TQString. In addition to the fundemental types, more complex QT classes are +coded, such as TQRect (which converts to a Python tuple ( (x1,y1), (x2,y2) ) ). Documentation is auto-generated out of marshal_funcs.data, creating file marshal_funcs_doc.html, -which details how each DCOP type (e.g. QString, QRect, int, QCStringList) is represented in Python. +which details how each DCOP type (e.g. TQString, TQRect, int, TQCStringList) is represented in Python. In this implementation, each DCOP type is represented by a basic Python type - numeric, tuple, etc. There are no "QT bindings" necessary. diff --git a/dcoppython/lib/pydcop.py b/dcoppython/lib/pydcop.py index 0333b742..81875bd7 100644 --- a/dcoppython/lib/pydcop.py +++ b/dcoppython/lib/pydcop.py @@ -115,7 +115,7 @@ class DCOPServerObject: methods is a list of tuple pairs. Each pair consists of the method signature and the Python method that handles it. - For example, setMethods([ ('QString cheeseType()', self.cheese_type), + For example, setMethods([ ('TQString cheeseType()', self.cheese_type), ('void setGreatWines(bool perthPink, bool hobartMuddy, bool chateauChunder)') """ pcop.set_method_list(self.dcop_obj, methods) diff --git a/dcoppython/shell/gen_marshal_code.py b/dcoppython/shell/gen_marshal_code.py index c24c8760..b6ae516f 100644 --- a/dcoppython/shell/gen_marshal_code.py +++ b/dcoppython/shell/gen_marshal_code.py @@ -34,7 +34,7 @@ class DictMaker: def handle_string_marsh(self, attribute): """Handle marshalling of string item from the dictionary.""" return ["if (%s && !PyString_Check(%s)) return false;" % (attribute, attribute), - "if (%s) { qobj.%s(QString(PyString_AsString(%s)));" % (attribute, set_method(attribute), attribute), + "if (%s) { qobj.%s(TQString(PyString_AsString(%s)));" % (attribute, set_method(attribute), attribute), "PyDict_DelItemString(dict,(char*)\"%s\"); } " % (attribute)] def handle_string_demarsh(self, attribute): @@ -197,11 +197,11 @@ for l in in_file.readlines(): if m.groups()[0]: current_operation = DEMARSHAL code.append("PyObject *demarshal_" + current_type + \ - "(QDataStream *str)") + "(TQDataStream *str)") else: current_operation = MARSHAL code.append("bool marshal_" + current_type + \ - "(PyObject *obj, QDataStream *str)") + "(PyObject *obj, TQDataStream *str)") dict_maker.set_operation(current_operation) continue diff --git a/dcoppython/shell/marshal_funcs.data b/dcoppython/shell/marshal_funcs.data index abb3a43e..22b36c26 100644 --- a/dcoppython/shell/marshal_funcs.data +++ b/dcoppython/shell/marshal_funcs.data @@ -1,14 +1,14 @@ // This file contains the C++ code necessary marshal and demarshal // all the _simple_ types that dcoppython can understand. // "Simple" types are types that do not contain other types. -// So, int and QString are simple types; QDict, QMap and QStringList are not. +// So, int and TQString are simple types; TQDict, TQMap and TQStringList are not. // This file is processed by gen_marshal_code.py to produce a header // file, which is included by marshaller.cpp // // Marshalling: // The code in the "marshal" section has the following variables available: // PyObject * obj; // the object to marshal -// QDataStream *str; // the stream to marshal to +// TQDataStream *str; // the stream to marshal to // The function should return true if the object can be marshalled. // str may be NULL. If so, the function should ignore the actually marshalling // and merely return true or false, depending on whether the object _could_ @@ -16,7 +16,7 @@ // // Demarshalling: // The code in the "demarshal" section has the following variables available: -// QDataStream *str; // the stream to demarshal from +// TQDataStream *str; // the stream to demarshal from // The function should return a PyObject* which is a reference to the // newly created object. Ownership of the reference should be passed to // the caller. The function can return null if for any reason it @@ -175,7 +175,7 @@ type:char %% -type:QByteArray +type:TQByteArray %% marshal { PyBufferProcs *pb = obj->ob_type->tp_as_buffer; @@ -198,7 +198,7 @@ type:QByteArray return false; if (str) { - QByteArray a; + TQByteArray a; a.setRawData( (const char*)data, size ); (*str) << a; a.resetRawData( (const char*)data, size ); @@ -213,7 +213,7 @@ type:QByteArray %% demarshal { // Demarshal to a writable buffer object - QByteArray a; + TQByteArray a; (*str) >> a; uint size = a.size(); @@ -241,51 +241,51 @@ type:QByteArray } %% -type:QString +type:TQString %doc as str s %% marshal { if (!PyString_Check(obj)) return false; if (str) { - QString s( PyString_AsString(obj) ); + TQString s( PyString_AsString(obj) ); (*str) << s; } return true; } %% demarshal { - QString s; + TQString s; (*str) >> s; return PyString_FromString( s.utf8().data() ); } %% -type:QCString +type:TQCString %doc as str s %% marshal { if (!PyString_Check(obj)) return false; if (str) { - QCString s( PyString_AsString(obj) ); + TQCString s( PyString_AsString(obj) ); (*str) << s; } return true; } %% demarshal { - QCString s; + TQCString s; (*str) >> s; return PyString_FromString( s.data() ); } %% -type:QRect +type:TQRect %doc as ( (int x1, int y1), (int x2, int y2) ) %doc as ( int x1, int y1, int x2, int y2 ) %% from_pyobj { int xp1, yp1, xp2, yp2; - QRect r; + TQRect r; *ok=false; if (!PyTuple_Check(obj)) return r; if (!PyArg_ParseTuple(obj, (char*)"(ii)(ii)", &xp1, &yp1, &xp2, &yp2) && @@ -308,12 +308,12 @@ type:QRect %defaultcode %% -type:QPoint +type:TQPoint %doc as (int x, int y) %% from_pyobj { int x,y; - QPoint p; + TQPoint p; *ok=false; if (!PyTuple_Check(obj)) return p; if (!PyArg_ParseTuple(obj, (char*)"ii", &x, &y)) @@ -333,12 +333,12 @@ type:QPoint %defaultcode %% -type:QSize +type:TQSize %doc as (int width, int height) %% from_pyobj { int w,h; - QSize sz; + TQSize sz; *ok=false; if (!PyTuple_Check(obj)) return sz; if (!PyArg_ParseTuple(obj, (char*)"ii", &w, &h)) @@ -358,12 +358,12 @@ type:QSize %defaultcode %% -type:QColor +type:TQColor %doc as (int red, int green, int blue) %% from_pyobj { int r,g,b; - QColor c; + TQColor c; *ok=false; if (!PyTuple_Check(obj)) return c; if (!PyArg_ParseTuple(obj, (char*)"iii", &r, &g, &b)) @@ -382,16 +382,16 @@ type:QColor %defaultcode %% -type:QPointArray +type:TQPointArray %doc as [ (int x, int y), (int x, int y), (int x, int y), ... ] %% from_pyobj { *ok=false; - if (!PyList_Check(obj)) return QPointArray(); + if (!PyList_Check(obj)) return TQPointArray(); int size = PyList_Size(obj); - QPointArray pa(size); + TQPointArray pa(size); for(int c=0;c> count; @@ -124,7 +124,7 @@ namespace PythonDCOP { bool Marshaller::marshalDict(const PCOPType &key_type, const PCOPType &value_type, PyObject *obj, - TQDataStream *str) const { + TTQDataStream *str) const { if (!PyDict_Check(obj)) return false; @@ -149,7 +149,7 @@ namespace PythonDCOP { PyObject *Marshaller::demarshalDict(const PCOPType &key_type, const PCOPType &value_type, - TQDataStream *str) const { + TTQDataStream *str) const { PyObject *obj = PyDict_New(); Q_INT32 count; (*str) >> count; diff --git a/dcoppython/shell/marshaller.h b/dcoppython/shell/marshaller.h index 6cb16d89..5eefc800 100644 --- a/dcoppython/shell/marshaller.h +++ b/dcoppython/shell/marshaller.h @@ -15,7 +15,7 @@ #include #include -class TQDataStream; +class TTQDataStream; namespace PythonDCOP { // class Marshaller; @@ -25,23 +25,23 @@ namespace PythonDCOP { public: Marshaller(); ~Marshaller(); - bool marshal(const PCOPType &type, PyObject *obj, TQDataStream &str) const + bool marshal(const PCOPType &type, PyObject *obj, TTQDataStream &str) const { return marsh_private(type,obj,&str); } bool canMarshal(const PCOPType &type, PyObject *obj) const { return marsh_private(type,obj,NULL); } - bool marshalList(const PCOPType &list_type, PyObject *obj, TQDataStream *str) const; - PyObject *demarshal(const PCOPType &type, TQDataStream &str) const + bool marshalList(const PCOPType &list_type, PyObject *obj, TTQDataStream *str) const; + PyObject *demarshal(const PCOPType &type, TTQDataStream &str) const { return demarsh_private(type, &str); } - PyObject *demarshalList(const PCOPType &list_type, TQDataStream *str) const; + PyObject *demarshalList(const PCOPType &list_type, TTQDataStream *str) const; bool marshalDict(const PCOPType &key_type, const PCOPType &value_type, - PyObject *obj, TQDataStream *str) const; + PyObject *obj, TTQDataStream *str) const; PyObject *demarshalDict(const PCOPType &key_type, const PCOPType &value_type, - TQDataStream *str) const; + TTQDataStream *str) const; static Marshaller *instance() { return m_instance; } protected: - TQMap m_marsh_funcs; - TQMap m_demarsh_funcs; + TTQMap m_marsh_funcs; + TTQMap m_demarsh_funcs; static Marshaller *m_instance; @@ -49,21 +49,21 @@ namespace PythonDCOP { private: bool marsh_private(const PCOPType &type, PyObject *obj, - TQDataStream *str) const; + TTQDataStream *str) const; PyObject *demarsh_private(const PCOPType &type, - TQDataStream *str) const; + TTQDataStream *str) const; }; -// bool marshall_bool(PyObject *obj, TQDataStream *str); -// bool marshall_int(PyObject *obj, TQDataStream *str); -// bool marshall_uint(PyObject *obj, TQDataStream *str); -// bool marshall_double(PyObject *obj, TQDataStream *str); -// bool marshall_QByteArray(PyObject *obj, TQDataStream *str); -// bool marshall_QString(PyObject *obj, TQDataStream *str); -// bool marshall_QCString(PyObject *obj, TQDataStream *str); +// bool marshall_bool(PyObject *obj, TTQDataStream *str); +// bool marshall_int(PyObject *obj, TTQDataStream *str); +// bool marshall_uint(PyObject *obj, TTQDataStream *str); +// bool marshall_double(PyObject *obj, TTQDataStream *str); +// bool marshall_QByteArray(PyObject *obj, TTQDataStream *str); +// bool marshall_QString(PyObject *obj, TTQDataStream *str); +// bool marshall_QCString(PyObject *obj, TTQDataStream *str); } diff --git a/dcoppython/shell/pcop.cpp b/dcoppython/shell/pcop.cpp index 4989d863..42a75b4e 100644 --- a/dcoppython/shell/pcop.cpp +++ b/dcoppython/shell/pcop.cpp @@ -36,7 +36,7 @@ namespace PythonDCOP { } PCOPObject::PCOPObject(PyObject *py_obj, const char *objid) : - DCOPObject(TQCString(objid)), m_py_obj(py_obj) + DCOPObject(TTQCString(objid)), m_py_obj(py_obj) { m_methods.setAutoDelete(true); } @@ -45,8 +45,8 @@ namespace PythonDCOP { { } - bool PCOPObject::process(const TQCString &fun, const TQByteArray &data, - TQCString& replyType, TQByteArray &replyData) + bool PCOPObject::process(const TTQCString &fun, const TTQByteArray &data, + TTQCString& replyType, TTQByteArray &replyData) { bool result = py_process(fun,data,replyType,replyData); if (PyErr_Occurred()) { @@ -59,8 +59,8 @@ namespace PythonDCOP { return result; } - bool PCOPObject::py_process(const TQCString &fun, const TQByteArray &data, - TQCString& replyType, TQByteArray &replyData) + bool PCOPObject::py_process(const TTQCString &fun, const TTQByteArray &data, + TTQCString& replyType, TTQByteArray &replyData) { kdDebug(70001) << "PCOPObject::process - fun=" << fun << " replyType=" << replyType << endl; @@ -79,7 +79,7 @@ namespace PythonDCOP { // return false; // } - TQDataStream str_arg(data, IO_ReadOnly); + TTQDataStream str_arg(data, IO_ReadOnly); PyObject *args = PyTuple_New( meth->paramCount() ); for(int c=0;cparamCount();c++) { kdDebug(70001) << "Demarshalling type: " << meth->param(c)->signature() << endl; @@ -118,7 +118,7 @@ namespace PythonDCOP { replyType = meth->type()->signature(); PCOPType repl(replyType); if (repl.isMarshallable(result)) { - TQDataStream str_repl(replyData, IO_WriteOnly); + TTQDataStream str_repl(replyData, IO_WriteOnly); repl.marshal(result,str_repl); Py_DECREF(result); return true; @@ -139,15 +139,15 @@ namespace PythonDCOP { } - bool PCOPObject::setMethodList(TQAsciiDict meth_list) { + bool PCOPObject::setMethodList(TTQAsciiDict meth_list) { bool ok = true; - for(TQAsciiDictIterator it(meth_list); + for(TTQAsciiDictIterator it(meth_list); it.current(); ++it) { PCOPMethod *meth = NULL; if (ok) { - meth = new PCOPMethod(TQCString(it.currentKey())); + meth = new PCOPMethod(TTQCString(it.currentKey())); if (!meth || !meth->setPythonMethod(it.current())) { if (meth) delete meth; @@ -165,12 +165,12 @@ namespace PythonDCOP { return ok; } - QCStringList PCOPObject::functions() { - QCStringList funcs = DCOPObject::functions(); - for(TQAsciiDictIterator it(m_methods); + TQCStringList PCOPObject::functions() { + TQCStringList funcs = DCOPObject::functions(); + for(TTQAsciiDictIterator it(m_methods); it.current(); ++it) { PCOPMethod *meth = it.current(); - TQCString func = meth->type()->signature(); + TTQCString func = meth->type()->signature(); func += ' '; func += meth->signature(); funcs << func; @@ -184,7 +184,7 @@ namespace PythonDCOP { PyObject *PCOPObject::methodList() { PyObject *result = PyList_New(m_methods.count()); int c=0; - for(TQAsciiDictIterator it(m_methods); + for(TTQAsciiDictIterator it(m_methods); it.current(); ++it, ++c) { PyObject *tuple = PyTuple_New(2); PyList_SetItem(result, c, tuple); @@ -194,12 +194,12 @@ namespace PythonDCOP { return result; } - PCOPMethod *PCOPObject::matchMethod(const TQCString &fun) { + PCOPMethod *PCOPObject::matchMethod(const TTQCString &fun) { return m_methods.find(fun); } - PCOPType::PCOPType( const TQCString& type ) + PCOPType::PCOPType( const TTQCString& type ) { m_leftType = NULL; m_rightType = NULL; @@ -236,9 +236,9 @@ namespace PythonDCOP { if (m_rightType) delete m_rightType; } - TQCString PCOPType::signature() const + TTQCString PCOPType::signature() const { - TQCString str = m_type; + TTQCString str = m_type; if ( m_leftType ) { str += "<"; @@ -256,7 +256,7 @@ namespace PythonDCOP { return str; } - bool PCOPType::marshal( PyObject* obj, TQDataStream& str ) const + bool PCOPType::marshal( PyObject* obj, TTQDataStream& str ) const { return Marshaller::instance()->marshal(*this, obj, str); } @@ -266,12 +266,12 @@ namespace PythonDCOP { return Marshaller::instance()->canMarshal(*this, obj); } - PyObject* PCOPType::demarshal( TQDataStream& str ) const + PyObject* PCOPType::demarshal( TTQDataStream& str ) const { return Marshaller::instance()->demarshal(*this, str); } - PCOPMethod::PCOPMethod( const TQCString& signature ) : + PCOPMethod::PCOPMethod( const TTQCString& signature ) : m_py_method(NULL) { @@ -298,7 +298,7 @@ namespace PythonDCOP { m_name = signature.mid( k + 1, i - k - 1 ); // Strip the parameters - TQCString p = signature.mid( i + 1, j - i - 1 ).stripWhiteSpace(); + TTQCString p = signature.mid( i + 1, j - i - 1 ).stripWhiteSpace(); if ( !p.isEmpty() ) { // Make the algorithm terminate @@ -335,7 +335,7 @@ namespace PythonDCOP { m_signature = m_name; m_signature += "("; - QListIterator it( m_params ); + TQListIterator it( m_params ); for( ; it.current(); ++it ) { if ( !it.atFirst() ) @@ -385,11 +385,11 @@ namespace PythonDCOP { return ((PCOPMethod*)this)->m_params.at( i ); } - PCOPClass::PCOPClass( const QCStringList& methods ) + PCOPClass::PCOPClass( const TQCStringList& methods ) { m_methods.setAutoDelete( true ); - QCStringList::ConstIterator it = methods.begin(); + TQCStringList::ConstIterator it = methods.begin(); for( ; it != methods.end(); ++it ) { PCOPMethod* m = new PCOPMethod( *it ); @@ -401,12 +401,12 @@ namespace PythonDCOP { { } - const PCOPMethod* PCOPClass::method( const TQCString &name, PyObject *argTuple ) + const PCOPMethod* PCOPClass::method( const TTQCString &name, PyObject *argTuple ) { if ( !argTuple ) return m_methods[ name ]; - TQAsciiDictIterator it( m_methods ); + TTQAsciiDictIterator it( m_methods ); for (; it.current(); ++it ) if ( it.currentKey() == name && it.current()->paramCount() == PyTuple_Size( argTuple ) ) @@ -440,7 +440,7 @@ namespace PythonDCOP { ImportedModules::setInstance( new ImportedModules ); int argc = 0; char **argv = NULL; - m_qapp = new TQApplication(argc,argv,false); + m_qapp = new TTQApplication(argc,argv,false); } Client::~Client() @@ -488,14 +488,14 @@ namespace PythonDCOP { if ( !PyTuple_Check( tuple ) ) return NULL; - TQByteArray replyData; - TQCString replyType; - TQByteArray data; - TQDataStream params( data, IO_WriteOnly ); + TTQByteArray replyData; + TTQCString replyType; + TTQByteArray data; + TTQDataStream params( data, IO_WriteOnly ); - TQCString appname( arg1 ); - TQCString objname( arg2 ); - TQCString funcname( arg3 ); + TTQCString appname( arg1 ); + TTQCString objname( arg2 ); + TTQCString funcname( arg3 ); // // Remove escape characters @@ -511,14 +511,14 @@ namespace PythonDCOP { // Determine which functions are available. // bool ok = false; - QCStringList funcs = dcop->remoteFunctions( appname, objname, &ok ); + TQCStringList funcs = dcop->remoteFunctions( appname, objname, &ok ); if ( !ok ) { PyErr_SetString( PyExc_RuntimeError, "Object is not accessible." ); return NULL; } - // for ( QCStringList::Iterator it = funcs.begin(); it != funcs.end(); ++it ) { + // for ( TQCStringList::Iterator it = funcs.begin(); it != funcs.end(); ++it ) { // qDebug( "%s", (*it).data() ); // } @@ -538,7 +538,7 @@ namespace PythonDCOP { return NULL; } - TQCString signature = m->signature(); + TTQCString signature = m->signature(); kdDebug(70001) << "The signature is " << signature.data() << endl; kdDebug(70001) << "The method takes " << m->paramCount() << " parameters" << endl; @@ -578,19 +578,19 @@ namespace PythonDCOP { // // ### Check wether that was sane PCOPType type( replyType ); - TQDataStream reply(replyData, IO_ReadOnly); + TTQDataStream reply(replyData, IO_ReadOnly); return type.demarshal( reply ); } PyObject* application_list( PyObject */*self*/, PyObject */*args*/ ) { - QCStringList apps = Client::instance()->dcop()->registeredApplications(); + TQCStringList apps = Client::instance()->dcop()->registeredApplications(); PyObject *l = PyList_New( apps.count() ); - QCStringList::ConstIterator it = apps.begin(); - QCStringList::ConstIterator end = apps.end(); + TQCStringList::ConstIterator it = apps.begin(); + TQCStringList::ConstIterator end = apps.end(); unsigned int i = 0; for (; it != end; ++it, i++ ) PyList_SetItem( l, i, PyString_FromString( (*it).data() ) ); @@ -601,7 +601,7 @@ namespace PythonDCOP { PyObject *object_list( PyObject */*self*/, PyObject *args) { const char *app; if (PyArg_ParseTuple(args, (char*)"s", &app)) { - QCStringList objects = Client::instance()->dcop()->remoteObjects(TQCString(app)); + TQCStringList objects = Client::instance()->dcop()->remoteObjects(TTQCString(app)); return make_py_list(objects); } return NULL; @@ -610,7 +610,7 @@ namespace PythonDCOP { PyObject *method_list( PyObject */*self*/, PyObject *args) { const char *app, *obj; if (PyArg_ParseTuple(args, (char*)"ss", &app, &obj)) { - QCStringList methods = Client::instance()->dcop()->remoteFunctions(TQCString(app), TQCString(obj) ); + TQCStringList methods = Client::instance()->dcop()->remoteFunctions(TTQCString(app), TTQCString(obj) ); return make_py_list(methods); } return NULL; @@ -620,7 +620,7 @@ namespace PythonDCOP { const char *appid; int add_pid = 1; if (PyArg_ParseTuple(args, (char*)"s|i", &appid, &add_pid)) { - TQCString actual_appid = Client::instance()->dcop()->registerAs(TQCString(appid), add_pid!=0); + TTQCString actual_appid = Client::instance()->dcop()->registerAs(TTQCString(appid), add_pid!=0); return PyString_FromString(actual_appid.data()); } return NULL; @@ -650,7 +650,7 @@ namespace PythonDCOP { PyList_Check(method_list)) { // extract each tuple from the list, aborting if any is invalid - TQAsciiDict meth_list; + TTQAsciiDict meth_list; int size = PyList_Size(method_list); for(int c=0;cdcop()->connectDCOPSignal(TQCString(sender), TQCString(senderObj), TQCString(signal), TQCString(receiverObj), TQCString(slot), (volint == 1)?true:false); + bool success = Client::instance()->dcop()->connectDCOPSignal(TTQCString(sender), TTQCString(senderObj), TTQCString(signal), TTQCString(receiverObj), TTQCString(slot), (volint == 1)?true:false); return Py_BuildValue("i", success?1:0); } return NULL; @@ -706,7 +706,7 @@ namespace PythonDCOP { const char *slot; if (PyArg_ParseTuple(args, (char*)"sssss", &sender, &senderObj, &signal, &receiverObj, &slot)) { - bool success = Client::instance()->dcop()->disconnectDCOPSignal(TQCString(sender), TQCString(senderObj), TQCString(signal), TQCString(receiverObj), TQCString(slot)); + bool success = Client::instance()->dcop()->disconnectDCOPSignal(TTQCString(sender), TTQCString(senderObj), TTQCString(signal), TTQCString(receiverObj), TTQCString(slot)); return Py_BuildValue("i", success?1:0); } return NULL; @@ -730,10 +730,10 @@ namespace PythonDCOP { // helpers - PyObject *make_py_list( const QCStringList &qt_list) { + PyObject *make_py_list( const TQCStringList &qt_list) { PyObject *l = PyList_New(qt_list.count()); uint c=0; - for(QCStringList::ConstIterator it = qt_list.begin(); + for(TQCStringList::ConstIterator it = qt_list.begin(); it!=qt_list.end(); ++it,c++) PyList_SetItem(l, c, PyString_FromString( (*it).data() ) ); diff --git a/dcoppython/shell/pcop.h b/dcoppython/shell/pcop.h index f9c2d26b..ee4e3094 100644 --- a/dcoppython/shell/pcop.h +++ b/dcoppython/shell/pcop.h @@ -20,7 +20,7 @@ #include #include -class TQDataStream; +class TTQDataStream; namespace PythonDCOP { class Client; @@ -41,7 +41,7 @@ namespace PythonDCOP { // helpers... void delete_dcop_object(void *vp); - PyObject *make_py_list(const QCStringList &qt_list); + PyObject *make_py_list(const TQCStringList &qt_list); /** * Used by the Python interface to talk to DCOP @@ -58,7 +58,7 @@ namespace PythonDCOP { DCOPClient *m_dcop; // ImportedModules *m_module; static Client *s_instance; - TQApplication *m_qapp; + TTQApplication *m_qapp; }; /** @@ -85,19 +85,19 @@ namespace PythonDCOP { * Process method fun, whose arguments are marshalled in data. * Set replyType to be the reply type and marshall the reply data into replyData. */ - virtual bool process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData); + virtual bool process(const TTQCString &fun, const TTQByteArray &data, TTQCString& replyType, TTQByteArray &replyData); /** * Return list of supported functions (methods). */ - virtual QCStringList functions(); + virtual TQCStringList functions(); /** * Set the list of methods that this object handles. * The key of the QT dictionary is the method signature; the data in * the dictionary is a pointer to the python method to which it corresponds. */ - virtual bool setMethodList(TQAsciiDict meth_list); + virtual bool setMethodList(TTQAsciiDict meth_list); /** * Returns the current list of methods, as set by setMethodList. @@ -108,10 +108,10 @@ namespace PythonDCOP { * Matches an 'incoming' method signature (fun) and returns a PCOPMethod pointer, * or NULL if none match. */ - PCOPMethod *matchMethod(const TQCString &fun); + PCOPMethod *matchMethod(const TTQCString &fun); private: - virtual bool py_process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData); + virtual bool py_process(const TTQCString &fun, const TTQByteArray &data, TTQCString& replyType, TTQByteArray &replyData); /** * The Python object holding this CObject. @@ -121,7 +121,7 @@ namespace PythonDCOP { /** * The list of methods this object supports. */ - TQAsciiDict m_methods; + TTQAsciiDict m_methods; }; @@ -131,23 +131,23 @@ namespace PythonDCOP { class PCOPType { public: - PCOPType( const TQCString& dcop_representation); + PCOPType( const TTQCString& dcop_representation); ~PCOPType(); - TQCString signature() const; + TTQCString signature() const; - PyObject* demarshal( TQDataStream& str ) const; - bool marshal( PyObject* obj, TQDataStream& str ) const; + PyObject* demarshal( TTQDataStream& str ) const; + bool marshal( PyObject* obj, TTQDataStream& str ) const; // checks if the given PyObject can be marshalled as this PCOPType bool isMarshallable( PyObject *obj ) const; - const TQCString &type() const { return m_type; } + const TTQCString &type() const { return m_type; } const PCOPType *leftType() const { return m_leftType; } const PCOPType *rightType() const { return m_rightType; } // TODO: make these private - TQCString m_type; + TTQCString m_type; PCOPType* m_leftType; PCOPType* m_rightType; @@ -159,25 +159,25 @@ namespace PythonDCOP { class PCOPMethod { public: - PCOPMethod( const TQCString& dcop_signature ); + PCOPMethod( const TTQCString& dcop_signature ); ~PCOPMethod(); int paramCount() const; -// TQCString signature() const; -// TQCString name() const; +// TTQCString signature() const; +// TTQCString name() const; PCOPType* param( int ); const PCOPType* param( int ) const; bool setPythonMethod(PyObject *py_method); PyObject *pythonMethod() const { return m_py_method; } - const TQCString &signature() const { return m_signature; } - const TQCString &name() const { return m_name; } + const TTQCString &signature() const { return m_signature; } + const TTQCString &name() const { return m_name; } const PCOPType *type() const { return m_type; } - TQCString m_signature; - TQCString m_name; + TTQCString m_signature; + TTQCString m_name; PCOPType* m_type; - QList m_params; + TQList m_params; private: PyObject *m_py_method; }; @@ -188,13 +188,13 @@ namespace PythonDCOP { class PCOPClass { public: - PCOPClass( const QCStringList& dcop_style_methods); + PCOPClass( const TQCStringList& dcop_style_methods); ~PCOPClass(); - const PCOPMethod* method( const TQCString &name, PyObject *argTuple = 0 ); + const PCOPMethod* method( const TTQCString &name, PyObject *argTuple = 0 ); - QCStringList m_ifaces; - TQAsciiDict m_methods; + TQCStringList m_ifaces; + TTQAsciiDict m_methods; }; } diff --git a/dcoppython/test/README-server b/dcoppython/test/README-server index 3d2528b8..b11aa07f 100644 --- a/dcoppython/test/README-server +++ b/dcoppython/test/README-server @@ -6,9 +6,9 @@ Run python server.py, then in another console: qt parrot [julian] julian$ dcop `dcop | grep petshop` parrot -QCStringList interfaces() -QCStringList functions() -QString squawk(QString) +TTQCStringList interfaces() +TTQCStringList functions() +TTQString squawk(TQString) void setAge(int) int age() [julian] julian$ dcop `dcop | grep petshop` parrot setAge 5 diff --git a/dcoppython/test/dcopserver/gen.py b/dcoppython/test/dcopserver/gen.py index ae2947af..26f21113 100644 --- a/dcoppython/test/dcopserver/gen.py +++ b/dcoppython/test/dcopserver/gen.py @@ -1,8 +1,8 @@ #!/usr/bin/env python -type_list = ['KURL', 'QDate', 'QTime', 'QDateTime', 'QRect', 'QString', 'int', 'QFont', 'QSize', 'QPoint', 'QPointArray' ] +type_list = ['KURL', 'TQDate', 'TQTime', 'TQDateTime', 'TQRect', 'TQString', 'int', 'TQFont', 'TQSize', 'TQPoint', 'TQPointArray' ] -inc_exceptions = {'QDate': None, 'QTime': None, 'KURL' : 'kurl'} +inc_exceptions = {'TQDate': None, 'TQTime': None, 'KURL' : 'kurl'} iface_inc_list = ['dcopobject'] diff --git a/dcoppython/test/dcopserver/hi32-app-kdedcoptest.png b/dcoppython/test/dcopserver/hi32-app-kdedcoptest.png index 45ae1a11..a8c927b0 100644 Binary files a/dcoppython/test/dcopserver/hi32-app-kdedcoptest.png and b/dcoppython/test/dcopserver/hi32-app-kdedcoptest.png differ diff --git a/dcoppython/test/dcopserver/kdedcoptest.cpp b/dcoppython/test/dcopserver/kdedcoptest.cpp index e7c8b49a..849c9abc 100644 --- a/dcoppython/test/dcopserver/kdedcoptest.cpp +++ b/dcoppython/test/dcopserver/kdedcoptest.cpp @@ -15,7 +15,7 @@ KDEDcopTest::KDEDcopTest() // set the shell's ui resource file //setXMLFile("kdedcoptestui.rc"); - //new TQLabel( "Hello World", this, "hello label" ); + //new TTQLabel( "Hello World", this, "hello label" ); m_mainClass = new MainClass(); } diff --git a/dcoppython/test/server.py b/dcoppython/test/server.py index 479b0236..957f6d94 100644 --- a/dcoppython/test/server.py +++ b/dcoppython/test/server.py @@ -19,7 +19,7 @@ class ParrotObject(pydcop.DCOPServerObject): self.setMethods( [ ('int age()', self.get_age), ('void setAge(int)', self.set_age), - ('QString squawk(QString)', self.squawk), + ('TQString squawk(TQString)', self.squawk), ]) # set up object variables diff --git a/dcoppython/test/signal.py b/dcoppython/test/signal.py index f9d087c6..72aa1385 100644 --- a/dcoppython/test/signal.py +++ b/dcoppython/test/signal.py @@ -16,7 +16,7 @@ class MyObject(pydcop.DCOPServerObject): # DCOP needs types, so we need to initialise the object with the methods that # it's going to provide. - self.setMethods( [('void test(QString)', self.test)]) + self.setMethods( [('void test(TQString)', self.test)]) def test(self, data): print "New Weather for " + data @@ -28,9 +28,9 @@ pytest = MyObject() sender = "KWeatherService" senderObj = "WeatherService" -signal = "fileUpdate(QString)" +signal = "fileUpdate(TQString)" receiverObj = "pythontest" -slot = "test(QString)" +slot = "test(TQString)" volatile = 1 pydcop.connectDCOPSignal(sender,senderObj,signal,receiverObj,slot,volatile) -- cgit v1.2.3