- added a dark theme to FlatCAM (only for canvas). The selection is done in Edit -> Preferences -> General -> GUI Settings
This commit is contained in:
@@ -25,7 +25,25 @@ class VisPyCanvas(scene.SceneCanvas):
|
||||
|
||||
self.unfreeze()
|
||||
|
||||
back_color = str(QPalette().color(QPalette.Window).name())
|
||||
settings = QSettings("Open Source", "FlatCAM")
|
||||
if settings.contains("axis_font_size"):
|
||||
a_fsize = settings.value('axis_font_size', type=int)
|
||||
else:
|
||||
a_fsize = 8
|
||||
|
||||
if settings.contains("theme"):
|
||||
theme = settings.value('theme', type=str)
|
||||
else:
|
||||
theme = 'white'
|
||||
|
||||
if theme == 'white':
|
||||
theme_color = Color('#FFFFFF')
|
||||
tick_color = Color('#000000')
|
||||
back_color = str(QPalette().color(QPalette.Window).name())
|
||||
else:
|
||||
theme_color = Color('#000000')
|
||||
tick_color = Color('gray')
|
||||
back_color = Color('#000000')
|
||||
|
||||
self.central_widget.bgcolor = back_color
|
||||
self.central_widget.border_color = back_color
|
||||
@@ -36,18 +54,16 @@ class VisPyCanvas(scene.SceneCanvas):
|
||||
top_padding = self.grid_widget.add_widget(row=0, col=0, col_span=2)
|
||||
top_padding.height_max = 0
|
||||
|
||||
settings = QSettings("Open Source", "FlatCAM")
|
||||
if settings.contains("axis_font_size"):
|
||||
a_fsize = settings.value('axis_font_size', type=int)
|
||||
else:
|
||||
a_fsize = 8
|
||||
|
||||
self.yaxis = scene.AxisWidget(orientation='left', axis_color='black', text_color='black', font_size=a_fsize)
|
||||
self.yaxis = scene.AxisWidget(
|
||||
orientation='left', axis_color=tick_color, text_color=tick_color, font_size=a_fsize
|
||||
)
|
||||
self.yaxis.width_max = 55
|
||||
self.grid_widget.add_widget(self.yaxis, row=1, col=0)
|
||||
|
||||
self.xaxis = scene.AxisWidget(orientation='bottom', axis_color='black', text_color='black', font_size=a_fsize,
|
||||
anchors=['center', 'bottom'])
|
||||
self.xaxis = scene.AxisWidget(
|
||||
orientation='bottom', axis_color=tick_color, text_color=tick_color, font_size=a_fsize,
|
||||
anchors=['center', 'bottom']
|
||||
)
|
||||
self.xaxis.height_max = 30
|
||||
self.grid_widget.add_widget(self.xaxis, row=2, col=1)
|
||||
|
||||
@@ -55,7 +71,7 @@ class VisPyCanvas(scene.SceneCanvas):
|
||||
# right_padding.width_max = 24
|
||||
right_padding.width_max = 0
|
||||
|
||||
view = self.grid_widget.add_view(row=1, col=1, border_color='black', bgcolor='white')
|
||||
view = self.grid_widget.add_view(row=1, col=1, border_color=tick_color, bgcolor=theme_color)
|
||||
view.camera = Camera(aspect=1, rect=(-25, -25, 150, 150))
|
||||
|
||||
# Following function was removed from 'prepare_draw()' of 'Grid' class by patch,
|
||||
|
||||
Reference in New Issue
Block a user