Aller au contenu
OpenToAll
Retour aux issues
Youth-Research-Center/PandaPlot #188

Move sidebar panel title theming into SidebarPanel base class

Débutant enhancementgood first issue
1 ★ Poids du clone léger Mise à jour

Description

The line applying the title label's theme stylesheet is duplicated identically across every sidebar panel's `_apply_theme()`: ```python self.title_label.setStyleSheet(self.title_stylesheet(base_fg, card_border)) ``` Found in: - `pandaplot/gui/components/sidebar/fit/fit_panel.py` - `pandaplot/gui/components/sidebar/signal/signal_panel.py` - `pandaplot/gui/components/sidebar/chart/chart_properties_panel.py` - `pandaplot/gui/components/sidebar/transform/transform_panel.py` - `pandaplot/gui/components/sidebar/statistics/statistics_panel.py` - `pandaplot/gui/components/sidebar/statistics/descriptive_panel.py` - `pandaplot/gui/components/sidebar/preprocessing/preprocessing_panel.py` - `pandaplot/gui/components/sidebar/analysis/analysis_panel.py` - `pandaplot/gui/components/sidebar/search/search_panel.py` - `pandaplot/gui/components/sidebar/project/project_view_panel.py` `SidebarPanel` (`pandaplot/gui/components/sidebar/panels/sidebar_panel.py`) already owns `title_label` (typed `Optional[QLabel]`) and the shared `title_stylesheet()` static method, but applying the stylesheet to `title_label` is left to each subclass to repeat. Proposed fix: add something like `SidebarPanel._apply_title_theme(base_fg, card_border)` that guards `if self.title_label is not None:` before calling `setStyleSheet`, and have all 10 panels call it instead of duplicating the line. The `None` guard matters because `title_label` is only set once `_set_title()` runs, and `_apply_theme()` can in principle be invoked before that (e.g. via the base `ThemeEvents.THEME_CHANGED` subscription) depending on subclass init order. Raised while reviewing PR #172's fit panel changes.

Issues similaires

Tout voir
Ouvre sur GitHub