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 QtPy abstraction layer (#144). GHA tests with PySide2 and PyQt5 #146

Merged
merged 18 commits into from
Jan 6, 2025

Conversation

paskino
Copy link
Collaborator

@paskino paskino commented Apr 26, 2024

Builds on #144 and installs Qt bindings in GHA tests.
From @samtygier-stfc :

This switches to importing Qt classes via the qtpy abstraction layer. The library will then use which ever Qt binding you have in your environment. If you have multiple, its possible to select one using an environment variable (see https://github.com/spyder-ide/qtpy).

A small change to some mocking in a test was needed.

This passes all the tests, but has not been tested for an application that uses the library.

An application that uses eqt, will now need to add a dependency on the Qt binding that it wants to use.

Because now an app installing eqt will not have installed a Qt binding by default this is a backward incompatible change and will require a major version change.

@paskino paskino requested review from DanicaSTFC and casperdcl April 26, 2024 07:25
@paskino paskino changed the title Adds pyside2 bindings to Qt to #144 Adds GHA tests to #144 Apr 26, 2024
@paskino paskino marked this pull request as draft April 26, 2024 07:37
@paskino paskino changed the title Adds GHA tests to #144 Use QtPy abstraction layer (#144). GHA tests with PySide2 and PyQt5 Apr 26, 2024
@DanicaSTFC DanicaSTFC added this to the Version 1.0.1 milestone Jul 29, 2024
@DanicaSTFC DanicaSTFC removed this from the Version 1.0.1 milestone Aug 7, 2024
@DanicaSTFC DanicaSTFC marked this pull request as ready for review December 10, 2024 11:40
@DanicaSTFC
Copy link
Collaborator

DanicaSTFC commented Dec 10, 2024

  • Merge main from 10/12/2024
  • Run examples in eqt with pyside2.
  • Run examples in eqt with qtpy5. Opened issue Reordable_list_widget_example does not run with qtpy5 #167 for one example not working well.
  • Fix example "Dialog_save_state_example"
  • Test that everything works in "iDVC" repository
  • Test that everything works in "CILviewer" repository
  • Add readme to explain that the user must have pyside2 or pyqt5 in readme file.
  • add 2 yml files so that the user can create the environment that they need, with either pyside2 or qtpy5. There will be one common file for the generic environment.
  • Tested that the new env files work well by running the examples
  • Update the meta in conda-forge https://github.com/conda-forge/eqt-feedstock/tree/main/recipe. Opened PR https://github.com/conda-forge/eqt-feedstock/pull/5/files
  • Update changelog
  • Fix failing unit tests by removing the appearance of QMenu and findChildren.
=================================================================== FAILURES ====================================================================
______________________________ TestMainWindowWithSessionManagementMenuBar.test_createMenu_sets_menu_bar_and_menus _______________________________
test\test_MainWindowWithSessionManagement.py:105: in test_createMenu_sets_menu_bar_and_menus
    assert isinstance(self.smw.menus["File"], QMenu)
E   assert False
E    +  where False = isinstance(<PySide2.QtWidgets.QMenu(0x1a5fdea1460) at 0x000001A5F984BB00>, QMenu)
--------------------------------------------------------------- Captured log call ---------------------------------------------------------------
INFO     qdarkstyle:__init__.py:269 QSS file successfully loaded.
INFO     qdarkstyle:__init__.py:172 Found version patches to be applied.
INFO     qdarkstyle:__init__.py:192 Found application patches to be applied.
________________________________ TestMainWindowWithSessionManagementMenuBar.test_file_menu_has_expected_actions _________________________________
test\test_MainWindowWithSessionManagement.py:115: in test_file_menu_has_expected_actions
    file_menu = menus[0]
E   IndexError: list index out of range
--------------------------------------------------------------- Captured log call ---------------------------------------------------------------
INFO     qdarkstyle:__init__.py:269 QSS file successfully loaded.
INFO     qdarkstyle:__init__.py:172 Found version patches to be applied.
INFO     qdarkstyle:__init__.py:192 Found application patches to be applied.
______________________________ TestMainWindowWithSessionManagementMenuBar.test_settings_menu_has_expected_actions _______________________________
test\test_MainWindowWithSessionManagement.py:122: in test_settings_menu_has_expected_actions
    settings_menu = menus[1]
E   IndexError: list index out of range

QMenu type is <class 'Shiboken.ObjectType'>

DanicaSTFC added a commit to DanicaSTFC/eqt-feedstock that referenced this pull request Dec 11, 2024
this is necessary after we use qtpy abstraction layer, see TomographicImaging/eqt#146
@DanicaSTFC DanicaSTFC added this to the Version 2.0.0 milestone Dec 17, 2024
@DanicaSTFC DanicaSTFC merged commit 19be963 into main Jan 6, 2025
8 checks passed
@DanicaSTFC DanicaSTFC deleted the 2-qtpy branch January 6, 2025 14:22
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.

Enable changing of Qt backend
3 participants