0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 19:21:50 +02:00

feat(qt5): dropped support for qt5; pyside2 and pyqt5

This commit is contained in:
2024-07-06 10:05:32 +02:00
parent 03819a3d90
commit fadbf77866
8 changed files with 16 additions and 25 deletions

View File

@ -154,7 +154,6 @@ test-matrix:
- "3.12" - "3.12"
QT_PCKG: QT_PCKG:
- "pyside6" - "pyside6"
- "pyqt5"
- "pyqt6" - "pyqt6"
stage: AdditionalTests stage: AdditionalTests

View File

@ -3,7 +3,7 @@
# A comma-separated list of package or module names from where C extensions may # A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may # be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code. # run arbitrary code.
extension-pkg-allow-list=PyQt5, pyqtgraph extension-pkg-allow-list=PyQt6, PySide6, pyqtgraph
# A comma-separated list of package or module names from where C extensions may # A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may # be loaded. Extensions are loading into the active Python interpreter and may

View File

@ -17,7 +17,7 @@ cd bec_widgets
pip install -e .[dev,pyqt6] pip install -e .[dev,pyqt6]
``` ```
BEC Widgets currently supports both PyQt5 and PyQt6, however, no default distribution is specified. As a result, users must install one of the supported BEC Widgets currently supports both Pyside6 and PyQt6, however, no default distribution is specified. As a result, users must install one of the supported
Python Qt distributions manually. Python Qt distributions manually.
To select a specific Python Qt distribution, install the package with an additional tag: To select a specific Python Qt distribution, install the package with an additional tag:
@ -28,7 +28,7 @@ pip install bec_widgets[pyqt6]
or or
```bash ```bash
pip install bec_widgets[pyqt5] pip install bec_widgets[pyside6]
``` ```
## Documentation ## Documentation

View File

@ -8,7 +8,7 @@ import redis
from bec_lib.client import BECClient from bec_lib.client import BECClient
from bec_lib.redis_connector import MessageObject, RedisConnector from bec_lib.redis_connector import MessageObject, RedisConnector
from bec_lib.service_config import ServiceConfig from bec_lib.service_config import ServiceConfig
from qtpy.QtCore import PYQT5, PYQT6, PYSIDE2, PYSIDE6, QCoreApplication, QObject from qtpy.QtCore import PYQT6, PYSIDE6, QCoreApplication, QObject
from qtpy.QtCore import Signal as pyqtSignal from qtpy.QtCore import Signal as pyqtSignal
if TYPE_CHECKING: if TYPE_CHECKING:
@ -127,9 +127,9 @@ class BECDispatcher:
return return
# shutdown QCoreApp if it exists # shutdown QCoreApp if it exists
if PYQT5 or PYQT6: if PYQT6:
cls.qapp.exit() cls.qapp.exit()
elif PYSIDE2 or PYSIDE6: elif PYSIDE6:
cls.qapp.shutdown() cls.qapp.shutdown()
cls.qapp = None cls.qapp = None

View File

@ -25,7 +25,7 @@ if PYSIDE6:
class UILoader: class UILoader:
"""Universal UI loader for PyQt5, PyQt6, PySide2, and PySide6.""" """Universal UI loader for PyQt6 and PySide6."""
def __init__(self, parent=None): def __init__(self, parent=None):
self.parent = parent self.parent = parent
@ -34,19 +34,12 @@ class UILoader:
self.custom_widgets = {widget.__name__: widget for widget in widgets} self.custom_widgets = {widget.__name__: widget for widget in widgets}
if QT_VERSION.startswith("5"): if PYSIDE6:
# PyQt5 or PySide2 self.loader = self.load_ui_pyside6
from qtpy import uic elif PYQT6:
self.loader = self.load_ui_pyqt6
self.loader = uic.loadUi else:
elif QT_VERSION.startswith("6"): raise ImportError("No compatible Qt bindings found.")
# PyQt6 or PySide6
if PYSIDE6:
self.loader = self.load_ui_pyside6
elif PYQT6:
self.loader = self.load_ui_pyqt6
else:
raise ImportError("No compatible Qt bindings found.")
def load_ui_pyside6(self, ui_file, parent=None): def load_ui_pyside6(self, ui_file, parent=None):
""" """

View File

@ -10,7 +10,7 @@ Targeting the unique needs of beamline scientists, BEC Widgets stands out with i
**Key Features**: **Key Features**:
- **Integration:** Seamlessly integrates with [BEC (Beamline Experiment Control)](https://gitlab.psi.ch/bec/bec), ensuring a cohesive and efficient experiment control experience. - **Integration:** Seamlessly integrates with [BEC (Beamline Experiment Control)](https://gitlab.psi.ch/bec/bec), ensuring a cohesive and efficient experiment control experience.
- **Support for PyQt5 and PyQt6:** Provides compatibility with both PyQt5 and PyQt6, offering versatility in your development environment. - **Support for Pyside6 and PyQt6:** Provides compatibility with both Pyside6 and PyQt6, offering versatility in your development environment.
- **Widget Modularity:** Features modular widgets that can be easily combined to create customized applications, perfectly aligning with the diverse needs of beamline experiments. - **Widget Modularity:** Features modular widgets that can be easily combined to create customized applications, perfectly aligning with the diverse needs of beamline experiments.
## Getting Started ## Getting Started

View File

@ -16,10 +16,10 @@ To install BEC Widgets using the pip package manager, execute the following comm
pip install 'bec_widgets[pyqt6]' pip install 'bec_widgets[pyqt6]'
``` ```
In case you want to use PyQt5, you can install it by using the following command: In case you want to use Pyside6, you can install it by using the following command:
```bash ```bash
pip install 'bec_widgets[pyqt5]' pip install 'bec_widgets[pyside6]'
``` ```
**Troubleshooting** **Troubleshooting**

View File

@ -37,7 +37,6 @@ dev = [
"pytest-xvfb~=3.0", "pytest-xvfb~=3.0",
"pytest~=8.0", "pytest~=8.0",
] ]
pyqt5 = ["PyQt5>=5.9", "PyQtWebEngine>=5.9"]
pyqt6 = ["PyQt6>=6.7", "PyQt6-WebEngine>=6.7"] pyqt6 = ["PyQt6>=6.7", "PyQt6-WebEngine>=6.7"]
pyside6 = ["PySide6>=6.7"] pyside6 = ["PySide6>=6.7"]