-
Notifications
You must be signed in to change notification settings - Fork 253
Add PyQt6 support #431
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 PyQt6 support #431
Conversation
I wanted to ask how to solve the two failing PyQt6 tests. It looks like PyQt6 is capturing the Do we accept this limitation and I just update the tests so they pass, or should I look into extracting the original exception and raise it in the The exception raised by the test: ERROR: tests.test_load_ui_invalidpath
Tests to see if loadUi successfully fails on invalid paths
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/runner/.local/lib/python3.10/site-packages/PyQt6/uic/ui_file.py", line 35, in __init__
document = ElementTree.parse(ui_file)
File "/usr/lib/python3.10/xml/etree/ElementTree.py", line 1222, in parse
tree.parse(source, parser)
File "/usr/lib/python3.10/xml/etree/ElementTree.py", line 569, in parse
source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'made/up/path'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/runner/work/Qt.py/Qt.py/tests.py", line 622, in test_load_ui_invalidpath
assert_raises(IOError, QtCompat.loadUi, 'made/up/path')
File "/usr/lib/python3.10/unittest/case.py", line 738, in assertRaises
return context.handle('assertRaises', args, kwargs)
File "/usr/lib/python3.10/unittest/case.py", line 201, in handle
callable_obj(*args, **kwargs)
File "/home/runner/work/Qt.py/Qt.py/Qt.py", line 798, in _loadUi
return Qt._uic.loadUi(uifile, baseinstance)
File "/home/runner/.local/lib/python3.10/site-packages/PyQt6/uic/load_ui.py", line 86, in loadUi
return DynamicUILoader(package).loadUi(uifile, baseinstance)
File "/home/runner/.local/lib/python3.10/site-packages/PyQt6/uic/Loader/loader.py", line 62, in loadUi
return self.parse(filename)
File "/home/runner/.local/lib/python3.10/site-packages/PyQt6/uic/uiparser.py", line 995, in parse
ui_file = UIFile(filename)
File "/home/runner/.local/lib/python3.10/site-packages/PyQt6/uic/ui_file.py", line 37, in __init__
self._raise_exception("invalid Qt Designer file", detail=str(e))
File "/home/runner/.local/lib/python3.10/site-packages/PyQt6/uic/ui_file.py", line 92, in _raise_exception
raise UIFileException(self._ui_file, message, detail=detail)
PyQt6.uic.exceptions.UIFileException: made/up/path: invalid Qt Designer file: [Errno 2] No such file or directory: 'made/up/path' |
Great initiative. I'm in the start of a house-move at the moment and will be slow to reply, but I would like invite others to join in on the conversation too so if you are reading this, do chime in. |
- Don't mutate the current test suite binding when testing None. This was causing the tests after it runs to use the wrong binding. - Restore the original working directory to prevent file lock issues when testing on windows. - run_tests.py now includes the failing bindings in the summary exception for ease of debugging.
- QtCompat.QFont.fromString adds support for Qt6 font strings in Qt4/5. - QtCompat.enumValue interface for converting Qt enums to int values.
I chose the latter. For known exceptions we are testing for |
b4505d8
to
91d707f
Compare
This removes the UIFileException exception if the cause exception is not PyQt6 specific. This should make it easier to handle exceptions consistently between bindings.
Tests for Qt_convert_enum.py are written but require at least python 3.7 to run successfully. These tests will be enabled once the underlying testing suite is updated to current requirements.
I think this is ready to release I'll try to do that on Monday. |
Good luck and great work. :) I'll be here if things go south. |
Add the binding information for PyQt6 support.
PyQt6 seems to have removed a lot of backwards compatible support that PySide6 has not. This introduces a few issues that should be figured out before this is merged. I will add additional notes calling out the specifics.