[PyKDE] Re: dcop
Stefan Bund
l-pykde.z.xalan at xoxy.net
Fri May 28 09:17:01 BST 2004
Jim Bublitz <jbublitz at nwinternet.com> writes:
> The way I have it setup now is:
'now' meaning 'in CVS' ?
> from kdecore import dcop_add, dcop_next
> from qt import *
[...]
> should produce x == x1 and y == y1.
very nice ...
> dcop_add needs a type specifier for numeric types,
[...]
of course. Is it valid, to add a type specifier for other types (like
QString)? This would simplify automated code ...
> I've also written a small module (based on pydcop from kde-bindings) so the
> user rarely has to worry about packing or unpacking QByteArrays anyway:
[...]
Ok, there goes my nice PyDCOP.DCOPClient class :-) What do you do
about overloaded functions?
This is very nice stuff. This will be in rc2 ? When can we expect rc2
to be released ...
I have implemented a DCOPServer class which works along the same
lines to provide automatic marshalling for DCOPServers:
class MyDCOPServer(PyDCOP.DCOPServer):
def __init__(self):
PyDCOP.DCOPServer.__init__(self,
name="myserver",
interface="MyDCOPServer",
methods=[
"int foo()",
"void foo(QString string)",
"QCStringList bar()" ])
def foo_(self):
return 1234
def foo_QString(self,s):
pass
def bar(self):
return [ "This","is","a","list" ]
I support overloading by (optionally) appending the function signature
to the function name:
foo() (no arguments) -> foo_
foo(QString) -> foo_QString
foo(int,QString) -> foo_int_QString
all of the above -> foo
you either:
- implement foo and use default args or check the types
manually
- implement foo_, foo_QString and foo_int_QString
I found, using a precompiler for an interpreted language like python
is not necessary.
Stefan.
--
-- *DON'T* TRY TO REACH ME DIRECTLY AT ABOVE EMAIL ADDRESS. Any reply
-- received off-list at that address will be *silently* and
-- *unconditionally* dropped. You can attribute this inconvenience to
-- the proliferation of spammers on the Internet. I hope, you can
-- understand my position and accept my counter measures.
More information about the PyQt
mailing list