wip fake theme removed

This commit is contained in:
2026-06-06 18:48:36 +02:00
parent d95abc00e6
commit 78a6a7ec43
2 changed files with 7 additions and 34 deletions
@@ -799,7 +799,7 @@ class BeamlineStatePill(BECWidget, QWidget):
app = QApplication.instance()
palette = app.palette() if app is not None else QPalette()
theme = getattr(app, "theme", None) if app is not None else None
light_theme = get_theme_name() == "dark"
light_theme = get_theme_name() == "light"
foreground = theme_color(theme, "FG", palette.text().color())
on_primary = theme_color(theme, "ON_PRIMARY", QColor("#ffffff"))
+6 -33
View File
@@ -3,9 +3,9 @@ from pathlib import Path
import shiboken6
from bec_lib import messages
from qtpy.QtCore import QCoreApplication, QEvent, QPoint, Qt
from qtpy.QtGui import QColor
from qtpy.QtWidgets import QApplication, QMessageBox, QSizePolicy
from qtpy.QtWidgets import QMessageBox, QSizePolicy
from bec_widgets.utils.colors import apply_theme
from bec_widgets.utils.toolbars.toolbar import ModularToolBar
from bec_widgets.widgets.services.beamline_states import beamline_state_pill as pill_module
from bec_widgets.widgets.services.beamline_states.beamline_state_pill import (
@@ -21,29 +21,6 @@ from bec_widgets.widgets.utility.spinbox.decimal_spinbox import BECSpinBox
from .client_mocks import mocked_client
class _FakeAccentColors:
default = QColor("#0a60ff")
success = QColor("#2CA58D")
emergency = QColor("#CC181E")
warning = QColor("#EAC435")
class _FakeTheme:
def __init__(self, theme: str) -> None:
self.theme = theme
self.accent_colors = _FakeAccentColors()
self._colors = {
"CARD_BG": "#ffffff" if theme == "light" else "#171a21",
"FG": "#151924" if theme == "light" else "#e8ebf1",
"BORDER": "#d9dde6" if theme == "light" else "#2a2f3a",
"ON_PRIMARY": "#ffffff",
"ACCENT_DEFAULT": "#0a60ff" if theme == "light" else "#8ab4f7",
}
def color(self, key: str, fallback: str = "#000000") -> QColor:
return QColor(self._colors.get(key, fallback))
def _gradient_alpha(colors: dict[str, str]) -> int:
return int(colors["gradient_accent"].rsplit(",", 1)[1].strip(" )"))
@@ -194,11 +171,8 @@ def test_beamline_state_pill_declares_card_style_for_hover(qtbot, mocked_client)
assert not widget._shadow.isEnabled()
def test_beamline_state_pill_light_mode_uses_neutral_card_with_subtle_left_gradient(
qtbot, monkeypatch
):
app = QApplication.instance()
monkeypatch.setattr(app, "theme", _FakeTheme("light"), raising=False)
def test_beamline_state_pill_light_mode_uses_neutral_card_with_subtle_left_gradient(qtbot):
apply_theme("light")
for status in ("valid", "invalid", "warning"):
colors = BeamlineStatePill._state_colors(status)
@@ -221,9 +195,8 @@ def test_beamline_state_pill_does_not_override_themed_input_controls(qtbot, mock
assert "QCheckBox::indicator" not in stylesheet
def test_beamline_state_pill_dark_mode_keeps_existing_gradient_strength(qtbot, monkeypatch):
app = QApplication.instance()
monkeypatch.setattr(app, "theme", _FakeTheme("dark"), raising=False)
def test_beamline_state_pill_dark_mode_keeps_existing_gradient_strength(qtbot):
apply_theme("dark")
colors = BeamlineStatePill._state_colors("warning")