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

Use exec instead of exec_ where possible for Qt #1208

Merged
merged 3 commits into from
Mar 9, 2023
Merged

Conversation

corranwebster
Copy link
Contributor

@corranwebster corranwebster commented Mar 8, 2023

This uses hasattr to test whether exec is available, which should be all Qt backends except PySide2.

Fixes #1179 and is more complete than #1198

This uses hasattr to test for whether `exec` is available, which should be all
Qt backends except PySide2.
Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

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

Code changes LGTM with one minor comment.

if qt_api == 'pyside2':
retval = self.control.exec_()
else:
retval = self.control.exec()
Copy link
Contributor

Choose a reason for hiding this comment

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

any particular reason why we're not using hasattr here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No - I did it that way first and then converted to hasattr but I clearly missed one.

@rahulporuri
Copy link
Contributor

This PR is good but we're seeing one more deprecating warning for exec_() when we run our testsuite that is coming from traitsui -

C:\Users\rporuri\.edm\envs\<env-name>\lib\site-packages\traitsui\qt4\ui_base.py:320: DeprecationWarning: 'exec_' will be removed in the future. Use 'exec' instead.
  ui.control.exec_()

but that's a separate concern.

@rahulporuri
Copy link
Contributor

i've created the traitsui issue enthought/traitsui#1987 mirroring this issue in pyface.

@corranwebster corranwebster merged commit 6133521 into main Mar 9, 2023
@corranwebster corranwebster deleted the enh/use-exec branch March 9, 2023 08:26
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.

Use "exec()" instead of "exec_()" with PySide6
2 participants