-
Notifications
You must be signed in to change notification settings - Fork 254
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
Add QMatrix to QtGui members #330
Conversation
@mottosso looks like |
Hmm. This may not be something that can be preserved across all versions. The |
Hmm, I'm unsure. The important bit is that any code written with Qt.py works identically across all versions. If QMatrix can't cope with that, then it probably shouldn't be used with Qt.py. Is QTransform a viable alternative, for e.g. your use case, Justin? |
Yep, |
Isn't the non-existence error doing exactly that though? xD Are you thinking something along the lines of, if the user tries to access I think that should be possible, given we're the ones constructing the |
Re-reading your message, you were thinking of actually providing a "mock" |
Normally I would not suggest raising exceptions in constructors, sure. But given the nature of Qt.py as a dynamic API layer, it seems somewhat suitable. The Also the closest example of really throwing exceptions from constructors is if one were using |
I think that's a good idea, thanks for sharing. If you're interested in getting that started, this PR seems as good a place as any. |
I've got two implementations that I could submit, but I wanted to get some feedback on which one is preferable. Option 1:
Option 2:
|
Thanks for this, and sorry for the delay. Based on having tinkered with overriding the behavior of a module in the past (by swapping it out for a class at import, which is what I suspect you've got in mind here) and run into various subtle issues - like In particular without any # Qt.py
class _QMatrix():
def __init__(self, *args, **kwargs):
raise RuntimeError("Message here")
QtGui.QMatrix = _QMatrix Perhaps automated somehow, such that we could add to a dictionary of known-but-missing members. excluded = {
# Member Reason
"QMatrix", "Because PyQt5 has deprecated it",
} I wouldn't catch invalid attribute access, but maybe preventing instantiation is enough for most/all cases? |
Yes this is the approach I had written for option 1, where it derives from
This is effectively what I had written and just pushed up. There is a missing members mapping that can be populated with names and descriptions. Then there is a |
I think this looks good, thanks @justinfx! |
Adds the missing
QtGui.QMatrix
member which should be present across all Qt4/5 bindings