Improve bound and unbound signal hints#56
Conversation
`pyqtSignal` is a descriptor and does not have `emit`, `connect`, and `disconnect` methods. Rather it is used as a class attribute and when you access `an_instance.the_signal` you get a `pyqtBoundSignal` instead of the original `pyqtSignal`. So the bound signal needs those methods and the unbound signal needs `__get__()`.
|
Similar change suggested for PySide2. |
|
@stlehmann, @BryceBeagle, aside from whether this is correct at the moment or not (still need to add tests etc) but would you rather take signal improvements piecemeal or try to work through a 'complete' solution from the get go? Basically, work through this or just go all out and come up with a solution for #68? I would personally default to taking multiple steps since I'm not sure what the whole solution is. |
|
I think piecemeal is probably better, so changes can keep rolling out. Functionality is never lost by doing this. We could make a meta tracking issue if we feel there are many signal-based features to implement. |
BryceBeagle
left a comment
There was a problem hiding this comment.
Looks good to me. Just a small question that probably won't affect approval
| with open(path, 'r') as f: | ||
| code = f.read() | ||
| exec(compile(code, filename, 'exec')) | ||
| exec(compile(code, filename, 'exec'), {}) |
There was a problem hiding this comment.
What's the purpose of setting globals arg?
There was a problem hiding this comment.
It complained that the name QtCore didn't exist without it. Which is odd. Worked fine in a REPL as it was but not in pytest. But mostly I don't understand why things are done this way vs. regular old tests. I expected at some point to take a pass at revamping the testing but if you can explain the point of this setup with exec now, by all means go for it.
There was a problem hiding this comment.
Nope I have no clue why it's done this way haha
Improve bound and unbound signal hints
pyqtSignalis a descriptor and does not haveemit,connect, anddisconnectmethods. Rather it is used as a class attribute and when you accessan_instance.the_signalyou get apyqtBoundSignalinstead of the originalpyqtSignal. So the bound signal needs those methods and the unbound signal needs.__get__().Draft for: