[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] KDE app template: Qt signal problem...
From:       Simon Edwards <simon () simonzone ! com>
Date:       2005-04-28 19:32:25
Message-ID: 200504282132.25261.simon () simonzone ! com
[Download RAW message or body]

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 
DCOPObj 
> 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 *
class TestAppIface(DCOPInterface):
    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 
snazzy.

cheers,

-- 
Simon Edwards             | Guarddog Firewall
simon@simonzone.com       | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic