Skip to content

QtWidgets.QMessageBox enumerations are available in two places... #125

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

Merged
merged 4 commits into from
Dec 31, 2020

Conversation

altendky
Copy link
Collaborator

No description provided.

@altendky
Copy link
Collaborator Author

@BryceBeagle, this seems really bad... but since they are both places? Or maybe we would rather just encourage people to use the new location? (they are all attributes of the enumeration itself in pyqt6, right?)

Python 3.9.0 (default, Dec 18 2020, 14:15:28) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5 import QtWidgets
>>> QtWidgets.QMessageBox.NoIcon
0
>>> QtWidgets.QMessageBox.Icon.NoIcon
0
>>> QtWidgets.QMessageBox.InvalidRole
-1
>>> QtWidgets.QMessageBox.ButtonRole.InvalidRole
-1
>>> QtWidgets.QMessageBox.NoButton
0
>>> QtWidgets.QMessageBox.StandardButton.NoButton
0

Observed while getting:

qtrio/examples/readme/qt.py:17: error: "Type[Icon]" has no attribute "Question"  [attr-defined]

From:
https://github.com/altendky/qtrio/blob/1d969f8ec5be7bd5dc7b9c3f38e344f5a46e41c5/qtrio/examples/readme/qt.py#L16-L21

    return QtWidgets.QMessageBox(
        QtWidgets.QMessageBox.Icon.Question,
        "Hello",
        "",
        QtWidgets.QMessageBox.Ok,
    )

Copy link
Collaborator

@BryceBeagle BryceBeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the stubs should accurately reflect the library, even if the library does something strange.

Are other Enums in the library available like this? I recall a conversation on the mailing list where PyQt6 was switching to only scoped Enums.

The docs for PyQt 5.11 mention this:
https://www.riverbankcomputing.com/static/Docs/PyQt5/gotchas.html#enums

@altendky
Copy link
Collaborator Author

Sounds like this will apply to all old enums? And new enums will be available only as attributes of the enum? We'll see how far Phil makes it following his query on the list about how to check the official hints. We also need to figure out how we're going to approach PyQt6... Though I was kind of hoping to put off dealing with Qt6 altogether for a few months. :|

@altendky altendky merged commit a3b2eeb into master Dec 31, 2020
@altendky altendky deleted the altendky-patch-1 branch December 31, 2020 17:31
bluebird75 pushed a commit to bluebird75/PyQt5-stubs that referenced this pull request Aug 24, 2021
QtWidgets.QMessageBox enumerations are available in two places...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants