- added ability to control the color of the project items for the dark theme too
This commit is contained in:
@@ -15,7 +15,8 @@ CHANGELOG for FlatCAM Evo beta
|
||||
- in Geometry Editor, for Path tool, added UI that close on end of the Path tool action; it displays the projected length which now is kept for as long as it is wanted, allowing for path automation in case of repetitive lengths
|
||||
- solved a ZeroDivisionError exception in the Geometry Editor -> Path Tool
|
||||
- in Geometry Editor, for Path tool, added the ability to differentiate between creating a multidigit number for the projection and starting a new number (for a new segment)
|
||||
-
|
||||
- added ability to control the color of the project items for the dark theme too
|
||||
|
||||
13.04.2022
|
||||
|
||||
- fixed the display of lines in Distance Plugin when using 'snap to' together with 'multipoint'
|
||||
|
||||
@@ -87,8 +87,11 @@ class PreferencesUIManager(QtCore.QObject):
|
||||
"global_draw_color": self.ui.general_pref_form.general_gui_group.draw_color_entry,
|
||||
"global_sel_draw_color": self.ui.general_pref_form.general_gui_group.sel_draw_color_entry,
|
||||
|
||||
"global_proj_item_color": self.ui.general_pref_form.general_gui_group.proj_color_entry,
|
||||
"global_proj_item_dis_color": self.ui.general_pref_form.general_gui_group.proj_color_dis_entry,
|
||||
"global_proj_item_color_light": self.ui.general_pref_form.general_gui_group.proj_color_light_entry,
|
||||
"global_proj_item_dis_color_light": self.ui.general_pref_form.general_gui_group.proj_color_dis_light_entry,
|
||||
"global_proj_item_color_dark": self.ui.general_pref_form.general_gui_group.proj_color_dark_entry,
|
||||
"global_proj_item_dis_color_dark": self.ui.general_pref_form.general_gui_group.proj_color_dis_dark_entry,
|
||||
|
||||
"global_project_autohide": self.ui.general_pref_form.general_gui_group.project_autohide_cb,
|
||||
|
||||
# General APP Settings
|
||||
@@ -1006,13 +1009,21 @@ class PreferencesUIManager(QtCore.QObject):
|
||||
self.ui.general_pref_form.general_gui_group.sel_draw_color_entry.set_value(
|
||||
self.defaults['global_sel_draw_color'])
|
||||
|
||||
# Init Project Items color
|
||||
self.ui.general_pref_form.general_gui_group.proj_color_entry.set_value(
|
||||
self.defaults['global_proj_item_color'])
|
||||
# Init Project Items color - Light Theme
|
||||
self.ui.general_pref_form.general_gui_group.proj_color_light_entry.set_value(
|
||||
self.defaults['global_proj_item_color_light'])
|
||||
|
||||
# Init Project Disabled Items color
|
||||
self.ui.general_pref_form.general_gui_group.proj_color_dis_entry.set_value(
|
||||
self.defaults['global_proj_item_dis_color'])
|
||||
# Init Project Disabled Items color - Light Theme
|
||||
self.ui.general_pref_form.general_gui_group.proj_color_dis_light_entry.set_value(
|
||||
self.defaults['global_proj_item_dis_color_light'])
|
||||
|
||||
# Init Project Items color - Dark Theme
|
||||
self.ui.general_pref_form.general_gui_group.proj_color_dark_entry.set_value(
|
||||
self.defaults['global_proj_item_color_dark'])
|
||||
|
||||
# Init Project Disabled Items color - Dark Theme
|
||||
self.ui.general_pref_form.general_gui_group.proj_color_dis_dark_entry.set_value(
|
||||
self.defaults['global_proj_item_dis_color_dark'])
|
||||
|
||||
# Init Mouse Cursor color
|
||||
self.ui.general_pref_form.general_app_set_group.mouse_cursor_entry.set_value(
|
||||
|
||||
@@ -272,29 +272,59 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||
# ------------------------------------------------------------------
|
||||
# ----------------------- Project Settings -----------------------------
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
self.proj_settings_label = FCLabel('<b>%s</b>' % _('Project Items Color'))
|
||||
grid1.addWidget(self.proj_settings_label, 28, 0, 1, 2)
|
||||
# Light Theme
|
||||
self.proj_settings_l_label = FCLabel('<b>%s</b> - %s' % (_('Project Items Color'), _("Light")))
|
||||
grid1.addWidget(self.proj_settings_l_label, 28, 0, 1, 2)
|
||||
|
||||
# Project Tab items color
|
||||
self.proj_color_label = FCLabel('%s:' % _('Enabled'))
|
||||
self.proj_color_label.setToolTip(
|
||||
_("Set the color of the items in Project Tab Tree.")
|
||||
self.proj_color_l_label = FCLabel('%s:' % _('Enabled'))
|
||||
self.proj_color_l_label.setToolTip(
|
||||
'%s %s' % (_("Set the color of the items in Project Tab Tree."), _("Light Theme."))
|
||||
)
|
||||
self.proj_color_entry = FCColorEntry(icon=QtGui.QIcon(self.app.resource_location + '/set_colors64.png'))
|
||||
self.proj_color_light_entry = FCColorEntry(icon=QtGui.QIcon(self.app.resource_location + '/set_colors64.png'))
|
||||
|
||||
grid1.addWidget(self.proj_color_label, 30, 0)
|
||||
grid1.addWidget(self.proj_color_entry, 30, 1)
|
||||
grid1.addWidget(self.proj_color_l_label, 30, 0)
|
||||
grid1.addWidget(self.proj_color_light_entry, 30, 1)
|
||||
|
||||
self.proj_color_dis_label = FCLabel('%s:' % _('Disabled'))
|
||||
self.proj_color_dis_label.setToolTip(
|
||||
_("Set the color of the items in Project Tab Tree,\n"
|
||||
"for the case when the items are disabled.")
|
||||
self.proj_color_dis_l_label = FCLabel('%s:' % _('Disabled'))
|
||||
self.proj_color_dis_l_label.setToolTip(
|
||||
'%s %s' % (
|
||||
_("Set the color of the items in Project Tab Tree,\n"
|
||||
"for the case when the items are disabled."),
|
||||
_("Light Theme."))
|
||||
)
|
||||
self.proj_color_dis_entry = FCColorEntry(icon=QtGui.QIcon(self.app.resource_location + '/set_colors64.png'))
|
||||
self.proj_color_dis_light_entry = FCColorEntry(icon=QtGui.QIcon(
|
||||
self.app.resource_location + '/set_colors64.png'))
|
||||
|
||||
grid1.addWidget(self.proj_color_dis_label, 32, 0)
|
||||
grid1.addWidget(self.proj_color_dis_entry, 32, 1)
|
||||
grid1.addWidget(self.proj_color_dis_l_label, 32, 0)
|
||||
grid1.addWidget(self.proj_color_dis_light_entry, 32, 1)
|
||||
|
||||
# Dark Theme
|
||||
self.proj_settings_d_label = FCLabel('<b>%s</b> - %s' % (_('Project Items Color'), _("Dark")))
|
||||
grid1.addWidget(self.proj_settings_d_label, 34, 0, 1, 2)
|
||||
|
||||
# Project Tab items color
|
||||
self.proj_color_d_label = FCLabel('%s:' % _('Enabled'))
|
||||
self.proj_color_d_label.setToolTip(
|
||||
'%s %s' % (_("Set the color of the items in Project Tab Tree."), _("Dark Theme."))
|
||||
)
|
||||
self.proj_color_dark_entry = FCColorEntry(icon=QtGui.QIcon(self.app.resource_location + '/set_colors64.png'))
|
||||
|
||||
grid1.addWidget(self.proj_color_d_label, 36, 0)
|
||||
grid1.addWidget(self.proj_color_dark_entry, 36, 1)
|
||||
|
||||
self.proj_color_dis_d_label = FCLabel('%s:' % _('Disabled'))
|
||||
self.proj_color_dis_d_label.setToolTip(
|
||||
'%s %s' % (
|
||||
_("Set the color of the items in Project Tab Tree,\n"
|
||||
"for the case when the items are disabled."),
|
||||
_("Dark Theme."))
|
||||
)
|
||||
self.proj_color_dis_dark_entry = FCColorEntry(icon=QtGui.QIcon(
|
||||
self.app.resource_location + '/set_colors64.png'))
|
||||
|
||||
grid1.addWidget(self.proj_color_dis_d_label, 38, 0)
|
||||
grid1.addWidget(self.proj_color_dis_dark_entry, 38, 1)
|
||||
|
||||
GLay.set_common_column_size([grid0, grid1], 0)
|
||||
|
||||
@@ -330,8 +360,11 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||
self.draw_color_entry.editingFinished.connect(self.on_draw_color_entry)
|
||||
self.sel_draw_color_entry.editingFinished.connect(self.on_sel_draw_color_entry)
|
||||
|
||||
self.proj_color_entry.editingFinished.connect(self.on_proj_color_entry)
|
||||
self.proj_color_dis_entry.editingFinished.connect(self.on_proj_color_dis_entry)
|
||||
self.proj_color_light_entry.editingFinished.connect(self.on_proj_color_light_entry)
|
||||
self.proj_color_dis_light_entry.editingFinished.connect(self.on_proj_color_dis_light_entry)
|
||||
|
||||
self.proj_color_dark_entry.editingFinished.connect(self.on_proj_color_dark_entry)
|
||||
self.proj_color_dis_dark_entry.editingFinished.connect(self.on_proj_color_dis_dark_entry)
|
||||
|
||||
self.layout_combo.activated.connect(self.app.on_layout)
|
||||
|
||||
@@ -400,8 +433,14 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||
def on_sel_draw_color_entry(self):
|
||||
self.app.options['global_sel_draw_color'] = self.sel_draw_color_entry.get_value()
|
||||
|
||||
def on_proj_color_entry(self):
|
||||
self.app.options['global_proj_item_color'] = self.proj_color_entry.get_value()
|
||||
def on_proj_color_light_entry(self):
|
||||
self.app.options['global_proj_item_color_light'] = self.proj_color_light_entry.get_value()
|
||||
|
||||
def on_proj_color_dis_entry(self):
|
||||
self.app.options['global_proj_item_dis_color'] = self.proj_color_dis_entry.get_value()
|
||||
def on_proj_color_dis_light_entry(self):
|
||||
self.app.options['global_proj_item_dis_color_light'] = self.proj_color_dis_light_entry.get_value()
|
||||
|
||||
def on_proj_color_dark_entry(self):
|
||||
self.app.options['global_proj_item_color_dark'] = self.proj_color_dark_entry.get_value()
|
||||
|
||||
def on_proj_color_dis_dark_entry(self):
|
||||
self.app.options['global_proj_item_dis_color_dark'] = self.proj_color_dis_dark_entry.get_value()
|
||||
|
||||
@@ -505,8 +505,16 @@ class ObjectCollection(QtCore.QAbstractItemModel):
|
||||
return index.internalPointer().data(index.column())
|
||||
|
||||
if role == Qt.ItemDataRole.ForegroundRole:
|
||||
color = QColor(self.app.options['global_proj_item_color'][:-2])
|
||||
color_disabled = QColor(self.app.options['global_proj_item_dis_color'][:-2])
|
||||
theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
|
||||
theme = theme_settings.value('theme', type=str)
|
||||
|
||||
if theme in ['black', 'dark']:
|
||||
color = QColor(self.app.options['global_proj_item_color_dark'][:-2])
|
||||
color_disabled = QColor(self.app.options['global_proj_item_dis_color_dark'][:-2])
|
||||
else:
|
||||
color = QColor(self.app.options['global_proj_item_color_light'][:-2])
|
||||
color_disabled = QColor(self.app.options['global_proj_item_dis_color_light'][:-2])
|
||||
|
||||
obj = index.internalPointer().obj
|
||||
if obj:
|
||||
return QtGui.QBrush(color) if obj.obj_options["plot"] else QtGui.QBrush(color_disabled)
|
||||
|
||||
@@ -125,8 +125,13 @@ class AppDefaults:
|
||||
"global_alt_sel_line": '#006E20BF',
|
||||
"global_draw_color": '#FF000080',
|
||||
"global_sel_draw_color": '#0000FF80',
|
||||
"global_proj_item_color": '#000000FF',
|
||||
"global_proj_item_dis_color": '#b7b7cbFF',
|
||||
|
||||
# Project Items colors
|
||||
"global_proj_item_color_light": '#000000FF',
|
||||
"global_proj_item_dis_color_light": '#b7b7cbFF',
|
||||
"global_proj_item_color_dark": '#4385C8FF',
|
||||
"global_proj_item_dis_color_dark": '#61616CFF',
|
||||
|
||||
"global_project_autohide": True,
|
||||
|
||||
# General App Settings
|
||||
|
||||
Reference in New Issue
Block a user