diff options
Diffstat (limited to 'extensions/dcopexport.py')
-rw-r--r-- | extensions/dcopexport.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/extensions/dcopexport.py b/extensions/dcopexport.py index 6cb8b6b..7af07f1 100644 --- a/extensions/dcopexport.py +++ b/extensions/dcopexport.py @@ -59,8 +59,8 @@ numericTypes = ["char", "bool", "short", "int", "long", "uchar", "ushort", "uint stringTypes = ["TQString", "TQCString"] class DCOPExObj (DCOPObject): - def __init__ (self, objid = None): - if isinstance (objid, str): + def __init__(self, objid = None): + if isinstance (objid, bytes): DCOPObject.__init__ (self, objid) else: DCOPObject.__init__ (self) @@ -69,12 +69,12 @@ class DCOPExObj (DCOPObject): def process (self, meth, data, replyType, replyData): # normalize the method signature received - meth = str (DCOPClient.normalizeFunctionSignature (meth)).replace (">", "> ") + _meth = DCOPClient.normalizeFunctionSignature(meth).replace (">", "> ") # see if this method is available from us via DCOP # if we don't have it, maybe DCOPObject already provides it (eg - qt object) - if not self.matchMethod (meth): - return DCOPObject.process(self, meth, data, replyType, replyData); + if not self.matchMethod (_meth): + return DCOPObject.process(self, _meth, data, replyType, replyData); # demarshall the arg list for the actual method call and call the method s = TQDataStream (data, IO_ReadOnly) @@ -84,7 +84,7 @@ class DCOPExObj (DCOPObject): result = self.method.pymethod () else: for i in range (len (self.method.argtypes)): - arglist.append (dcop_next (s, TQCString (self.method.argtypes [i]))) + arglist.append (dcop_next (s, TQCString(self.method.argtypes[i]))) result = self.method.pymethod (*arglist) @@ -149,8 +149,9 @@ class DCOPExObj (DCOPObject): def matchMethod (self, meth): # find the method in the dict if it's there self.method = None - if meth in self.methods: - self.method = self.methods [meth] + _meth = meth.data() + if _meth in self.methods: + self.method = self.methods [_meth] return self.method != None def functions (self): @@ -158,7 +159,7 @@ class DCOPExObj (DCOPObject): # from the entries in the self.methods dict funcs = DCOPObject.functions (self) for func in self.methods.keys (): - funcs.append (" ".join ([self.methods [func].rtype, func])) + funcs.append((" ".join([self.methods[func].rtype, func])).encode()) return funcs; class DCOPExMeth: @@ -173,7 +174,7 @@ class DCOPExMeth: def parseMethod (self, method): # strip whitespace - method = str (DCOPClient.normalizeFunctionSignature (method)).replace (">", "> ") + method = DCOPClient.normalizeFunctionSignature(method.encode()).data().replace (">", "> ") # the return type (rtype) and signature (sig) self.rtype, tail = method.split (" ", 1) @@ -191,7 +192,7 @@ class DCOPExMeth: # the list of arg types self.argtypes = [] - args = tail [i + 1 : -1].split (",") + args = tail [i + 1 : -2].split (",") if args and args != [""]: for arg in args: self.argtypes.append (arg.strip ()) |