[PyKDE] Re: Kcontrol modules.

Phil Thompson phil at riverbankcomputing.co.uk
Thu Jul 10 10:08:01 BST 2003


On Wednesday 09 July 2003 11:20 pm, David Boddie wrote:
> Following up to this again as things change...
>
> On Tue, 8 Jul 2003 20:21:21, Simon Edwards <simon at simonzone.com> wrote:
> > I had a look at the IOSlave code and saw that it works quite differently
> > than kcms. Kcms are basically shared libraries that have a factory method
> > that returns a instances of a subclass of KCModule.
>
> Well, I've managed to get kicker to load a shared library and call the C++
> "init" factory function as normal. This starts a Python interpreter, looks
> for the relevant Python module, imports it then calls the "init" function
> in the module. The "init" function creates an instance of the KPanelApplet
> subclass and returns this to the C++ function.
>
> -> C++ "init"
>    ...
>            -> Python "init"
>               ...
>                       -> AppletClass.__init__
>                          ...
>               applet  <-
>               ...
>    pInstance <-
>
> The instance is then converted to a pointer using
>
>     panel_applet = (KPanelApplet*)sipMapSelfToThis(pInstance);
>
> which is returned to the caller. Kicker (or its applet loading proxy) then
> crashes, rather unhelpfully failing to provide a traceback.
>
> Any ideas on what I'm doing wrong would be good at this point.

If pInstance is the Python instance object (of class KPanelApplet) then use 
sipConvertToCpp() and not sipMapSelfToThis().

Phil




More information about the PyQt mailing list