[PyKDE] KDE app template: Qt signal problem...
simon at simonzone.com
Thu Apr 28 20:32:25 BST 2005
On Thursday 28 April 2005 09:57, Jim Bublitz wrote:
> examples/example_dcopexport.py is one way to do that. You should be able to
> export anything using a subclass of DCOPExObj (which is a subclass of
> defined in the dcopexport module) to define the exported methods - they just
> have to be reachable from the subclass and could even be plain old Python
> functions not part of any class.
Yeah, I've had a look at that. It is pretty close to what I'm after, although
it means that you have to forward the methods in the DCOP subclass over to
the real object that should handle them. Another issue is that C++ still
needs a header file containing the DCOP interface. It would be nice if that
could be automatically generated by setup.py.
I'm thinking of something like this:
from DCOPInterface import *
def __init__(self, implementation, id="Value"):
DCOPInterface.__init__(self, implementation, id)
self.addMethod("void openURL(QString url)")
Where 'implementation' is the real object that is publishing the interface. A
request to openURL() would automatically be sent to implementation.openURL(),
no mess no fuss. DCOPInterface would also have a getCppHeader() method that
would generate the header file for the interface. setup.py would then just
create an instance of TestAppIface and use getCppHeader().
With Python 2.4 decorators you could probably come up with something even more
Simon Edwards | Guarddog Firewall
simon at simonzone.com | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."
More information about the PyQt