Skip to content
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

PR: Make warning usage consistant and refine messages #398

Merged
merged 1 commit into from
Jan 17, 2023

Conversation

CAM-Gerlach
Copy link
Member

Currently, as noted in issue #395 , a generic RuntimeWarning is emitted when falling back to a non-selected binding, instead of QtPy's own PythonQtWarning subclass. Furthermore, the text could perhaps be clarified a bit. I also noticed a few other issues when making this changed, which I fixed.

Therefore, this PR:

  • Emits a PythonQtWarning instead of a generic RuntimeWarning when falling back to an unselected binding, consistent with the other warnings and errors that use QtPy-specific subclasses
  • Has PythonQtWarning inherit from RuntimeWarning instead of a generic Warning , to be consistent with all the other errors and warnings and with what RuntimeWarning is meant for, and ensure the previous replacement is fully backwards compatible
  • Tweaks the message text of the former warning to be clearer and more grammatically correct
  • Fixes the outdated and incorrect docstrings of PythonQtWarning and PythonQtError
  • Updates both warning usages to modern code formatting, f-strings and to use !r instead of hardcoded quotes

@CAM-Gerlach
Copy link
Member Author

(Oops, fell asleep before I went back and hit the ready for review button)

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Two small suggestions for you @CAM-Gerlach, otherwise looks good to me.

qtpy/__init__.py Outdated Show resolved Hide resolved
qtpy/__init__.py Outdated Show resolved Hide resolved
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Looks good to me now, thanks @CAM-Gerlach!

Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

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

Thanks @CAM-Gerlach !

@dalthviz dalthviz merged commit aa3fe4b into spyder-ide:master Jan 17, 2023
@dalthviz
Copy link
Member

Also @CAM-Gerlach should this close #395 ?

@CAM-Gerlach
Copy link
Member Author

It may help with it some, but it isn't clear that it would resolve the actual issue the user experienced, since from the very limited information provided it is not at all clear what that actually is. I suggest we wait at least a couple weeks to see if they respond. Also, you mentioned documenting the error/warning hierarchy somewhere, which is a good idea to do at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants