[PyKDE] Help -- QObject.connect() fails -- WId not recognized.

Jim Bublitz jbublitz at nwinternet.com
Mon Aug 23 20:57:34 BST 2004


On Monday 23 August 2004 12:22, Maurizio Colucci wrote:
> On Monday 23 August 2004 21:08, Jim Bublitz wrote:
> > On Monday 23 August 2004 10:03, Maurizio Colucci wrote:
> > > On Monday 23 August 2004 17:41, Maurizio Colucci wrote:
> > > > I don't understand this error:
> > > >
> > > >     kwinmod= KWinModule()
> > > >     def onActiveWindowChanged(wid):
> > > >         print "onActiveWindowChanged" + str(wid)
> > > >     QObject.connect(kwinmod, SIGNAL("activeWindowChanged(WId)"),
> > > >                   onActiveWindowChanged)
> > > >
> > > > The output is:
> > > >
> > > >  File "/dat/pub/src/by-mau/logicaldesktop/LogicalDesktop/main.py",
> > > > line 1357, in run QObject.connect(kwinmod,
> > > > SIGNAL("activeWindowChanged(WId)"), onActiveWindowChanged)
> > > > RuntimeError: Signal has wrong argument types for slot
> > >
> > > I saw the post
> > >
> > >
> > > http://www.mail-archive.com/pykde%40mats.imk.fraunhofer.de/msg01444.htm
> > >l
> > >
> > > and it seems it is a known sip problem.
> > >
> > > Wasn't it fixed for sip 4?
> > >
> > > If it wasn't, I absolutely need a quick hack...
> >
> > I played around with this for a while, and I can't seem to find anyway to
> > get this signal to work with any combination of #defines (%ModuleHeader
> > and %TypeHeader) or changing WId to unsigned long in the sip file. It
> > seems like that should be possible (esp given the msg you referenced), so
> > I may be screwing up something else.
> >
> > I'll give another look later today.

> Thank you Jim. I am somewhat desperate here, so please post me if you have
> ANY solution.

> As a hack, I am currently trying to write a C++ function that calls
> connect(), but I don't know if I'll be successful (I have to pass the
> address of the python slot to the C++ function, and I still don't know
> how).

> Can I hope to make it work this way, or am I wasting my time?

> BTW, I am using sip 4 from debian sid.

Personally, I wouldn't want to get into doing C++ for signal/slot handling or 
connect in this case.  I should be able to make this work from the PyKDE 
side, but I didn't have much luck on the first try.

I assume you want a long term PyKDE fix, not just something to work on your 
personal system. Looking at the previous post, it seems I had a fix at one 
time, but there's a question of maintainability over future releases too, 
depending on how a fix is implemented. I'd like to avoid something I have to 
remember to add each release - I'd prefer something that happens more or less 
automatically.

I'd like to wait and see if Phil jumps in this thread. In the meantime I'll 
give it another look, and email Phil if he doesn't show up here.

Jim




More information about the PyQt mailing list