[PyQt] PyQt4 signal issue
Phil Thompson
phil at riverbankcomputing.com
Mon Jan 24 13:00:06 GMT 2011
On Sun, 23 Jan 2011 15:57:13 +0100, Detlev Offenbach
<detlev at die-offenbachs.de> wrote:
> Hi,
>
> I am observing an issue disconnecting a signal using the new style
signal-
> slots API. If the signal to be disconnected is not connected, I am
getting
> a
> TypeError exception. Using the old style API, the code silently ignores
> the
> disconnect.
...but returns False.
> The little script in the attachment shows the issue by
> commenting
> the various lines in the disconnect_method method. Is there a method to
> check,
> if a signal-slot connection has been established (e.g.
> mySignal.isConnected(slot) )?
Nobody ever bothers to check the return value of connect() and
disconnect(). One of the purposes of the new-style API was to reduce errors
by raising an exception in the cases where False would be returned, so the
current behaviour is as intended.
You might argue that a TypeError is the wrong exception to raise however.
Phil
More information about the PyQt
mailing list