|
1 | 1 | import sys
|
2 | 2 |
|
| 3 | +from PyQt5.QtGui import QPalette, QColor |
3 | 4 | from PyQt5.QtWidgets import (QLabel, QMainWindow, QToolBar, QDockWidget, QAction)
|
4 | 5 |
|
5 | 6 | import cadquery as cq
|
@@ -30,6 +31,9 @@ def __init__(self,parent=None):
|
30 | 31 | super(MainWindow,self).__init__(parent)
|
31 | 32 | MainMixin.__init__(self)
|
32 | 33 |
|
| 34 | + self.toolbar = None |
| 35 | + self.status_label = None |
| 36 | + |
33 | 37 | self.setWindowIcon(icon('app'))
|
34 | 38 |
|
35 | 39 | self.viewer = OCCViewer(self)
|
@@ -189,7 +193,13 @@ def prepare_menubar_component(self,menus,comp_menu_dict):
|
189 | 193 |
|
190 | 194 | def prepare_toolbar(self):
|
191 | 195 |
|
192 |
| - self.toolbar = QToolBar('Main toolbar',self,objectName='Main toolbar') |
| 196 | + self.toolbar = QToolBar('Main toolbar', self, objectName='Main toolbar') |
| 197 | + |
| 198 | + p = self.toolbar.palette() |
| 199 | + if p.color(QPalette.Background).lightnessF() < 0.5: # dark theme is active |
| 200 | + p.setColor(QPalette.Button, QColor(120, 120, 120)) |
| 201 | + p.setColor(QPalette.Background, QColor(170, 170, 170)) |
| 202 | + self.toolbar.setPalette(p) |
193 | 203 |
|
194 | 204 | for c in self.components.values():
|
195 | 205 | add_actions(self.toolbar,c.toolbarActions())
|
@@ -325,6 +335,3 @@ def cq_documentation(self):
|
325 | 335 |
|
326 | 336 | open_url('https://cadquery.readthedocs.io/en/latest/')
|
327 | 337 |
|
328 |
| -if __name__ == "__main__": |
329 |
| - |
330 |
| - pass |
|
0 commit comments