[PyQt] signal twice emit

Csaba Toth csaba.toth at i3rendszerhaz.hu
Wed Jun 30 20:28:08 BST 2010


> On Tue, Jun 29, 2010 at 3:06 PM, Csaba Toth wrote:
>> def p(self, clicked=False):
>>     print('emitted')
>> self.connect(self.btn_save, QtCore.SIGNAL("clicked(bool)"), self.p)
> Initially, I thought this could be a problem with both the clicked()
and the
> clicked(bool) signals being connected to the slot, but that shouldn't
> if the signature is used like this. You could check to see if the behavior
> changes by decorating p() like this:
>   @pyqtSlot("bool")
>   def p(self, clicked=False):
>       print('emitted')
> It's difficult to know exactly what could cause this without some more
> context. I've seen code that uses signal-slot auto-connection and also
> includes connect() calls, resulting in double connections.

There is no double connection, checked it manually with a print next to
the connect.

And i tried this decorator today, from the 20 people 3 people dropped an
email to me that they had this problem showed up today. The first did
after 3 work hour with the program, and after a few double invokioning
it started to work normally.
(this is a simple data store program. There is one dialog with a lot
check box and an ID lineEdit field. If they click on the save button it
first store the datas in a postgres table, and than clears the form. if
the lineedit is empty they had a warning pops up. the error looks like a
worker fills up the form, click on the save button, than the warning
shows up they haven't filled up the ID lineedit, but they did. This
happens because at the first invokion of the click event it save than
clear the form, and at the second run the ID lineedit truly empty.
during the day they didn't touch the progrma, they don't exit, just fill
up the form and save.)

looks like a memory leak for me :(

2010.06.29. 21:14 keltezéssel, David Boddie írta:
> On Tue Jun 29 18:42:37 BST 2010, Csaba Toth wrote:
> It would be interesting to try it with an earlier version if possible, though
> I could understand if that's not possible.

Yes, i will try this tomorrow, first will go back to PyQt 4.6.* version.

I have a lot installers saved, becase sadly from the website no old
versions downloadable. :(

thanks for helping, let see what will happen tomorrow with older version!


> David

More information about the PyQt mailing list