From 2461d7350be6bb6d1433d0553e212f7f754bae0e Mon Sep 17 00:00:00 2001 From: appel_c Date: Wed, 2 Jul 2025 21:24:51 +0200 Subject: [PATCH] fix(bec-progressbar): add flag for theme update --- .../bec_progressbar/bec_progressbar.py | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/bec_widgets/widgets/progress/bec_progressbar/bec_progressbar.py b/bec_widgets/widgets/progress/bec_progressbar/bec_progressbar.py index 2f6189fd..c486ac31 100644 --- a/bec_widgets/widgets/progress/bec_progressbar/bec_progressbar.py +++ b/bec_widgets/widgets/progress/bec_progressbar/bec_progressbar.py @@ -62,7 +62,9 @@ class BECProgressBar(BECWidget, QWidget): ICON_NAME = "page_control" def __init__(self, parent=None, client=None, config=None, gui_id=None, **kwargs): - super().__init__(parent=parent, client=client, gui_id=gui_id, config=config, **kwargs) + super().__init__( + parent=parent, client=client, gui_id=gui_id, config=config, theme_update=True, **kwargs + ) accent_colors = get_accent_colors() @@ -89,7 +91,14 @@ class BECProgressBar(BECWidget, QWidget): # Progress‑bar state handling self._state = ProgressState.NORMAL - self._state_colors = dict(PROGRESS_STATE_COLORS) + # self._state_colors = dict(PROGRESS_STATE_COLORS) + + self._state_colors = { + ProgressState.NORMAL: accent_colors.default, + ProgressState.PAUSED: accent_colors.warning, + ProgressState.INTERRUPTED: accent_colors.emergency, + ProgressState.COMPLETED: accent_colors.success, + } # layout settings self._padding_left_right = 10 @@ -127,6 +136,16 @@ class BECProgressBar(BECWidget, QWidget): """ return self._label_template + def apply_theme(self, theme=None): + """Apply the current theme to the progress bar.""" + accent_colors = get_accent_colors() + self._state_colors = { + ProgressState.NORMAL: accent_colors.default, + ProgressState.PAUSED: accent_colors.warning, + ProgressState.INTERRUPTED: accent_colors.emergency, + ProgressState.COMPLETED: accent_colors.success, + } + @label_template.setter def label_template(self, template): self._label_template = template