0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 11:11:49 +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"
QT_PCKG:
- "pyside6"
- "pyqt5"
- "pyqt6"
stage: AdditionalTests

View File

@ -3,7 +3,7 @@
# 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
# 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
# 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]
```
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.
To select a specific Python Qt distribution, install the package with an additional tag:
@ -28,7 +28,7 @@ pip install bec_widgets[pyqt6]
or
```bash
pip install bec_widgets[pyqt5]
pip install bec_widgets[pyside6]
```
## Documentation

View File

@ -8,7 +8,7 @@ import redis
from bec_lib.client import BECClient
from bec_lib.redis_connector import MessageObject, RedisConnector
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
if TYPE_CHECKING:
@ -127,9 +127,9 @@ class BECDispatcher:
return
# shutdown QCoreApp if it exists
if PYQT5 or PYQT6:
if PYQT6:
cls.qapp.exit()
elif PYSIDE2 or PYSIDE6:
elif PYSIDE6:
cls.qapp.shutdown()
cls.qapp = None

View File

@ -25,7 +25,7 @@ if PYSIDE6:
class UILoader:
"""Universal UI loader for PyQt5, PyQt6, PySide2, and PySide6."""
"""Universal UI loader for PyQt6 and PySide6."""
def __init__(self, parent=None):
self.parent = parent
@ -34,19 +34,12 @@ class UILoader:
self.custom_widgets = {widget.__name__: widget for widget in widgets}
if QT_VERSION.startswith("5"):
# PyQt5 or PySide2
from qtpy import uic
self.loader = uic.loadUi
elif QT_VERSION.startswith("6"):
# 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.")
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):
"""

View File

@ -10,7 +10,7 @@ Targeting the unique needs of beamline scientists, BEC Widgets stands out with i
**Key Features**:
- **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.
## 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]'
```
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
pip install 'bec_widgets[pyqt5]'
pip install 'bec_widgets[pyside6]'
```
**Troubleshooting**

View File

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