<div dir="ltr"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> Being able to do something like this when some_signal is a pyqtSignal():<br class="gmail_msg">
><br class="gmail_msg">
> assert self.some_signal.is_connected(some_object.slot)<br class="gmail_msg">
<br class="gmail_msg">
You could try and connect using the UniqueConnection type. If it fails then it is already connected.<br class="gmail_msg">
<br class="gmail_msg">
> assert self.some_signal.num_connections < 5<br class="gmail_msg">
<br class="gmail_msg">
Look at QObject.receivers().<br class="gmail_msg">
<br class="gmail_msg">
Phil</blockquote><div><br></div><div>Thanks. BTW I've defined the following convenience function which I can call while debugging, for sanity checks (for Python < 3.x, remove annotations in def): </div><div><br></div><div><font size="1" face="monospace">def is_connected(signal: pyqtSignal, slot: pyqtSlot):</font></div><div><font size="1" face="monospace"> try:</font></div><div><font size="1" face="monospace"> signal.connect(slot, Qt.UniqueConnection)<br></font></div><div><font size="1" face="monospace"><br></font></div><div><font size="1" face="monospace"> except TypeError:</font></div><div><font size="1" face="monospace"> return True</font></div><div><font size="1" face="monospace"><br></font></div><div><font size="1" face="monospace"> else:</font></div><div><font size="1" face="monospace"> signal.disconnect(slot)</font></div><div><font size="1" face="monospace"> return False</font></div><div><br></div><div> </div><div>Oliver</div></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Oliver<div>My StackOverflow contributions<br><div>My CodeProject articles</div></div><div>My Github projects</div><div>My SourceForget.net projects</div></div></div>