0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

fix(widgets): fixed default theme for widgets

If not theme is set, the init of the BECWidget base class sets the default theme to "dark"
This commit is contained in:
2024-08-26 13:47:19 +02:00
committed by wyzula_j
parent 13ae383455
commit cf28730515

View File

@ -1,6 +1,7 @@
from qtpy.QtWidgets import QWidget
from qtpy.QtWidgets import QApplication, QWidget
from bec_widgets.utils.bec_connector import BECConnector, ConnectionConfig
from bec_widgets.utils.colors import set_theme
class BECWidget(BECConnector):
@ -11,9 +12,13 @@ class BECWidget(BECConnector):
raise RuntimeError(f"{repr(self)} is not a subclass of QWidget")
super().__init__(client, config, gui_id)
# Set the theme to auto if it is not set yet
app = QApplication.instance()
if not hasattr(app, "theme"):
set_theme("dark")
def cleanup(self):
"""Cleanup the widget."""
pass
def closeEvent(self, event):
self.rpc_register.remove_rpc(self)