mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix(theme): apply theme to all pyqtgraph widgets on manual updates
This commit is contained in:
@ -29,6 +29,7 @@ def set_theme(theme: Literal["dark", "light", "auto"]):
|
|||||||
app = QApplication.instance()
|
app = QApplication.instance()
|
||||||
bec_qthemes.setup_theme(theme)
|
bec_qthemes.setup_theme(theme)
|
||||||
pg.setConfigOption("background", "w" if app.theme["theme"] == "light" else "k")
|
pg.setConfigOption("background", "w" if app.theme["theme"] == "light" else "k")
|
||||||
|
apply_theme(theme)
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
if theme != "auto":
|
if theme != "auto":
|
||||||
@ -44,6 +45,9 @@ def set_theme(theme: Literal["dark", "light", "auto"]):
|
|||||||
|
|
||||||
|
|
||||||
def apply_theme(theme: Literal["dark", "light"]):
|
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()
|
app = QApplication.instance()
|
||||||
# go through all pyqtgraph widgets and set background
|
# go through all pyqtgraph widgets and set background
|
||||||
children = itertools.chain.from_iterable(
|
children = itertools.chain.from_iterable(
|
||||||
|
Reference in New Issue
Block a user