-
-
Notifications
You must be signed in to change notification settings - Fork 69
Waiting for a signal with certain arguments #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I would add only |
Hi. I've had a shot at it, because I needed the ability to check for parameters (of a single signal or even multiple signals), and I also needed the ability to check for a correct order of emitted signals, and also the ability to check that the same signal is emitted in a specific order (each emit with a different parameter). Here are my method signatures: For multiple signals: If you're interested in the implementation, check out https://gist.github.com/MShekow/0481d22224395d3f86656c3079bf2102 and https://gist.github.com/MShekow/44612f31b983727ff8978521a455b256 Best regards! |
Thanks @MShekow, @The-Compiler plans to work on this as well for the upcoming 2.0 release. |
@MShekow could you maybe add some tests and open a pull request? I already have quite much on my plate currently, so I'd be more than happy to review and merge your code 😄 |
@The-Compiler Since I've done that at my job, I'll try to get my boss to allow me to work on that (creating tests and a PR) :) |
Quick update: I'm on it, should be ready on Thursday. |
OK, thanks! On Tue, Jul 12, 2016 at 12:31 PM MShekow [email protected] wrote:
|
By the way, there is one problem that I'm facing and I'm not sure how to proceed: then this is identical to:
In such a case, the code within waitSignals is unable to detect that x and y are actually the same signal (because This poses a problem, because the code in which indicates to However, suppose the user wants to test that Is this solution something you would accept? Do you have other suggestions? |
Hmm, that's weird (PyQt5): >>> from PyQt5.QtCore import QObject, pyqtSignal
>>> class Signaller(QObject):
... sig = pyqtSignal()
...
>>> s = Signaller()
>>> s.sig
<bound PYQT_SIGNAL sig of Signaller object at 0x7fbde9c9e798>
>>> s.sig
<bound PYQT_SIGNAL sig of Signaller object at 0x7fbde9c9e798>
>>> s.sig is s.sig
False
>>> s.sig == s.sig
False I'm not sure how it's possible for the >>> id(s.sig) == id(s.sig)
True |
Hi. Great find using
However: I see two possibilities:
|
I suspect
Not sure how to explain this, if my above statement was true. |
I've contacted the PyQt mailing list. Maybe they (Phil Thompson) can shed some light on this issue. |
I got some feedback: The fact that the Phil suggested that the solution that uses So, unless you have a better suggestion, I'll go with the |
Sounds like Thanks for all the research and interest on this! 😁 |
Though we still need to check how things look on PySide and PyQt4 😉 |
I did check it, str() works fine with all Qt frameworks. I also included a test for that. Interestingly, tests fail on Py27, because list.clear() doesn't exist apparantly. But then I wonder how the tests could have worked before, because in |
I believe
I think so. Thanks again for working on this! 😁 |
I have some scenarios where I'd like to do something like:
And qtbot would wait until the signal is emitted with exactly those args.
I also have another case where I do some more sophisticated checking:
I'm thinking if it makes sense or not to do something like:
Then
qtbot
will only stop waiting when the callback returned something true.Maybe
args
isn't even necessary then, as you could do:What do you think? Neither? Only
args
?args
andcallback
? Both?(edited to rename
arg_callback
tocallback
as it could be used to check other stuff as well.The text was updated successfully, but these errors were encountered: