diff --git a/cq_editor/main_window.py b/cq_editor/main_window.py index d66890ec..558ec6ea 100644 --- a/cq_editor/main_window.py +++ b/cq_editor/main_window.py @@ -1,5 +1,6 @@ import sys +from PyQt5.QtGui import QPalette, QColor from PyQt5.QtWidgets import (QLabel, QMainWindow, QToolBar, QDockWidget, QAction) import cadquery as cq @@ -30,6 +31,9 @@ def __init__(self,parent=None): super(MainWindow,self).__init__(parent) MainMixin.__init__(self) + self.toolbar = None + self.status_label = None + self.setWindowIcon(icon('app')) self.viewer = OCCViewer(self) @@ -189,7 +193,13 @@ def prepare_menubar_component(self,menus,comp_menu_dict): def prepare_toolbar(self): - self.toolbar = QToolBar('Main toolbar',self,objectName='Main toolbar') + self.toolbar = QToolBar('Main toolbar', self, objectName='Main toolbar') + + p = self.toolbar.palette() + if p.color(QPalette.Background).lightnessF() < 0.5: # dark theme is active + p.setColor(QPalette.Button, QColor(120, 120, 120)) + p.setColor(QPalette.Background, QColor(170, 170, 170)) + self.toolbar.setPalette(p) for c in self.components.values(): add_actions(self.toolbar,c.toolbarActions())