[PyKDE] Re: khtml/kparts segfault on keyPressEvent
Jim Bublitz
jbublitz at nwinternet.com
Mon Aug 16 04:25:51 BST 2004
On Sunday 15 August 2004 19:21, Garett Shulman wrote:
> Hello, I noticed this thread from december and was wondering if there
> was any update. I am experienceing this problem. If I import khtml and
> have keyPressEvent redefined I get a segfault when I hit a key. I even
> get a segrault with the following code:
>
> class IconView(kdeui.KIconView):
> def __init__(self, *args):
> apply(kdeui.KIconView.__init__, (self, ) + args)
> def keyPressEvent(self, ev):
> pass
>
> Is there a work around, or any progress being made on this bug? Thanks a
> lot. BTW, PyQt and PyKDE are AWSOME! Thanks!
I think this was resolved about a month ago when someone else brought it up
again. Previous message:
----------------------------------------------------------------------------------
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.
(Code below)
--------------------------------------------------------------------------------
I just checked, and the snapshot I just sent off to Phil has this fix, so you
can either modify the code you have or download the snapshot in a day or two
from riverbankcomputing.co.uk.
I apparently did test this (I've been off working on other stuff so I really
don't recall), but let me know if it doesn't work and I'll spend some more
time on it.
Jim
event.sip
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