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

Ensure Qt height and width calls are given int values #1911

Merged
merged 5 commits into from
Jun 28, 2022

Conversation

corranwebster
Copy link
Contributor

@corranwebster corranwebster commented Jun 28, 2022

This is needed for Python 3.10+ with some versions of PyQt/PySide. A change to the Python C API which comes into effect in 3.10 means that certain C API calls which previously accepted floats and silently truncated now raise.

Fixes #1886 and possibly some others.

Note that this looked only for height/width. There may be other places where we are supplying a float when expecting an int.

Checklist

  • Add a news fragment if this PR is news-worthy for end users. (see docs/releases/README.rst)

Copy link
Member

@itziakos itziakos left a comment

Choose a reason for hiding this comment

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

Just a couple of passby comments. But mainly I wonder if we need to consider rounding instead of just getting the integer part.

traitsui/qt4/ui_panel.py Outdated Show resolved Hide resolved
Copy link
Member

@itziakos itziakos left a comment

Choose a reason for hiding this comment

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

A few more comments to consider.

traitsui/qt4/list_str_editor.py Outdated Show resolved Hide resolved
traitsui/qt4/image_enum_editor.py Outdated Show resolved Hide resolved
traitsui/qt4/table_editor.py Outdated Show resolved Hide resolved
traitsui/qt4/helper.py Show resolved Hide resolved
@corranwebster
Copy link
Contributor Author

I think I've addressed everything here. Assuming that PRs pass, this is good for re-review.

Copy link
Member

@itziakos itziakos left a comment

Choose a reason for hiding this comment

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

👍

@corranwebster corranwebster merged commit e4cbcd7 into main Jun 28, 2022
@corranwebster corranwebster deleted the enh/qt-python-3-10-size-int branch June 28, 2022 15:03
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.

issue with Statusbar_demo.py with Python 3.10
2 participants