<div style="color:#000; font-size: 14px;font-family: arial;"><div>Which changes should I make on the test code in order to use <span style="font-family: 'Microsoft Yahei', 微软雅黑, verdana; font-size: 16px; line-height: 24px; white-space: pre-wrap;">functools.partial[1] in it ?</span></div><div><br></div><div><br></div><div><br></div></div><!-- jy5ContentSuffix --><div>在2015年04月06 22时26分, "Florian Bruhin"<me@the-compiler.org>写道:</div><blockquote id="isReplyContent" style="padding-left:1ex; margin: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>* Yuya Nishihara <<a href="mailto:yuya@tcha.org">yuya@tcha.org</a>> [2015-04-06 21:55:52 +0900]:<br>> On Mon, 6 Apr 2015 15:35:08 +0800 (CST), redstone-cold wrote:<br>> > test code<br>> > https://bpaste.net/show/79b893f0d9fd<br>> > <br>> > The PyQt4 version of the same code , self.sender() in downloadProgress,<br>> > no matter decorated with @pyqtSlot(int, int) or not, returns a QNetworkReply,<br>> > the direct object that sent the signal, when on_deleteTasks_triggered(),<br>> <br>> Probably because reply.abort() doesn't emit finished() immediately on your<br>> PyQt4 environment. As I said before, I see the same issue on both PyQt4 and<br>> PyQt5.<br>> <br>> The problem is that sender() returns the sender of the 1st signal<br>> <br>> [...]<br><br>I usually use functools.partial[1] to pass the sender to the "real"<br>slot explicitely instead of using self.sender(). IMHO, that's cleaner<br>and less error-prone.<br><br>Florian<br><br>[1] https://docs.python.org/3/library/functools.html#functools.partial<br><br>-- <br>http://www.the-compiler.org | <a href="mailto:me@the-compiler.org">me@the-compiler.org</a> (Mail/XMPP)<br>   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc<br>         I love long mails! | http://email.is-not-s.ms/<br></blockquote><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>