[PyKDE] Revisiting an old khtml crash

Jim Bublitz jbublitz at nwinternet.com
Wed Jul 14 05:32:01 BST 2004


On Tuesday 13 July 2004 17:42, Brian Thomason wrote:
> In this old thread:
>
> http://www.mail-archive.com/pykde@mats.imk.fraunhofer.de/msg01331.html
>
> A user is experiencing the exact same problem I've been seeing with
> pykde 3.11 on both Linspire 4.5 and Debian SID. (at least to my feeble
> mind it appears that way)
>
> When overriding any type of pyqt event, khtml bombs out.  (Even simply
> importing khtml is a no go)
>
> Just as the user stated (as tested on mandrake), 3.7 does not display
> this behavior.  I have attached a small, hoping some big brain (Jim :-)
> ) might have a solution to this problem.

In sip/kparts/event.sip, comment out the ConvertToSubClassCode block as shown 
below and recompile kparts (python configure.py -lkparts && make && su 
-c"make install"). Works for me.

khtml (and the new kmdi module) would have the same problem because they both 
depend on kparts. The only thing this change affects is "typecasting" of 
KParts::Event subclasses - for example if a factory function creates a 
KParts::GUIActivate even but returns KParts::Event, there is no way in Python 
to "up-cast" to the subclass type (except via the commented out block).

I expect the "sipClass=NULL" stmt is causing the problem, but I'll have to 
look into what to replace it with. I don't expect commenting this stuff out 
will affect many people (if anybody), so I probably won't give it a high 
priority unless someone has a problem with it. 

I'll probably issue a patched tarball sometime around the time I release the 
KDE 3.3.beta1 snapshot, which will be a week or two.

Thanks for re-activating this bug - it fell through the cracks. Let me know if 
the problem persists.

Jim

class Event : QCustomEvent
{
%TypeHeaderCode
#include <event.h>
%End


public:
                         Event (const char*);
    virtual const char*  eventName () const;
    static bool          test (const QEvent*);
    static bool          test (const QEvent*, const char*);

//force
//%ConvertToSubClassCode
//    const QString ev = ((KParts::Event *)sipCpp) -> eventName ();
//    if (ev == "KParts/GUIActivate")
//        sipClass = sipClass_KParts_GUIActivateEvent;
//    else if (ev == "KParts/PartActivateEvent")
//        sipClass = sipClass_KParts_PartActivateEvent;
//    else if (ev == "KParts/PartSelectEvent")
//        sipClass = sipClass_KParts_PartSelectEvent;
//    else
//        sipClass = NULL;
//%End
//end

};  // class Event




More information about the PyQt mailing list