[PyQt] Roadmap suggestion: raise exception when connect() fails

Giovanni Bajo rasky at develer.com
Wed Jan 21 18:58:06 GMT 2009


Hello,

a problem that often arise when programming with PyQt is that 
QObject.connect() simply returns False when a connection fails. 
Sometimes you get some debug output on the console (coming from Qt), but 
this is not true if the reason why the connection fails is a 
PyQt-specific one.

An example is signal forwarding when the first signal is a short-circuit 
signal. This is not supported by PyQt, but what happens is that 
QObject.connect() simply returns False, and you get no other feedback 
that your connection is wrong.

I believe that it would be worth to special-case the binding of 
QObject.connect() so that, when a connection fails, a RuntimeError is 
raised. I think it's a function that it is very common *and* it has a 
deep semantic overloading in PyQt (that is, it's behaviour is much more 
complex than the basic Qt's connect() because of additional features 
like PyQt_PyObject, short-circuit signals, etc.).

I would of course recommend to do the same for pyqtBoundSignal.connect().
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com


More information about the PyQt mailing list