diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /dcoppython | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'dcoppython')
-rw-r--r-- | dcoppython/README | 8 | ||||
-rw-r--r-- | dcoppython/lib/pydcop.py | 2 | ||||
-rw-r--r-- | dcoppython/shell/gen_marshal_code.py | 6 | ||||
-rw-r--r-- | dcoppython/shell/marshal_funcs.data | 84 | ||||
-rw-r--r-- | dcoppython/shell/marshaller.cpp | 40 | ||||
-rw-r--r-- | dcoppython/shell/marshaller.h | 36 | ||||
-rw-r--r-- | dcoppython/shell/pcop.cpp | 102 | ||||
-rw-r--r-- | dcoppython/shell/pcop.h | 54 | ||||
-rw-r--r-- | dcoppython/test/README-server | 6 | ||||
-rw-r--r-- | dcoppython/test/dcopserver/gen.py | 4 | ||||
-rw-r--r-- | dcoppython/test/dcopserver/hi32-app-kdedcoptest.png | bin | 2749 -> 2750 bytes | |||
-rw-r--r-- | dcoppython/test/dcopserver/kdedcoptest.cpp | 2 | ||||
-rw-r--r-- | dcoppython/test/server.py | 2 | ||||
-rw-r--r-- | dcoppython/test/signal.py | 6 |
14 files changed, 176 insertions, 176 deletions
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<size;c++) { - QPoint p = fromPyObject_QPoint(PyList_GetItem(obj,c), ok); + TQPoint p = fromPyObject_QPoint(PyList_GetItem(obj,c), ok); if (!*ok) return false; pa.setPoint(c,p); } @@ -415,17 +415,17 @@ type:QPointArray %defaultcode %% -type:QDate +type:TQDate %doc as (int year, int month, int day) %% from_pyobj { *ok=false; - if (!PyTuple_Check(obj)) return QDate(); + if (!PyTuple_Check(obj)) return TQDate(); int y,m,d; if (!PyArg_ParseTuple(obj, (char*)"iii", &y, &m, &d)) - return QDate(); + return TQDate(); *ok=true; - return QDate(y,m,d); + return TQDate(y,m,d); } %% to_pyobj { @@ -437,17 +437,17 @@ type:QDate %defaultcode %% -type:QTime +type:TQTime %doc as (int hour, int minute, int second=0, int millisecond=0) %% from_pyobj { *ok=false; - if (!PyTuple_Check(obj)) return QTime(); + if (!PyTuple_Check(obj)) return TQTime(); int h,m,s=0,ms=0; if (!PyArg_ParseTuple(obj, (char*)"ii|ii", &h, &m, &s, &ms)) - return QTime(); + return TQTime(); *ok=true; - return QTime(h,m,s,ms); + return TQTime(h,m,s,ms); } %% to_pyobj { @@ -459,7 +459,7 @@ type:QTime %defaultcode %% -type:QDateTime +type:TQDateTime %doc as ( (int year, int month, int day), (int hour, int minute, int second=0, int millsecond=0) ) %doc as long unixDate %% from_pyobj @@ -468,27 +468,27 @@ type:QDateTime if (PyLong_Check(obj)) { *ok=true; - QDateTime dt; + TQDateTime dt; dt.setTime_t( (uint)PyLong_AsLong(obj) ); return dt; } if (PyInt_Check(obj)) { *ok=true; - QDateTime dt; + TQDateTime dt; dt.setTime_t( (uint)PyInt_AsLong(obj) ); return dt; } PyObject *date_tuple, *time_tuple; if (PyArg_ParseTuple(obj, (char*)"OO", &date_tuple, &time_tuple)) { - QDateTime dt; + TQDateTime dt; dt.setTime( fromPyObject_QTime(time_tuple, ok) ); if (*ok) dt.setDate( fromPyObject_QDate(date_tuple, ok) ); return dt; } - return QDateTime(); + return TQDateTime(); } %% to_pyobj { @@ -509,7 +509,7 @@ type:KURL *ok=false; if (!PyString_Check(obj)) return KURL(); *ok=true; - return KURL( QString(PyString_AsString(obj)) ); + return KURL( TQString(PyString_AsString(obj)) ); } %% to_pyobj { @@ -533,7 +533,7 @@ type:DCOPRef char *c_appname = PyString_AsString(appname); char *c_name = PyString_AsString(name); DCOPRef ref; - ref.setRef(QCString(c_appname), QCString(c_name) ); + ref.setRef(TQCString(c_appname), TQCString(c_name) ); Py_DECREF(appname); Py_DECREF(name); *ok=true; @@ -570,10 +570,10 @@ type:DCOPRef // if (PyArg_ParseTuple(obj,(char*)"ss|s", &dcopref_app, &dcopref_obj, &dcopref_type)) { // *ok=true; // if (dcopref_type) { -// DCOPRef dr(QCString(dcopref_app), QCString(dcopref_obj), QCString(dcopref_type)); +// DCOPRef dr(TQCString(dcopref_app), TQCString(dcopref_obj), TQCString(dcopref_type)); // return dr; // } -// DCOPRef dr(QCString(dcopref_app), QCString(dcopref_obj)); +// DCOPRef dr(TQCString(dcopref_app), TQCString(dcopref_obj)); // return dr; // } // return DCOPRef(); @@ -588,7 +588,7 @@ type:DCOPRef // %defaultcode // %% -// type:QFont +// type:TQFont // %% marshal // %constructor ("default") // %dict-map family:string,rawName:string diff --git a/dcoppython/shell/marshaller.cpp b/dcoppython/shell/marshaller.cpp index 1aaebc38..ff9843d4 100644 --- a/dcoppython/shell/marshaller.cpp +++ b/dcoppython/shell/marshaller.cpp @@ -43,18 +43,18 @@ namespace PythonDCOP { bool Marshaller::marsh_private(const PCOPType &type, PyObject *obj, - TQDataStream *str) const + TTQDataStream *str) const { - TQString ty = type.type(); + TTQString ty = type.type(); - if (ty=="TQStringList") - return marshalList(PCOPType("TQString"), obj, str); - if (ty=="QCStringList") - return marshalList(PCOPType("TQCString"), obj, str); - if (ty=="TQValueList" && type.leftType()) + if (ty=="TTQStringList") + return marshalList(PCOPType("TTQString"), obj, str); + if (ty=="TQCStringList") + return marshalList(PCOPType("TTQCString"), obj, str); + if (ty=="TTQValueList" && type.leftType()) return marshalList(*type.leftType(), obj, str); - if (ty=="TQMap" && type.leftType() && type.rightType()) + if (ty=="TTQMap" && type.leftType() && type.rightType()) return marshalDict(*type.leftType(), *type.rightType(), obj, str); if (!m_marsh_funcs.contains(ty)) return false; @@ -62,17 +62,17 @@ namespace PythonDCOP { } PyObject *Marshaller::demarsh_private(const PCOPType &type, - TQDataStream *str) const + TTQDataStream *str) const { - TQString ty = type.type(); + TTQString ty = type.type(); - if (ty=="TQStringList") - return demarshalList(PCOPType("TQString"), str); - if (ty=="QCStringList") - return demarshalList(PCOPType("TQCString"), str); - if (ty=="TQValueList" && type.leftType()) + if (ty=="TTQStringList") + return demarshalList(PCOPType("TTQString"), str); + if (ty=="TQCStringList") + return demarshalList(PCOPType("TTQCString"), str); + if (ty=="TTQValueList" && type.leftType()) return demarshalList(*type.leftType(), str); - if (ty=="TQMap" && type.leftType() && type.rightType()) + if (ty=="TTQMap" && type.leftType() && type.rightType()) return demarshalDict(*type.leftType(), *type.rightType(), str); if (!m_demarsh_funcs.contains(ty)) { @@ -91,7 +91,7 @@ namespace PythonDCOP { bool Marshaller::marshalList(const PCOPType &list_type, PyObject *obj, - TQDataStream *str) const { + TTQDataStream *str) const { if (!PyList_Check(obj)) return false; int count = PyList_Size(obj); @@ -110,7 +110,7 @@ namespace PythonDCOP { } PyObject *Marshaller::demarshalList(const PCOPType &list_type, - TQDataStream *str) const { + TTQDataStream *str) const { Q_UINT32 count; (*str) >> 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 <Python.h> #include <tqstring.h> -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<TQString,bool(*)(PyObject*,TQDataStream*)> m_marsh_funcs; - TQMap<TQString,PyObject*(*)(TQDataStream*)> m_demarsh_funcs; + TTQMap<TTQString,bool(*)(PyObject*,TTQDataStream*)> m_marsh_funcs; + TTQMap<TTQString,PyObject*(*)(TTQDataStream*)> 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;c<meth->paramCount();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<PyObject> meth_list) { + bool PCOPObject::setMethodList(TTQAsciiDict<PyObject> meth_list) { bool ok = true; - for(TQAsciiDictIterator<PyObject> it(meth_list); + for(TTQAsciiDictIterator<PyObject> 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<PCOPMethod> it(m_methods); + TQCStringList PCOPObject::functions() { + TQCStringList funcs = DCOPObject::functions(); + for(TTQAsciiDictIterator<PCOPMethod> 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<PCOPMethod> it(m_methods); + for(TTQAsciiDictIterator<PCOPMethod> 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<PCOPType> it( m_params ); + TQListIterator<PCOPType> 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<PCOPMethod> it( m_methods ); + TTQAsciiDictIterator<PCOPMethod> 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<PyObject> meth_list; + TTQAsciiDict<PyObject> meth_list; int size = PyList_Size(method_list); for(int c=0;c<size;c++) { PyObject *tuple = PyList_GetItem(method_list,c); @@ -692,7 +692,7 @@ namespace PythonDCOP { int volint = 0; if (PyArg_ParseTuple(args, (char*)"sssss|i", &sender, &senderObj, &signal, &receiverObj, &slot, &volint)) { - bool success = Client::instance()->dcop()->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 <dcopclient.h> #include <dcopobject.h> -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<PyObject> meth_list); + virtual bool setMethodList(TTQAsciiDict<PyObject> 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<PCOPMethod> m_methods; + TTQAsciiDict<PCOPMethod> 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<PCOPType> m_params; + TQList<PCOPType> 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<PCOPMethod> m_methods; + TQCStringList m_ifaces; + TTQAsciiDict<PCOPMethod> 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 Binary files differindex 45ae1a11..a8c927b0 100644 --- a/dcoppython/test/dcopserver/hi32-app-kdedcoptest.png +++ b/dcoppython/test/dcopserver/hi32-app-kdedcoptest.png 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) |