1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-05 00:12:49 +01:00

fix: remove manual stylesheet deletion/override

This commit is contained in:
2026-01-19 15:19:05 +01:00
committed by Christian Appel
parent cc89252fb3
commit 75162ef8a8
5 changed files with 3 additions and 36 deletions

View File

@@ -513,7 +513,8 @@ class UploadRedisDialog(QtWidgets.QDialog):
[
detailed_text,
"These devices may not be reachable and disabled BEC upon loading the config.",
"Consider validating these connections before.",
"Consider validating these connections before proceeding.\n\n",
"Continue anyway?",
]
)
reply = QtWidgets.QMessageBox.critical(

View File

@@ -264,7 +264,6 @@ class LegendLabel(QtWidgets.QWidget):
icon = self._icons["config_status"][status]
icon_widget = ValidationButton(parent=self, icon=icon)
icon_widget.setEnabled(False)
icon_widget.set_enabled_style(False)
icon_widget.setToolTip(f"Device Configuration: {status.description()}")
layout.addWidget(icon_widget, 0, ii + 1)
@@ -282,7 +281,6 @@ class LegendLabel(QtWidgets.QWidget):
icon = self._icons["connection_status"][status]
icon_widget = ValidationButton(parent=self, icon=icon)
icon_widget.setEnabled(False)
icon_widget.set_enabled_style(False)
icon_widget.setToolTip(f"Connection Status: {status.description()}")
layout.addWidget(icon_widget, 1, ii + 1)
layout.setColumnStretch(layout.columnCount(), 1) # Counts as a column

View File

@@ -38,20 +38,8 @@ class ValidationButton(QtWidgets.QPushButton):
self.setEnabled(True)
def setEnabled(self, enabled: bool) -> None:
self.set_enabled_style(enabled)
return super().setEnabled(enabled)
def set_enabled_style(self, enabled: bool) -> None:
"""Set the enabled state of the button with style update.
Args:
enabled (bool): Whether the button should be enabled.
"""
if enabled:
self.setStyleSheet("")
else:
self.setStyleSheet(self.transparent_style)
class ValidationDialog(QtWidgets.QDialog):
"""
@@ -308,13 +296,11 @@ class ValidationListItem(QtWidgets.QWidget):
# Enable/disable buttons based on status
config_but_en = config_status in [ConfigStatus.UNKNOWN, ConfigStatus.INVALID]
self.status_button.setEnabled(config_but_en)
self.status_button.set_enabled_style(config_but_en)
connect_but_en = connection_status in [
ConnectionStatus.UNKNOWN,
ConnectionStatus.CANNOT_CONNECT,
]
self.connection_button.setEnabled(connect_but_en)
self.connection_button.set_enabled_style(connect_but_en)
@SafeSlot()
def validation_scheduled(self):
@@ -323,9 +309,7 @@ class ValidationListItem(QtWidgets.QWidget):
"Validation scheduled...", ConfigStatus.UNKNOWN, ConnectionStatus.UNKNOWN
)
self.status_button.setEnabled(False)
self.status_button.set_enabled_style(False)
self.connection_button.setEnabled(False)
self.connection_button.set_enabled_style(False)
self._spinner.setVisible(True)
@SafeSlot()

View File

@@ -82,7 +82,7 @@ class BECProgressBar(BECWidget, QWidget):
# Color settings
self._background_color = QColor(30, 30, 30)
self._progress_color = accent_colors.highlight # QColor(210, 55, 130)
self._progress_color = accent_colors.highlight
self._completed_color = accent_colors.success
self._border_color = QColor(50, 50, 50)
@@ -91,7 +91,6 @@ class BECProgressBar(BECWidget, QWidget):
# Progressbar state handling
self._state = ProgressState.NORMAL
# self._state_colors = dict(PROGRESS_STATE_COLORS)
self._state_colors = {
ProgressState.NORMAL: accent_colors.default,
@@ -109,7 +108,6 @@ class BECProgressBar(BECWidget, QWidget):
# label on top of the progress bar
self.center_label = QLabel(self)
self.center_label.setAlignment(Qt.AlignHCenter)
self.center_label.setStyleSheet("color: white;")
self.center_label.setMinimumSize(0, 0)
layout = QVBoxLayout(self)

View File

@@ -3,7 +3,6 @@
from bec_lib.endpoints import MessageEndpoints
from bec_lib.messages import DeviceInitializationProgressMessage
from qtpy.QtCore import Signal
from qtpy.QtGui import QColor
from qtpy.QtWidgets import QApplication, QGroupBox, QHBoxLayout, QLabel, QVBoxLayout, QWidget
from bec_widgets.utils.bec_widget import BECWidget
@@ -37,7 +36,6 @@ class DeviceInitializationProgressBar(BECWidget, QWidget):
self.progress_bar.label_template = "$value / $maximum - $percentage %"
self.progress_label = QLabel("Initializing devices...", self)
self.progress_label.setStyleSheet("font-size: 12px; font-weight: cursive;")
content_layout = QVBoxLayout()
content_layout.setContentsMargins(0, 0, 0, 0)
content_layout.setSpacing(0)
@@ -60,18 +58,6 @@ class DeviceInitializationProgressBar(BECWidget, QWidget):
)
self._reset_progress_bar()
def _update_palette(self) -> None:
"""Update theme palette for the widget."""
_app = QApplication.instance()
if hasattr(_app, "theme"):
theme = _app.theme # type: ignore[attr-defined]
text_color = theme.color("FG")
else:
text_color = QColor(230, 230, 230)
self.progress_label.setStyleSheet(
f"color: {text_color.name()}; font-size: 12px; font-weight: cursive;"
)
@SafeProperty(list)
def failed_devices(self) -> list[str]:
"""Get the list of devices that failed to initialize.