1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-04 16:02:51 +01:00

build: PySide6-QtAds; bec_qtheme V1; dependencies updated and adjusted

This commit is contained in:
2025-08-07 16:36:53 +02:00
parent de8fe3b5f5
commit 605c13a6ea
5 changed files with 23 additions and 31 deletions

View File

@@ -15,16 +15,23 @@ classifiers = [
dependencies = [
"bec_ipython_client~=3.70", # needed for jupyter console
"bec_lib~=3.70",
"bec_qthemes~=0.7, >=0.7",
"black~=25.0", # needed for bw-generate-cli
"isort~=5.13, >=5.13.2", # needed for bw-generate-cli
"bec_qthemes~=1.0, >=1.1.2",
"black~=25.0", # needed for bw-generate-cli
"isort~=5.13, >=5.13.2", # needed for bw-generate-cli
"ophyd_devices~=1.29, >=1.29.1",
"pydantic~=2.0",
"pyqtgraph==0.13.7",
"PySide6==6.9.0",
"qtconsole~=5.5, >=5.5.1", # needed for jupyter console
"qtconsole~=5.5, >=5.5.1", # needed for jupyter console
"qtpy~=2.4",
"qtmonaco~=0.5",
"thefuzz~=0.22",
"qtmonaco~=0.8, >=0.8.1",
"darkdetect~=0.8",
"PySide6-QtAds==4.4.0",
"pylsp-bec~=1.2",
"copier~=9.7",
"typer~=0.15",
"markdown~=3.9",
]
@@ -41,7 +48,6 @@ dev = [
"pytest-cov~=6.1.1",
"watchdog~=6.0",
"pre_commit~=4.2",
]
[project.urls]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -6,6 +6,7 @@ import numpy as np
import pytest
from bec_lib import messages
from bec_lib.messages import _StoredDataInfo
from bec_qthemes import apply_theme
from pytestqt.exceptions import TimeoutError as QtBotTimeoutError
from qtpy.QtWidgets import QApplication, QMessageBox
@@ -25,6 +26,10 @@ def pytest_runtest_makereport(item, call):
@pytest.fixture(autouse=True)
def qapplication(qtbot, request, testable_qtimer_class): # pylint: disable=unused-argument
qapp = QApplication.instance()
apply_theme("light")
qapp.processEvents()
yield
# if the test failed, we don't want to check for open widgets as
@@ -36,7 +41,6 @@ def qapplication(qtbot, request, testable_qtimer_class): # pylint: disable=unus
bec_dispatcher.stop_cli_server()
testable_qtimer_class.check_all_stopped(qtbot)
qapp = QApplication.instance()
qapp.processEvents()
if hasattr(qapp, "os_listener") and qapp.os_listener:
qapp.removeEventFilter(qapp.os_listener)

View File

@@ -2,9 +2,8 @@ from unittest import mock
import pytest
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QApplication
from bec_widgets.utils.colors import set_theme
from bec_widgets.utils.colors import apply_theme
from bec_widgets.widgets.utility.visual.dark_mode_button.dark_mode_button import DarkModeButton
# pylint: disable=unused-import
@@ -21,7 +20,7 @@ def dark_mode_button(qtbot, mocked_client):
button = DarkModeButton(client=mocked_client)
qtbot.addWidget(button)
qtbot.waitExposed(button)
set_theme("light")
apply_theme("light")
yield button
@@ -64,23 +63,10 @@ def test_dark_mode_button_changes_theme(dark_mode_button):
Test that the dark mode button changes the theme correctly.
"""
with mock.patch(
"bec_widgets.widgets.utility.visual.dark_mode_button.dark_mode_button.set_theme"
) as mocked_set_theme:
"bec_widgets.widgets.utility.visual.dark_mode_button.dark_mode_button.apply_theme"
) as mocked_apply_theme:
dark_mode_button.toggle_dark_mode()
mocked_set_theme.assert_called_with("dark")
mocked_apply_theme.assert_called_with("dark")
dark_mode_button.toggle_dark_mode()
mocked_set_theme.assert_called_with("light")
def test_dark_mode_button_changes_on_os_theme_change(qtbot, dark_mode_button):
"""
Test that the dark mode button changes the theme correctly when the OS theme changes.
"""
qapp = QApplication.instance()
assert dark_mode_button.dark_mode_enabled is False
assert dark_mode_button.mode_button.toolTip() == "Set Dark Mode"
qapp.theme_signal.theme_updated.emit("dark")
qtbot.wait(100)
assert dark_mode_button.dark_mode_enabled is True
assert dark_mode_button.mode_button.toolTip() == "Set Light Mode"
mocked_apply_theme.assert_called_with("light")

View File

@@ -17,10 +17,6 @@ def stop_button(qtbot, mocked_client):
def test_stop_button(stop_button):
assert stop_button.button.text() == "Stop"
assert (
stop_button.button.styleSheet()
== "background-color: #cc181e; color: white; font-weight: bold; font-size: 12px;"
)
stop_button.button.click()
assert stop_button.queue.request_scan_halt.called
stop_button.close()