summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-03 22:23:44 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-03 22:23:44 -0600
commit203ba231d0276943aae36111f9ec1e949f3c6a4c (patch)
treef039f7a5b5fc2da88a96876971bac580d87f6788 /extensions
parentfd35f4a8382b7d223bc0325b9ca3f88515778aa0 (diff)
downloadpytde-203ba231d0276943aae36111f9ec1e949f3c6a4c.tar.gz
pytde-203ba231d0276943aae36111f9ec1e949f3c6a4c.zip
Initial TQt conversion
Diffstat (limited to 'extensions')
-rw-r--r--extensions/dcopexport.py22
-rw-r--r--extensions/dcopext.py26
2 files changed, 24 insertions, 24 deletions
diff --git a/extensions/dcopexport.py b/extensions/dcopexport.py
index 5980ed2..7347be6 100644
--- a/extensions/dcopexport.py
+++ b/extensions/dcopexport.py
@@ -44,19 +44,19 @@ return value to be returned to the caller.
DCOPExMeth is basically a data structure to hold the parsed method info
(name, arg list, return type, signature)
-This module requires the dcopext module, but only for the numericTypes and
+This module retquires the dcopext module, but only for the numericTypes and
stringTypes lists
"""
from dcop import DCOPObject, DCOPClient
from tdecore import dcop_add, dcop_next
-from qt import QString, QCString, QDataStream, IO_ReadOnly, IO_WriteOnly
+from qt import TQString, TQCString, TQDataStream, IO_ReadOnly, IO_WriteOnly
numericTypes = ["char", "bool", "short", "int", "long", "uchar", "ushort", "uint", "ulong",
"unsigned char", "unsigned short", "unsigned int", "unsigned long",
"Q_INT32", "pid_t", "float", "double"]
-stringTypes = ["QString", "QCString"]
+stringTypes = ["TQString", "TQCString"]
class DCOPExObj (DCOPObject):
def __init__ (self, objid = None):
@@ -77,25 +77,25 @@ class DCOPExObj (DCOPObject):
return DCOPObject.process(self, meth, data, replyType, replyData);
# demarshall the arg list for the actual method call and call the method
- s = QDataStream (data, IO_ReadOnly)
+ s = TQDataStream (data, IO_ReadOnly)
arglist = []
count = len (self.method.argtypes)
if count == 0:
result = self.method.pymethod ()
else:
for i in range (len (self.method.argtypes)):
- arglist.append (dcop_next (s, QCString (self.method.argtypes [i])))
+ arglist.append (dcop_next (s, TQCString (self.method.argtypes [i])))
result = self.method.pymethod (*arglist)
# marshall the result as 'replyData'
if self.method.rtype != "void":
- s = QDataStream (replyData, IO_WriteOnly)
+ s = TQDataStream (replyData, IO_WriteOnly)
if self.method.rtype in numericTypes:
dcop_add (s, result, self.method.rtype)
elif self.method.rtype in stringTypes and isinstance (result, str):
dcop_add (s, eval ("%s('''%s''')" % (self.method.rtype, result)))
- elif self.method.rtype.startswith ("QMap") or self.method.rtype.startswith ("QValueList"):
+ elif self.method.rtype.startswith ("TQMap") or self.method.rtype.startswith ("TQValueList"):
dcop_add (params, args [i], self.argtypes [i])
else:
if not result:
@@ -104,7 +104,7 @@ class DCOPExObj (DCOPObject):
dcop_add (s, result)
# use append because we want to return the replyType reference,
- # not a new QCString
+ # not a new TQCString
replyType.append (self.method.rtype)
# success
@@ -121,13 +121,13 @@ class DCOPExObj (DCOPObject):
def someMethod (a, b):
return str (a + b)
- signature = "QString someMethod (int, int)"
+ signature = "TQString someMethod (int, int)"
pymethod = someMethod
self.addMethod (signature, pymethod)
note that in this case you could add a second entry:
- self.addMethod ("QString someMethod (float, float)", someMethod)
+ self.addMethod ("TQString someMethod (float, float)", someMethod)
pymethod can also be a class method, for example - self.someMethod or
someClass.someMethod. In the second case, someClass has to be an instance
@@ -136,7 +136,7 @@ class DCOPExObj (DCOPObject):
self.methods is a dict holding all of the methods exposed, indexed by
method signature. In the example above, the signature would be:
- someMethod(QString,QString)
+ someMethod(TQString,TQString)
or everything but the return type, which is stored in the dict entry.
The dict entry is a DCOPExMeth instance.
diff --git a/extensions/dcopext.py b/extensions/dcopext.py
index 0265891..bf63e96 100644
--- a/extensions/dcopext.py
+++ b/extensions/dcopext.py
@@ -32,7 +32,7 @@ copyright holder.
import re
from dcop import DCOPClient
-from qt import QString, QCString, QByteArray, QDataStream, IO_ReadOnly, IO_WriteOnly
+from qt import TQString, TQCString, TQByteArray, TQDataStream, IO_ReadOnly, IO_WriteOnly
from tdecore import dcop_add, dcop_next
# XXX: 64 bit integers might be handeld wrong! pythons int is AFAIK 32 bit,
@@ -43,7 +43,7 @@ from tdecore import dcop_add, dcop_next
# Q_LLONG, Q_ULLONG, Q_INT64, Q_UINT64
#
# and on some (most?) systems:
-# QtOffset
+# TQtOffset
# add complex? complex is c99, not c++
# but python has a complex type
@@ -55,9 +55,9 @@ typedefIntTypes = set(["uchar", "ushort", "uint", "ulong",
"uint8_t", "uint16_t", "uint32_t", "pid_t", "uid_t",
"off_t"])
# XXX string and std::string too?
-stringTypes = set(["QString", "QCString"])
-pythonStringTypes = set([QString, QCString, str])
-stringTypesDict = {"QString":QString,"QCString":QCString,"str":str,"unicode":unicode}
+stringTypes = set(["TQString", "TQCString"])
+pythonStringTypes = set([TQString, TQCString, str])
+stringTypesDict = {"TQString":TQString,"TQCString":TQCString,"str":str,"unicode":unicode}
VOID = 0
BOOLEAN = 1 # XXX bool is not supported by dcop_add, but maybe some time...
@@ -120,13 +120,13 @@ value the call returns. In this case, panelSize takes no arguments and
returns an int. 'ok' returns the status of the DCOP call (success = True,
failure = False).
- ok = d.Panel.addURLButton (QString ("http://www.kde.org"))
+ ok = d.Panel.addURLButton (TQString ("http://www.kde.org"))
-would call addURLButton with the required argument, and return nothing but the DCOP call
+would call addURLButton with the retquired argument, and return nothing but the DCOP call
status(since its return type is 'void').
Note that to instantiate a DCOPObj directly, you need to have a valid DCOPApp
-to pass to DCOPObj's __init__ method. Similarly, DCOPMeth requires a valid DCOPOBject.
+to pass to DCOPObj's __init__ method. Similarly, DCOPMeth retquires a valid DCOPOBject.
For example:
d = DCOPApp ("kicker", dcop)
@@ -667,11 +667,11 @@ class DCOPMeth(object):
return has
def __marshall(self, args, argtypes):
- data = QByteArray()
+ data = TQByteArray()
if argtypes == []:
return data
- params = QDataStream (data, IO_WriteOnly)
+ params = TQDataStream (data, IO_WriteOnly)
for arg, (argtype, argkind) in _xiter(args, argtypes):
if argkind == BOOLEAN:
@@ -688,12 +688,12 @@ class DCOPMeth(object):
dcop_add(params, arg)
- elif argtype.startswith("QMap") or argtype.startswith("QValueList"):
+ elif argtype.startswith("TQMap") or argtype.startswith("TQValueList"):
dcop_add(params, arg, argtype)
# XXX:
# Is 'isinstance(arg, eval(argtype))' really good?
- # What if 'argtype' is located in some modul? Like 'qt.QString'.
+ # What if 'argtype' is located in some modul? Like 'qt.TQString'.
# Then this will fail (but it should not!).
# And the worst thing: the eval() will raise a NameError!
#
@@ -715,7 +715,7 @@ class DCOPMeth(object):
return data
def __unmarshall(self, data, type_):
- s = QDataStream(data, IO_ReadOnly)
+ s = TQDataStream(data, IO_ReadOnly)
if str(type_) in stringTypes:
return unicode(dcop_next(s, type_))