0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 19:21:50 +02:00

fix(theme): apply theme to all pyqtgraph widgets on manual updates

This commit is contained in:
2024-08-28 14:34:50 +02:00
parent 4e5520aee2
commit c5501860e8

View File

@ -29,6 +29,7 @@ def set_theme(theme: Literal["dark", "light", "auto"]):
app = QApplication.instance()
bec_qthemes.setup_theme(theme)
pg.setConfigOption("background", "w" if app.theme["theme"] == "light" else "k")
apply_theme(theme)
# pylint: disable=protected-access
if theme != "auto":
@ -44,6 +45,9 @@ def set_theme(theme: Literal["dark", "light", "auto"]):
def apply_theme(theme: Literal["dark", "light"]):
"""
Apply the theme to all pyqtgraph widgets. Do not use this function directly. Use set_theme instead.
"""
app = QApplication.instance()
# go through all pyqtgraph widgets and set background
children = itertools.chain.from_iterable(