- in Preferences replaced the widgets that sets colors with a compound one (from David Robertson)
This commit is contained in:
parent
907de3fa9e
commit
aef1607fd5
|
@ -704,6 +704,8 @@ class FCColorEntry(QtWidgets.QFrame):
|
||||||
self.entry.editingFinished.connect(self._sync_button_color)
|
self.entry.editingFinished.connect(self._sync_button_color)
|
||||||
self.button.clicked.connect(self._on_button_clicked)
|
self.button.clicked.connect(self._on_button_clicked)
|
||||||
|
|
||||||
|
self.editingFinished = self.entry.editingFinished
|
||||||
|
|
||||||
def get_value(self) -> str:
|
def get_value(self) -> str:
|
||||||
return self.entry.get_value()
|
return self.entry.get_value()
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,8 @@ class PreferencesUIManager:
|
||||||
"gerber_def_zeros": self.ui.gerber_defaults_form.gerber_gen_group.gerber_zeros_radio,
|
"gerber_def_zeros": self.ui.gerber_defaults_form.gerber_gen_group.gerber_zeros_radio,
|
||||||
"gerber_clean_apertures": self.ui.gerber_defaults_form.gerber_gen_group.gerber_clean_cb,
|
"gerber_clean_apertures": self.ui.gerber_defaults_form.gerber_gen_group.gerber_clean_cb,
|
||||||
"gerber_extra_buffering": self.ui.gerber_defaults_form.gerber_gen_group.gerber_extra_buffering,
|
"gerber_extra_buffering": self.ui.gerber_defaults_form.gerber_gen_group.gerber_extra_buffering,
|
||||||
"gerber_plot_fill": self.ui.gerber_defaults_form.gerber_gen_group.pf_color_entry,
|
"gerber_plot_fill": self.ui.gerber_defaults_form.gerber_gen_group.fill_color_entry,
|
||||||
"gerber_plot_line": self.ui.gerber_defaults_form.gerber_gen_group.pl_color_entry,
|
"gerber_plot_line": self.ui.gerber_defaults_form.gerber_gen_group.line_color_entry,
|
||||||
|
|
||||||
# Gerber Options
|
# Gerber Options
|
||||||
"gerber_noncoppermargin": self.ui.gerber_defaults_form.gerber_opt_group.noncopper_margin_entry,
|
"gerber_noncoppermargin": self.ui.gerber_defaults_form.gerber_opt_group.noncopper_margin_entry,
|
||||||
|
@ -737,7 +737,7 @@ class PreferencesUIManager:
|
||||||
self.ui.fa_scroll_area.setWidget(fa_form)
|
self.ui.fa_scroll_area.setWidget(fa_form)
|
||||||
fa_form.show()
|
fa_form.show()
|
||||||
|
|
||||||
# Initialize the color box's color in Preferences -> Global -> Colo
|
# Initialize the color box's color in Preferences -> Global -> Colors
|
||||||
self.__init_color_pickers()
|
self.__init_color_pickers()
|
||||||
|
|
||||||
# Button handlers
|
# Button handlers
|
||||||
|
@ -750,162 +750,90 @@ class PreferencesUIManager:
|
||||||
|
|
||||||
def __init_color_pickers(self):
|
def __init_color_pickers(self):
|
||||||
# Init Gerber Plot Colors
|
# Init Gerber Plot Colors
|
||||||
self.ui.gerber_defaults_form.gerber_gen_group.pf_color_entry.set_value(self.defaults['gerber_plot_fill'])
|
self.ui.gerber_defaults_form.gerber_gen_group.fill_color_entry.set_value(self.defaults['gerber_plot_fill'])
|
||||||
self.ui.gerber_defaults_form.gerber_gen_group.pf_color_button.setStyleSheet(
|
self.ui.gerber_defaults_form.gerber_gen_group.line_color_entry.set_value(self.defaults['gerber_plot_line'])
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['gerber_plot_fill'])[:7])
|
|
||||||
|
|
||||||
self.ui.gerber_defaults_form.gerber_gen_group.gerber_alpha_entry.set_value(
|
self.ui.gerber_defaults_form.gerber_gen_group.gerber_alpha_entry.set_value(
|
||||||
int(self.defaults['gerber_plot_fill'][7:9], 16)) # alpha
|
int(self.defaults['gerber_plot_fill'][7:9], 16)) # alpha
|
||||||
|
|
||||||
self.ui.gerber_defaults_form.gerber_gen_group.pl_color_entry.set_value(self.defaults['gerber_plot_line'])
|
|
||||||
self.ui.gerber_defaults_form.gerber_gen_group.pl_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['gerber_plot_line'])[:7])
|
|
||||||
|
|
||||||
# Init Excellon Plot Colors
|
# Init Excellon Plot Colors
|
||||||
self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry.set_value(
|
self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry.set_value(
|
||||||
self.defaults['excellon_plot_fill'])
|
self.defaults['excellon_plot_fill'])
|
||||||
self.ui.excellon_defaults_form.excellon_gen_group.fill_color_button.setStyleSheet(
|
self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry.set_value(
|
||||||
"background-color:%s;"
|
self.defaults['excellon_plot_line'])
|
||||||
"border-color: dimgray" % str(self.defaults['excellon_plot_fill'])[:7])
|
|
||||||
|
|
||||||
self.ui.excellon_defaults_form.excellon_gen_group.excellon_alpha_entry.set_value(
|
self.ui.excellon_defaults_form.excellon_gen_group.excellon_alpha_entry.set_value(
|
||||||
int(self.defaults['excellon_plot_fill'][7:9], 16))
|
int(self.defaults['excellon_plot_fill'][7:9], 16))
|
||||||
|
|
||||||
self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry.set_value(
|
|
||||||
self.defaults['excellon_plot_line'])
|
|
||||||
self.ui.excellon_defaults_form.excellon_gen_group.line_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['excellon_plot_line'])[:7])
|
|
||||||
|
|
||||||
# Init Geometry Plot Colors
|
# Init Geometry Plot Colors
|
||||||
self.ui.geometry_defaults_form.geometry_gen_group.line_color_entry.set_value(
|
self.ui.geometry_defaults_form.geometry_gen_group.line_color_entry.set_value(
|
||||||
self.defaults['geometry_plot_line'])
|
self.defaults['geometry_plot_line'])
|
||||||
self.ui.geometry_defaults_form.geometry_gen_group.line_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['geometry_plot_line'])[:7])
|
|
||||||
|
|
||||||
# Init CNCJob Travel Line Colors
|
# Init CNCJob Travel Line Colors
|
||||||
self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_entry.set_value(
|
self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_entry.set_value(
|
||||||
self.defaults['cncjob_travel_fill'])
|
self.defaults['cncjob_travel_fill'])
|
||||||
self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_button.setStyleSheet(
|
self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_entry.set_value(
|
||||||
"background-color:%s;"
|
self.defaults['cncjob_travel_line'])
|
||||||
"border-color: dimgray" % str(self.defaults['cncjob_travel_fill'])[:7])
|
|
||||||
|
|
||||||
self.ui.cncjob_defaults_form.cncjob_gen_group.cncjob_alpha_entry.set_value(
|
self.ui.cncjob_defaults_form.cncjob_gen_group.cncjob_alpha_entry.set_value(
|
||||||
int(self.defaults['cncjob_travel_fill'][7:9], 16)) # alpha
|
int(self.defaults['cncjob_travel_fill'][7:9], 16)) # alpha
|
||||||
|
|
||||||
self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_entry.set_value(
|
|
||||||
self.defaults['cncjob_travel_line'])
|
|
||||||
self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['cncjob_travel_line'])[:7])
|
|
||||||
|
|
||||||
# Init CNCJob Plot Colors
|
# Init CNCJob Plot Colors
|
||||||
self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_entry.set_value(
|
self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_entry.set_value(
|
||||||
self.defaults['cncjob_plot_fill'])
|
self.defaults['cncjob_plot_fill'])
|
||||||
self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['cncjob_plot_fill'])[:7])
|
|
||||||
|
|
||||||
self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_entry.set_value(
|
self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_entry.set_value(
|
||||||
self.defaults['cncjob_plot_line'])
|
self.defaults['cncjob_plot_line'])
|
||||||
self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['cncjob_plot_line'])[:7])
|
|
||||||
|
|
||||||
# Init Left-Right Selection colors
|
# Init Left-Right Selection colors
|
||||||
self.ui.general_defaults_form.general_gui_group.sf_color_entry.set_value(self.defaults['global_sel_fill'])
|
self.ui.general_defaults_form.general_gui_group.sf_color_entry.set_value(self.defaults['global_sel_fill'])
|
||||||
self.ui.general_defaults_form.general_gui_group.sf_color_button.setStyleSheet(
|
self.ui.general_defaults_form.general_gui_group.sl_color_entry.set_value(self.defaults['global_sel_line'])
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['global_sel_fill'])[:7])
|
|
||||||
|
|
||||||
self.ui.general_defaults_form.general_gui_group.left_right_alpha_entry.set_value(
|
self.ui.general_defaults_form.general_gui_group.left_right_alpha_entry.set_value(
|
||||||
int(self.defaults['global_sel_fill'][7:9], 16))
|
int(self.defaults['global_sel_fill'][7:9], 16))
|
||||||
|
|
||||||
self.ui.general_defaults_form.general_gui_group.sl_color_entry.set_value(self.defaults['global_sel_line'])
|
|
||||||
self.ui.general_defaults_form.general_gui_group.sl_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['global_sel_line'])[:7])
|
|
||||||
|
|
||||||
# Init Right-Left Selection colors
|
# Init Right-Left Selection colors
|
||||||
self.ui.general_defaults_form.general_gui_group.alt_sf_color_entry.set_value(
|
self.ui.general_defaults_form.general_gui_group.alt_sf_color_entry.set_value(
|
||||||
self.defaults['global_alt_sel_fill'])
|
self.defaults['global_alt_sel_fill'])
|
||||||
self.ui.general_defaults_form.general_gui_group.alt_sf_color_button.setStyleSheet(
|
self.ui.general_defaults_form.general_gui_group.alt_sl_color_entry.set_value(
|
||||||
"background-color:%s;"
|
self.defaults['global_alt_sel_line'])
|
||||||
"border-color: dimgray" % str(self.defaults['global_alt_sel_fill'])[:7])
|
|
||||||
|
|
||||||
self.ui.general_defaults_form.general_gui_group.right_left_alpha_entry.set_value(
|
self.ui.general_defaults_form.general_gui_group.right_left_alpha_entry.set_value(
|
||||||
int(self.defaults['global_sel_fill'][7:9], 16))
|
int(self.defaults['global_sel_fill'][7:9], 16))
|
||||||
|
|
||||||
self.ui.general_defaults_form.general_gui_group.alt_sl_color_entry.set_value(
|
|
||||||
self.defaults['global_alt_sel_line'])
|
|
||||||
self.ui.general_defaults_form.general_gui_group.alt_sl_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['global_alt_sel_line'])[:7])
|
|
||||||
|
|
||||||
# Init Draw color and Selection Draw Color
|
# Init Draw color and Selection Draw Color
|
||||||
self.ui.general_defaults_form.general_gui_group.draw_color_entry.set_value(
|
self.ui.general_defaults_form.general_gui_group.draw_color_entry.set_value(
|
||||||
self.defaults['global_draw_color'])
|
self.defaults['global_draw_color'])
|
||||||
self.ui.general_defaults_form.general_gui_group.draw_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['global_draw_color'])[:7])
|
|
||||||
|
|
||||||
self.ui.general_defaults_form.general_gui_group.sel_draw_color_entry.set_value(
|
self.ui.general_defaults_form.general_gui_group.sel_draw_color_entry.set_value(
|
||||||
self.defaults['global_sel_draw_color'])
|
self.defaults['global_sel_draw_color'])
|
||||||
self.ui.general_defaults_form.general_gui_group.sel_draw_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['global_sel_draw_color'])[:7])
|
|
||||||
|
|
||||||
# Init Project Items color
|
# Init Project Items color
|
||||||
self.ui.general_defaults_form.general_gui_group.proj_color_entry.set_value(
|
self.ui.general_defaults_form.general_gui_group.proj_color_entry.set_value(
|
||||||
self.defaults['global_proj_item_color'])
|
self.defaults['global_proj_item_color'])
|
||||||
self.ui.general_defaults_form.general_gui_group.proj_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['global_proj_item_color'])[:7])
|
|
||||||
|
|
||||||
# Init Project Disabled Items color
|
# Init Project Disabled Items color
|
||||||
self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry.set_value(
|
self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry.set_value(
|
||||||
self.defaults['global_proj_item_dis_color'])
|
self.defaults['global_proj_item_dis_color'])
|
||||||
self.ui.general_defaults_form.general_gui_group.proj_color_dis_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['global_proj_item_dis_color'])[:7])
|
|
||||||
|
|
||||||
# Init Project Disabled Items color
|
# Init Mouse Cursor color
|
||||||
self.ui.general_defaults_form.general_app_set_group.mouse_cursor_entry.set_value(
|
self.ui.general_defaults_form.general_app_set_group.mouse_cursor_entry.set_value(
|
||||||
self.defaults['global_cursor_color'])
|
self.defaults['global_cursor_color'])
|
||||||
self.ui.general_defaults_form.general_app_set_group.mouse_cursor_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['global_cursor_color'])[:7])
|
|
||||||
|
|
||||||
# Init the Annotation CNC Job color
|
# Init the Annotation CNC Job color
|
||||||
self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry.set_value(
|
self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry.set_value(
|
||||||
self.defaults['cncjob_annotation_fontcolor'])
|
self.defaults['cncjob_annotation_fontcolor'])
|
||||||
self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['cncjob_annotation_fontcolor'])[:7])
|
|
||||||
|
|
||||||
# Init the Tool Film color
|
# Init the Tool Film color
|
||||||
self.ui.tools_defaults_form.tools_film_group.film_color_entry.set_value(
|
self.ui.tools_defaults_form.tools_film_group.film_color_entry.set_value(
|
||||||
self.defaults['tools_film_color'])
|
self.defaults['tools_film_color'])
|
||||||
self.ui.tools_defaults_form.tools_film_group.film_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['tools_film_color'])[:7]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Init the Tool QRCode colors
|
# Init the Tool QRCode colors
|
||||||
self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry.set_value(
|
self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry.set_value(
|
||||||
self.defaults['tools_qrcode_fill_color'])
|
self.defaults['tools_qrcode_fill_color'])
|
||||||
self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['tools_qrcode_fill_color'])[:7])
|
|
||||||
|
|
||||||
self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry.set_value(
|
self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry.set_value(
|
||||||
self.defaults['tools_qrcode_back_color'])
|
self.defaults['tools_qrcode_back_color'])
|
||||||
self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['tools_qrcode_back_color'])[:7])
|
|
||||||
|
|
||||||
def on_save_button(self, save_to_file=True):
|
def on_save_button(self, save_to_file=True):
|
||||||
log.debug("on_save_button() --> Applying preferences to file.")
|
log.debug("on_save_button() --> Applying preferences to file.")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from PyQt5 import QtWidgets, QtGui, QtCore
|
from PyQt5 import QtWidgets, QtGui
|
||||||
from PyQt5.QtCore import QSettings, Qt
|
from PyQt5.QtCore import QSettings, Qt
|
||||||
|
|
||||||
from AppGUI.GUIElements import FCTextArea, FCCheckBox, FCComboBox, FCSpinner, FCEntry
|
from AppGUI.GUIElements import FCTextArea, FCCheckBox, FCComboBox, FCSpinner, FCColorEntry
|
||||||
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||||
import gettext
|
import gettext
|
||||||
import AppTranslation as fcTranslate
|
import AppTranslation as fcTranslate
|
||||||
|
@ -158,28 +158,16 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
|
||||||
self.annotation_color_label.setToolTip(
|
self.annotation_color_label.setToolTip(
|
||||||
_("Set the font color for the annotation texts.")
|
_("Set the font color for the annotation texts.")
|
||||||
)
|
)
|
||||||
self.annotation_fontcolor_entry = FCEntry()
|
self.annotation_fontcolor_entry = FCColorEntry()
|
||||||
self.annotation_fontcolor_button = QtWidgets.QPushButton()
|
|
||||||
self.annotation_fontcolor_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child.setContentsMargins(0, 0, 0, 0)
|
|
||||||
self.form_box_child.addWidget(self.annotation_fontcolor_entry)
|
|
||||||
self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight)
|
|
||||||
self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
color_widget = QtWidgets.QWidget()
|
|
||||||
color_widget.setLayout(self.form_box_child)
|
|
||||||
grid0.addWidget(self.annotation_color_label, 3, 0)
|
grid0.addWidget(self.annotation_color_label, 3, 0)
|
||||||
grid0.addWidget(color_widget, 3, 1)
|
grid0.addWidget(self.annotation_fontcolor_entry, 3, 1)
|
||||||
grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
|
|
||||||
|
|
||||||
|
grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
|
||||||
self.layout.addStretch()
|
self.layout.addStretch()
|
||||||
|
|
||||||
self.tc_variable_combo.currentIndexChanged[str].connect(self.on_cnc_custom_parameters)
|
self.tc_variable_combo.currentIndexChanged[str].connect(self.on_cnc_custom_parameters)
|
||||||
|
|
||||||
self.annotation_fontcolor_entry.editingFinished.connect(self.on_annotation_fontcolor_entry)
|
self.annotation_fontcolor_entry.editingFinished.connect(self.on_annotation_fontcolor_entry)
|
||||||
self.annotation_fontcolor_button.clicked.connect(self.on_annotation_fontcolor_button)
|
|
||||||
|
|
||||||
def on_cnc_custom_parameters(self, signal_text):
|
def on_cnc_custom_parameters(self, signal_text):
|
||||||
if signal_text == 'Parameters':
|
if signal_text == 'Parameters':
|
||||||
|
@ -189,20 +177,3 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
|
||||||
|
|
||||||
def on_annotation_fontcolor_entry(self):
|
def on_annotation_fontcolor_entry(self):
|
||||||
self.app.defaults['cncjob_annotation_fontcolor'] = self.annotation_fontcolor_entry.get_value()
|
self.app.defaults['cncjob_annotation_fontcolor'] = self.annotation_fontcolor_entry.get_value()
|
||||||
self.annotation_fontcolor_button.setStyleSheet(
|
|
||||||
"background-color:%s" % str(self.app.defaults['cncjob_annotation_fontcolor']))
|
|
||||||
|
|
||||||
def on_annotation_fontcolor_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['cncjob_annotation_fontcolor'])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
annotation_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if annotation_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.annotation_fontcolor_button.setStyleSheet("background-color:%s" % str(annotation_color.name()))
|
|
||||||
|
|
||||||
new_val_sel = str(annotation_color.name())
|
|
||||||
self.annotation_fontcolor_entry.set_value(new_val_sel)
|
|
||||||
self.app.defaults['cncjob_annotation_fontcolor'] = new_val_sel
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||||
from PyQt5.QtCore import QSettings
|
from PyQt5.QtCore import QSettings
|
||||||
|
|
||||||
from AppGUI.GUIElements import FCCheckBox, RadioSet, FCSpinner, FCDoubleSpinner, FCEntry, FCSliderWithSpinner
|
from AppGUI.GUIElements import FCCheckBox, RadioSet, FCSpinner, FCDoubleSpinner, FCSliderWithSpinner, FCColorEntry
|
||||||
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||||
import gettext
|
import gettext
|
||||||
import AppTranslation as fcTranslate
|
import AppTranslation as fcTranslate
|
||||||
|
@ -170,17 +170,10 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
|
||||||
self.tline_color_label.setToolTip(
|
self.tline_color_label.setToolTip(
|
||||||
_("Set the travel line color for plotted objects.")
|
_("Set the travel line color for plotted objects.")
|
||||||
)
|
)
|
||||||
self.tline_color_entry = FCEntry()
|
self.tline_color_entry = FCColorEntry()
|
||||||
self.tline_color_button = QtWidgets.QPushButton()
|
|
||||||
self.tline_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_2 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_2.addWidget(self.tline_color_entry)
|
|
||||||
self.form_box_child_2.addWidget(self.tline_color_button)
|
|
||||||
self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.tline_color_label, 14, 0)
|
grid0.addWidget(self.tline_color_label, 14, 0)
|
||||||
grid0.addLayout(self.form_box_child_2, 14, 1)
|
grid0.addWidget(self.tline_color_entry, 14, 1)
|
||||||
|
|
||||||
# Plot Fill Color
|
# Plot Fill Color
|
||||||
self.tfill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
self.tfill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
||||||
|
@ -189,17 +182,10 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
|
||||||
"First 6 digits are the color and the last 2\n"
|
"First 6 digits are the color and the last 2\n"
|
||||||
"digits are for alpha (transparency) level.")
|
"digits are for alpha (transparency) level.")
|
||||||
)
|
)
|
||||||
self.tfill_color_entry = FCEntry()
|
self.tfill_color_entry = FCColorEntry()
|
||||||
self.tfill_color_button = QtWidgets.QPushButton()
|
|
||||||
self.tfill_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_1 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_1.addWidget(self.tfill_color_entry)
|
|
||||||
self.form_box_child_1.addWidget(self.tfill_color_button)
|
|
||||||
self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.tfill_color_label, 15, 0)
|
grid0.addWidget(self.tfill_color_label, 15, 0)
|
||||||
grid0.addLayout(self.form_box_child_1, 15, 1)
|
grid0.addWidget(self.tfill_color_entry, 15, 1)
|
||||||
|
|
||||||
# Plot Fill Transparency Level
|
# Plot Fill Transparency Level
|
||||||
self.cncjob_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
self.cncjob_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
||||||
|
@ -217,7 +203,7 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
|
||||||
grid0.addWidget(separator_line, 17, 0, 1, 2)
|
grid0.addWidget(separator_line, 17, 0, 1, 2)
|
||||||
|
|
||||||
# CNCJob Object Color
|
# CNCJob Object Color
|
||||||
self.cnc_color_label = QtWidgets.QLabel('<b>%s</b>' % _('CNCJob Object Color'))
|
self.cnc_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Object Color'))
|
||||||
grid0.addWidget(self.cnc_color_label, 18, 0, 1, 2)
|
grid0.addWidget(self.cnc_color_label, 18, 0, 1, 2)
|
||||||
|
|
||||||
# Plot Line Color
|
# Plot Line Color
|
||||||
|
@ -225,17 +211,10 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
|
||||||
self.line_color_label.setToolTip(
|
self.line_color_label.setToolTip(
|
||||||
_("Set the color for plotted objects.")
|
_("Set the color for plotted objects.")
|
||||||
)
|
)
|
||||||
self.line_color_entry = FCEntry()
|
self.line_color_entry = FCColorEntry()
|
||||||
self.line_color_button = QtWidgets.QPushButton()
|
|
||||||
self.line_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_2 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_2.addWidget(self.line_color_entry)
|
|
||||||
self.form_box_child_2.addWidget(self.line_color_button)
|
|
||||||
self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.line_color_label, 19, 0)
|
grid0.addWidget(self.line_color_label, 19, 0)
|
||||||
grid0.addLayout(self.form_box_child_2, 19, 1)
|
grid0.addWidget(self.line_color_entry, 19, 1)
|
||||||
|
|
||||||
# Plot Fill Color
|
# Plot Fill Color
|
||||||
self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
||||||
|
@ -244,32 +223,21 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
|
||||||
"First 6 digits are the color and the last 2\n"
|
"First 6 digits are the color and the last 2\n"
|
||||||
"digits are for alpha (transparency) level.")
|
"digits are for alpha (transparency) level.")
|
||||||
)
|
)
|
||||||
self.fill_color_entry = FCEntry()
|
self.fill_color_entry = FCColorEntry()
|
||||||
self.fill_color_button = QtWidgets.QPushButton()
|
|
||||||
self.fill_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_1 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_1.addWidget(self.fill_color_entry)
|
|
||||||
self.form_box_child_1.addWidget(self.fill_color_button)
|
|
||||||
self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.fill_color_label, 20, 0)
|
grid0.addWidget(self.fill_color_label, 20, 0)
|
||||||
grid0.addLayout(self.form_box_child_1, 20, 1)
|
grid0.addWidget(self.fill_color_entry, 20, 1)
|
||||||
|
|
||||||
self.layout.addStretch()
|
self.layout.addStretch()
|
||||||
|
|
||||||
# Setting plot colors signals
|
# Setting plot colors signals
|
||||||
self.tline_color_entry.editingFinished.connect(self.on_tline_color_entry)
|
self.tline_color_entry.editingFinished.connect(self.on_tline_color_entry)
|
||||||
self.tline_color_button.clicked.connect(self.on_tline_color_button)
|
|
||||||
self.tfill_color_entry.editingFinished.connect(self.on_tfill_color_entry)
|
self.tfill_color_entry.editingFinished.connect(self.on_tfill_color_entry)
|
||||||
self.tfill_color_button.clicked.connect(self.on_tfill_color_button)
|
|
||||||
|
|
||||||
self.cncjob_alpha_entry.valueChanged.connect(self.on_cncjob_alpha_changed) # alpha
|
self.cncjob_alpha_entry.valueChanged.connect(self.on_cncjob_alpha_changed) # alpha
|
||||||
|
|
||||||
self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
|
self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
|
||||||
self.line_color_button.clicked.connect(self.on_line_color_button)
|
|
||||||
self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
|
self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
|
||||||
self.fill_color_button.clicked.connect(self.on_fill_color_button)
|
|
||||||
|
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
# Setting travel colors handlers
|
# Setting travel colors handlers
|
||||||
|
@ -277,23 +245,10 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
|
||||||
def on_tfill_color_entry(self):
|
def on_tfill_color_entry(self):
|
||||||
self.app.defaults['cncjob_travel_fill'] = self.tfill_color_entry.get_value()[:7] + \
|
self.app.defaults['cncjob_travel_fill'] = self.tfill_color_entry.get_value()[:7] + \
|
||||||
self.app.defaults['cncjob_travel_fill'][7:9]
|
self.app.defaults['cncjob_travel_fill'][7:9]
|
||||||
self.tfill_color_button.setStyleSheet(
|
|
||||||
"background-color:%s" % str(self.app.defaults['cncjob_travel_fill'])[:7])
|
|
||||||
|
|
||||||
def on_tfill_color_button(self):
|
def on_tline_color_entry(self):
|
||||||
current_color = QtGui.QColor(self.app.defaults['cncjob_travel_fill'][:7])
|
self.app.defaults['cncjob_travel_line'] = self.tline_color_entry.get_value()[:7] + \
|
||||||
|
self.app.defaults['cncjob_travel_line'][7:9]
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_fill_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_fill_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.tfill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
|
|
||||||
|
|
||||||
new_val = str(plot_fill_color.name()) + str(self.app.defaults['cncjob_travel_fill'][7:9])
|
|
||||||
self.tfill_color_entry.set_value(new_val)
|
|
||||||
self.app.defaults['cncjob_travel_fill'] = new_val
|
|
||||||
|
|
||||||
def on_cncjob_alpha_changed(self, spinner_value):
|
def on_cncjob_alpha_changed(self, spinner_value):
|
||||||
self.app.defaults['cncjob_travel_fill'] = \
|
self.app.defaults['cncjob_travel_fill'] = \
|
||||||
|
@ -303,70 +258,13 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
|
||||||
self.app.defaults['cncjob_travel_line'][:7] + \
|
self.app.defaults['cncjob_travel_line'][:7] + \
|
||||||
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
||||||
|
|
||||||
def on_tline_color_entry(self):
|
|
||||||
self.app.defaults['cncjob_travel_line'] = self.tline_color_entry.get_value()[:7] + \
|
|
||||||
self.app.defaults['cncjob_travel_line'][7:9]
|
|
||||||
self.tline_color_button.setStyleSheet(
|
|
||||||
"background-color:%s" % str(self.app.defaults['cncjob_travel_line'])[:7])
|
|
||||||
|
|
||||||
def on_tline_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['cncjob_travel_line'][:7])
|
|
||||||
# print(current_color)
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_line_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_line_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.tline_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
|
|
||||||
|
|
||||||
new_val_line = str(plot_line_color.name()) + str(self.app.defaults['cncjob_travel_line'][7:9])
|
|
||||||
self.tline_color_entry.set_value(new_val_line)
|
|
||||||
self.app.defaults['cncjob_travel_line'] = new_val_line
|
|
||||||
|
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
# Setting plot colors handlers
|
# Setting plot colors handlers
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
def on_fill_color_entry(self):
|
def on_fill_color_entry(self):
|
||||||
self.app.defaults['cncjob_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
|
self.app.defaults['cncjob_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
|
||||||
self.app.defaults['cncjob_plot_fill'][7:9]
|
self.app.defaults['cncjob_plot_fill'][7:9]
|
||||||
self.fill_color_button.setStyleSheet(
|
|
||||||
"background-color:%s" % str(self.app.defaults['cncjob_plot_fill'])[:7])
|
|
||||||
|
|
||||||
def on_fill_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['cncjob_plot_fill'][:7])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_fill_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_fill_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
|
|
||||||
|
|
||||||
new_val = str(plot_fill_color.name()) + str(self.app.defaults['cncjob_plot_fill'][7:9])
|
|
||||||
self.fill_color_entry.set_value(new_val)
|
|
||||||
self.app.defaults['cncjob_plot_fill'] = new_val
|
|
||||||
|
|
||||||
def on_line_color_entry(self):
|
def on_line_color_entry(self):
|
||||||
self.app.defaults['cncjob_plot_line'] = self.line_color_entry.get_value()[:7] + \
|
self.app.defaults['cncjob_plot_line'] = self.line_color_entry.get_value()[:7] + \
|
||||||
self.app.defaults['cncjob_plot_line'][7:9]
|
self.app.defaults['cncjob_plot_line'][7:9]
|
||||||
self.line_color_button.setStyleSheet(
|
|
||||||
"background-color:%s" % str(self.app.defaults['cncjob_plot_line'])[:7])
|
|
||||||
|
|
||||||
def on_line_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['cncjob_plot_line'][:7])
|
|
||||||
# print(current_color)
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_line_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_line_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
|
|
||||||
|
|
||||||
new_val_line = str(plot_line_color.name()) + str(self.app.defaults['cncjob_plot_line'][7:9])
|
|
||||||
self.line_color_entry.set_value(new_val_line)
|
|
||||||
self.app.defaults['cncjob_plot_line'] = new_val_line
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import platform
|
||||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||||
from PyQt5.QtCore import QSettings
|
from PyQt5.QtCore import QSettings
|
||||||
|
|
||||||
from AppGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCEntry, FCSliderWithSpinner
|
from AppGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCEntry, FCSliderWithSpinner, FCColorEntry
|
||||||
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||||
import gettext
|
import gettext
|
||||||
import AppTranslation as fcTranslate
|
import AppTranslation as fcTranslate
|
||||||
|
@ -264,7 +264,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
|
||||||
grid2.addWidget(separator_line, 11, 0, 1, 2)
|
grid2.addWidget(separator_line, 11, 0, 1, 2)
|
||||||
|
|
||||||
# Excellon Object Color
|
# Excellon Object Color
|
||||||
self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Excellon Object Color'))
|
self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Object Color'))
|
||||||
grid2.addWidget(self.gerber_color_label, 12, 0, 1, 2)
|
grid2.addWidget(self.gerber_color_label, 12, 0, 1, 2)
|
||||||
|
|
||||||
# Plot Line Color
|
# Plot Line Color
|
||||||
|
@ -272,17 +272,10 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
|
||||||
self.line_color_label.setToolTip(
|
self.line_color_label.setToolTip(
|
||||||
_("Set the line color for plotted objects.")
|
_("Set the line color for plotted objects.")
|
||||||
)
|
)
|
||||||
self.line_color_entry = FCEntry()
|
self.line_color_entry = FCColorEntry()
|
||||||
self.line_color_button = QtWidgets.QPushButton()
|
|
||||||
self.line_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_2 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_2.addWidget(self.line_color_entry)
|
|
||||||
self.form_box_child_2.addWidget(self.line_color_button)
|
|
||||||
self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid2.addWidget(self.line_color_label, 13, 0)
|
grid2.addWidget(self.line_color_label, 13, 0)
|
||||||
grid2.addLayout(self.form_box_child_2, 13, 1)
|
grid2.addWidget(self.line_color_entry, 13, 1)
|
||||||
|
|
||||||
# Plot Fill Color
|
# Plot Fill Color
|
||||||
self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
||||||
|
@ -291,17 +284,10 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
|
||||||
"First 6 digits are the color and the last 2\n"
|
"First 6 digits are the color and the last 2\n"
|
||||||
"digits are for alpha (transparency) level.")
|
"digits are for alpha (transparency) level.")
|
||||||
)
|
)
|
||||||
self.fill_color_entry = FCEntry()
|
self.fill_color_entry = FCColorEntry()
|
||||||
self.fill_color_button = QtWidgets.QPushButton()
|
|
||||||
self.fill_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_1 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_1.addWidget(self.fill_color_entry)
|
|
||||||
self.form_box_child_1.addWidget(self.fill_color_button)
|
|
||||||
self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid2.addWidget(self.fill_color_label, 14, 0)
|
grid2.addWidget(self.fill_color_label, 14, 0)
|
||||||
grid2.addLayout(self.form_box_child_1, 14, 1)
|
grid2.addWidget(self.fill_color_entry, 14, 1)
|
||||||
|
|
||||||
# Plot Fill Transparency Level
|
# Plot Fill Transparency Level
|
||||||
self.excellon_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
self.excellon_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
||||||
|
@ -331,9 +317,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
|
||||||
|
|
||||||
# Setting plot colors signals
|
# Setting plot colors signals
|
||||||
self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
|
self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
|
||||||
self.line_color_button.clicked.connect(self.on_line_color_button)
|
|
||||||
self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
|
self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
|
||||||
self.fill_color_button.clicked.connect(self.on_fill_color_button)
|
|
||||||
|
|
||||||
self.excellon_alpha_entry.valueChanged.connect(self.on_excellon_alpha_changed) # alpha
|
self.excellon_alpha_entry.valueChanged.connect(self.on_excellon_alpha_changed) # alpha
|
||||||
|
|
||||||
|
@ -358,22 +342,10 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
|
||||||
def on_fill_color_entry(self):
|
def on_fill_color_entry(self):
|
||||||
self.app.defaults['excellon_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
|
self.app.defaults['excellon_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
|
||||||
self.app.defaults['excellon_plot_fill'][7:9]
|
self.app.defaults['excellon_plot_fill'][7:9]
|
||||||
self.fill_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_fill'])[:7])
|
|
||||||
|
|
||||||
def on_fill_color_button(self):
|
def on_line_color_entry(self):
|
||||||
current_color = QtGui.QColor(self.app.defaults['excellon_plot_fill'][:7])
|
self.app.defaults['excellon_plot_line'] = self.line_color_entry.get_value()[:7] + \
|
||||||
|
self.app.defaults['excellon_plot_line'][7:9]
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_fill_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_fill_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
|
|
||||||
|
|
||||||
new_val = str(plot_fill_color.name()) + str(self.app.defaults['excellon_plot_fill'][7:9])
|
|
||||||
self.fill_color_entry.set_value(new_val)
|
|
||||||
self.app.defaults['excellon_plot_fill'] = new_val
|
|
||||||
|
|
||||||
def on_excellon_alpha_changed(self, spinner_value):
|
def on_excellon_alpha_changed(self, spinner_value):
|
||||||
self.app.defaults['excellon_plot_fill'] = \
|
self.app.defaults['excellon_plot_fill'] = \
|
||||||
|
@ -383,27 +355,6 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
|
||||||
self.app.defaults['excellon_plot_line'][:7] + \
|
self.app.defaults['excellon_plot_line'][:7] + \
|
||||||
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
||||||
|
|
||||||
def on_line_color_entry(self):
|
|
||||||
self.app.defaults['excellon_plot_line'] = self.line_color_entry.get_value()[:7] + \
|
|
||||||
self.app.defaults['excellon_plot_line'][7:9]
|
|
||||||
self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_line'])[:7])
|
|
||||||
|
|
||||||
def on_line_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['excellon_plot_line'][:7])
|
|
||||||
# print(current_color)
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_line_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_line_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
|
|
||||||
|
|
||||||
new_val_line = str(plot_line_color.name()) + str(self.app.defaults['excellon_plot_line'][7:9])
|
|
||||||
self.line_color_entry.set_value(new_val_line)
|
|
||||||
self.app.defaults['excellon_plot_line'] = new_val_line
|
|
||||||
|
|
||||||
def on_excellon_defaults_button(self):
|
def on_excellon_defaults_button(self):
|
||||||
self.app.preferencesUiManager.defaults_form_fields["excellon_format_lower_in"].set_value('4')
|
self.app.preferencesUiManager.defaults_form_fields["excellon_format_lower_in"].set_value('4')
|
||||||
self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_in"].set_value('2')
|
self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_in"].set_value('2')
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
from PyQt5 import QtCore, QtWidgets
|
||||||
from PyQt5.QtCore import QSettings
|
from PyQt5.QtCore import QSettings
|
||||||
|
|
||||||
from AppGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCComboBox, RadioSet, OptionalInputSection, FCSpinner, \
|
from AppGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCComboBox, RadioSet, OptionalInputSection, FCSpinner, \
|
||||||
FCEntry
|
FCColorEntry
|
||||||
from AppGUI.preferences import settings
|
from AppGUI.preferences import settings
|
||||||
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||||
|
|
||||||
|
@ -334,24 +334,16 @@ class GeneralAPPSetGroupUI(OptionsGroupUI):
|
||||||
self.mouse_color_label.setToolTip(
|
self.mouse_color_label.setToolTip(
|
||||||
_("Set the color of the mouse cursor.")
|
_("Set the color of the mouse cursor.")
|
||||||
)
|
)
|
||||||
self.mouse_cursor_entry = FCEntry()
|
self.mouse_cursor_entry = FCColorEntry()
|
||||||
self.mouse_cursor_button = QtWidgets.QPushButton()
|
|
||||||
self.mouse_cursor_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_1 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_1.addWidget(self.mouse_cursor_entry)
|
|
||||||
self.form_box_child_1.addWidget(self.mouse_cursor_button)
|
|
||||||
self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.mouse_color_label, 26, 0)
|
grid0.addWidget(self.mouse_color_label, 26, 0)
|
||||||
grid0.addLayout(self.form_box_child_1, 26, 1)
|
grid0.addWidget(self.mouse_cursor_entry, 26, 1)
|
||||||
|
|
||||||
self.mois = OptionalInputSection(
|
self.mois = OptionalInputSection(
|
||||||
self.mouse_cursor_color_cb,
|
self.mouse_cursor_color_cb,
|
||||||
[
|
[
|
||||||
self.mouse_color_label,
|
self.mouse_color_label,
|
||||||
self.mouse_cursor_entry,
|
self.mouse_cursor_entry
|
||||||
self.mouse_cursor_button
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
# Select mouse pan button
|
# Select mouse pan button
|
||||||
|
@ -451,9 +443,7 @@ class GeneralAPPSetGroupUI(OptionsGroupUI):
|
||||||
self.layout.addStretch()
|
self.layout.addStretch()
|
||||||
|
|
||||||
self.mouse_cursor_color_cb.stateChanged.connect(self.on_mouse_cursor_color_enable)
|
self.mouse_cursor_color_cb.stateChanged.connect(self.on_mouse_cursor_color_enable)
|
||||||
|
|
||||||
self.mouse_cursor_entry.editingFinished.connect(self.on_mouse_cursor_entry)
|
self.mouse_cursor_entry.editingFinished.connect(self.on_mouse_cursor_entry)
|
||||||
self.mouse_cursor_button.clicked.connect(self.on_mouse_cursor_button)
|
|
||||||
|
|
||||||
def on_mouse_cursor_color_enable(self, val):
|
def on_mouse_cursor_color_enable(self, val):
|
||||||
if val:
|
if val:
|
||||||
|
@ -472,23 +462,4 @@ class GeneralAPPSetGroupUI(OptionsGroupUI):
|
||||||
|
|
||||||
def on_mouse_cursor_entry(self):
|
def on_mouse_cursor_entry(self):
|
||||||
self.app.defaults['global_cursor_color'] = self.mouse_cursor_entry.get_value()
|
self.app.defaults['global_cursor_color'] = self.mouse_cursor_entry.get_value()
|
||||||
self.mouse_cursor_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_cursor_color']))
|
|
||||||
|
|
||||||
self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
|
|
||||||
|
|
||||||
def on_mouse_cursor_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['global_cursor_color'])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
proj_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if proj_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.mouse_cursor_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
|
|
||||||
|
|
||||||
new_val_sel = str(proj_color.name())
|
|
||||||
self.mouse_cursor_entry.set_value(new_val_sel)
|
|
||||||
self.app.defaults['global_cursor_color'] = new_val_sel
|
|
||||||
|
|
||||||
self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
|
self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||||
from PyQt5.QtCore import QSettings, Qt
|
from PyQt5.QtCore import QSettings, Qt
|
||||||
|
|
||||||
from AppGUI.GUIElements import RadioSet, FCCheckBox, FCComboBox, FCEntry, FCSpinner, FCSliderWithSpinner
|
from AppGUI.GUIElements import RadioSet, FCCheckBox, FCComboBox, FCSliderWithSpinner, FCColorEntry
|
||||||
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
|
@ -155,17 +155,10 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
self.sl_color_label.setToolTip(
|
self.sl_color_label.setToolTip(
|
||||||
_("Set the line color for the 'left to right' selection box.")
|
_("Set the line color for the 'left to right' selection box.")
|
||||||
)
|
)
|
||||||
self.sl_color_entry = FCEntry()
|
self.sl_color_entry = FCColorEntry()
|
||||||
self.sl_color_button = QtWidgets.QPushButton()
|
|
||||||
self.sl_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_4 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_4.addWidget(self.sl_color_entry)
|
|
||||||
self.form_box_child_4.addWidget(self.sl_color_button)
|
|
||||||
self.form_box_child_4.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.sl_color_label, 16, 0)
|
grid0.addWidget(self.sl_color_label, 16, 0)
|
||||||
grid0.addLayout(self.form_box_child_4, 16, 1)
|
grid0.addWidget(self.sl_color_entry, 16, 1)
|
||||||
|
|
||||||
self.sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
self.sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
||||||
self.sf_color_label.setToolTip(
|
self.sf_color_label.setToolTip(
|
||||||
|
@ -174,17 +167,10 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
"First 6 digits are the color and the last 2\n"
|
"First 6 digits are the color and the last 2\n"
|
||||||
"digits are for alpha (transparency) level.")
|
"digits are for alpha (transparency) level.")
|
||||||
)
|
)
|
||||||
self.sf_color_entry = FCEntry()
|
self.sf_color_entry = FCColorEntry()
|
||||||
self.sf_color_button = QtWidgets.QPushButton()
|
|
||||||
self.sf_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_5 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_5.addWidget(self.sf_color_entry)
|
|
||||||
self.form_box_child_5.addWidget(self.sf_color_button)
|
|
||||||
self.form_box_child_5.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.sf_color_label, 17, 0)
|
grid0.addWidget(self.sf_color_label, 17, 0)
|
||||||
grid0.addLayout(self.form_box_child_5, 17, 1)
|
grid0.addWidget(self.sf_color_entry, 17, 1)
|
||||||
|
|
||||||
# Plot Selection (left - right) Fill Transparency Level
|
# Plot Selection (left - right) Fill Transparency Level
|
||||||
self.left_right_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
self.left_right_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
||||||
|
@ -210,17 +196,10 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
self.alt_sl_color_label.setToolTip(
|
self.alt_sl_color_label.setToolTip(
|
||||||
_("Set the line color for the 'right to left' selection box.")
|
_("Set the line color for the 'right to left' selection box.")
|
||||||
)
|
)
|
||||||
self.alt_sl_color_entry = FCEntry()
|
self.alt_sl_color_entry = FCColorEntry()
|
||||||
self.alt_sl_color_button = QtWidgets.QPushButton()
|
|
||||||
self.alt_sl_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_7 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_7.addWidget(self.alt_sl_color_entry)
|
|
||||||
self.form_box_child_7.addWidget(self.alt_sl_color_button)
|
|
||||||
self.form_box_child_7.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.alt_sl_color_label, 21, 0)
|
grid0.addWidget(self.alt_sl_color_label, 21, 0)
|
||||||
grid0.addLayout(self.form_box_child_7, 21, 1)
|
grid0.addWidget(self.alt_sl_color_entry, 21, 1)
|
||||||
|
|
||||||
# Plot Selection (right - left) Fill Color
|
# Plot Selection (right - left) Fill Color
|
||||||
self.alt_sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
self.alt_sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
||||||
|
@ -230,24 +209,17 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
"First 6 digits are the color and the last 2\n"
|
"First 6 digits are the color and the last 2\n"
|
||||||
"digits are for alpha (transparency) level.")
|
"digits are for alpha (transparency) level.")
|
||||||
)
|
)
|
||||||
self.alt_sf_color_entry = FCEntry()
|
self.alt_sf_color_entry = FCColorEntry()
|
||||||
self.alt_sf_color_button = QtWidgets.QPushButton()
|
|
||||||
self.alt_sf_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_8 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_8.addWidget(self.alt_sf_color_entry)
|
|
||||||
self.form_box_child_8.addWidget(self.alt_sf_color_button)
|
|
||||||
self.form_box_child_8.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.alt_sf_color_label, 22, 0)
|
grid0.addWidget(self.alt_sf_color_label, 22, 0)
|
||||||
grid0.addLayout(self.form_box_child_8, 22, 1)
|
grid0.addWidget(self.alt_sf_color_entry, 22, 1)
|
||||||
|
|
||||||
# Plot Selection (right - left) Fill Transparency Level
|
# Plot Selection (right - left) Fill Transparency Level
|
||||||
self.right_left_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
self.right_left_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
||||||
self.right_left_alpha_label.setToolTip(
|
self.right_left_alpha_label.setToolTip(
|
||||||
_("Set the fill transparency for selection 'right to left' box.")
|
_("Set the fill transparency for selection 'right to left' box.")
|
||||||
)
|
)
|
||||||
self.right_left_alpha_entry = FCSliderWithSpinner(0 , 255, 1)
|
self.right_left_alpha_entry = FCSliderWithSpinner(0, 255, 1)
|
||||||
|
|
||||||
grid0.addWidget(self.right_left_alpha_label, 23, 0)
|
grid0.addWidget(self.right_left_alpha_label, 23, 0)
|
||||||
grid0.addWidget(self.right_left_alpha_entry, 23, 1)
|
grid0.addWidget(self.right_left_alpha_entry, 23, 1)
|
||||||
|
@ -269,34 +241,20 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
self.alt_sf_color_label.setToolTip(
|
self.alt_sf_color_label.setToolTip(
|
||||||
_("Set the color for the shape.")
|
_("Set the color for the shape.")
|
||||||
)
|
)
|
||||||
self.draw_color_entry = FCEntry()
|
self.draw_color_entry = FCColorEntry()
|
||||||
self.draw_color_button = QtWidgets.QPushButton()
|
|
||||||
self.draw_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_10 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_10.addWidget(self.draw_color_entry)
|
|
||||||
self.form_box_child_10.addWidget(self.draw_color_button)
|
|
||||||
self.form_box_child_10.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.draw_color_label, 26, 0)
|
grid0.addWidget(self.draw_color_label, 26, 0)
|
||||||
grid0.addLayout(self.form_box_child_10, 26, 1)
|
grid0.addWidget(self.draw_color_entry, 26, 1)
|
||||||
|
|
||||||
# Editor Draw Selection Color
|
# Editor Draw Selection Color
|
||||||
self.sel_draw_color_label = QtWidgets.QLabel('%s:' % _('Selection'))
|
self.sel_draw_color_label = QtWidgets.QLabel('%s:' % _('Selection'))
|
||||||
self.sel_draw_color_label.setToolTip(
|
self.sel_draw_color_label.setToolTip(
|
||||||
_("Set the color of the shape when selected.")
|
_("Set the color of the shape when selected.")
|
||||||
)
|
)
|
||||||
self.sel_draw_color_entry = FCEntry()
|
self.sel_draw_color_entry = FCColorEntry()
|
||||||
self.sel_draw_color_button = QtWidgets.QPushButton()
|
|
||||||
self.sel_draw_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_11 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_11.addWidget(self.sel_draw_color_entry)
|
|
||||||
self.form_box_child_11.addWidget(self.sel_draw_color_button)
|
|
||||||
self.form_box_child_11.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.sel_draw_color_label, 27, 0)
|
grid0.addWidget(self.sel_draw_color_label, 27, 0)
|
||||||
grid0.addLayout(self.form_box_child_11, 27, 1)
|
grid0.addWidget(self.sel_draw_color_entry, 27, 1)
|
||||||
|
|
||||||
separator_line = QtWidgets.QFrame()
|
separator_line = QtWidgets.QFrame()
|
||||||
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
@ -315,34 +273,20 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
self.proj_color_label.setToolTip(
|
self.proj_color_label.setToolTip(
|
||||||
_("Set the color of the items in Project Tab Tree.")
|
_("Set the color of the items in Project Tab Tree.")
|
||||||
)
|
)
|
||||||
self.proj_color_entry = FCEntry()
|
self.proj_color_entry = FCColorEntry()
|
||||||
self.proj_color_button = QtWidgets.QPushButton()
|
|
||||||
self.proj_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_12 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_12.addWidget(self.proj_color_entry)
|
|
||||||
self.form_box_child_12.addWidget(self.proj_color_button)
|
|
||||||
self.form_box_child_12.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.proj_color_label, 30, 0)
|
grid0.addWidget(self.proj_color_label, 30, 0)
|
||||||
grid0.addLayout(self.form_box_child_12, 30, 1)
|
grid0.addWidget(self.proj_color_entry, 30, 1)
|
||||||
|
|
||||||
self.proj_color_dis_label = QtWidgets.QLabel('%s:' % _('Disabled'))
|
self.proj_color_dis_label = QtWidgets.QLabel('%s:' % _('Disabled'))
|
||||||
self.proj_color_dis_label.setToolTip(
|
self.proj_color_dis_label.setToolTip(
|
||||||
_("Set the color of the items in Project Tab Tree,\n"
|
_("Set the color of the items in Project Tab Tree,\n"
|
||||||
"for the case when the items are disabled.")
|
"for the case when the items are disabled.")
|
||||||
)
|
)
|
||||||
self.proj_color_dis_entry = FCEntry()
|
self.proj_color_dis_entry = FCColorEntry()
|
||||||
self.proj_color_dis_button = QtWidgets.QPushButton()
|
|
||||||
self.proj_color_dis_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_13 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_13.addWidget(self.proj_color_dis_entry)
|
|
||||||
self.form_box_child_13.addWidget(self.proj_color_dis_button)
|
|
||||||
self.form_box_child_13.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.proj_color_dis_label, 31, 0)
|
grid0.addWidget(self.proj_color_dis_label, 31, 0)
|
||||||
grid0.addLayout(self.form_box_child_13, 31, 1)
|
grid0.addWidget(self.proj_color_dis_entry, 31, 1)
|
||||||
|
|
||||||
# Project autohide CB
|
# Project autohide CB
|
||||||
self.project_autohide_cb = FCCheckBox(label=_('Project AutoHide'))
|
self.project_autohide_cb = FCCheckBox(label=_('Project AutoHide'))
|
||||||
|
@ -365,32 +309,22 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
|
|
||||||
# Setting selection (left - right) colors signals
|
# Setting selection (left - right) colors signals
|
||||||
self.sf_color_entry.editingFinished.connect(self.on_sf_color_entry)
|
self.sf_color_entry.editingFinished.connect(self.on_sf_color_entry)
|
||||||
self.sf_color_button.clicked.connect(self.on_sf_color_button)
|
|
||||||
self.sl_color_entry.editingFinished.connect(self.on_sl_color_entry)
|
self.sl_color_entry.editingFinished.connect(self.on_sl_color_entry)
|
||||||
self.sl_color_button.clicked.connect(self.on_sl_color_button)
|
|
||||||
|
|
||||||
self.left_right_alpha_entry.valueChanged.connect(self.on_left_right_alpha_changed) # alpha
|
self.left_right_alpha_entry.valueChanged.connect(self.on_left_right_alpha_changed) # alpha
|
||||||
|
|
||||||
# Setting selection (right - left) colors signals
|
# Setting selection (right - left) colors signals
|
||||||
self.alt_sf_color_entry.editingFinished.connect(self.on_alt_sf_color_entry)
|
self.alt_sf_color_entry.editingFinished.connect(self.on_alt_sf_color_entry)
|
||||||
self.alt_sf_color_button.clicked.connect(self.on_alt_sf_color_button)
|
|
||||||
self.alt_sl_color_entry.editingFinished.connect(self.on_alt_sl_color_entry)
|
self.alt_sl_color_entry.editingFinished.connect(self.on_alt_sl_color_entry)
|
||||||
self.alt_sl_color_button.clicked.connect(self.on_alt_sl_color_button)
|
|
||||||
|
|
||||||
self.right_left_alpha_entry.valueChanged.connect(self.on_right_left_alpha_changed) # alpha
|
self.right_left_alpha_entry.valueChanged.connect(self.on_right_left_alpha_changed) # alpha
|
||||||
|
|
||||||
# Setting Editor Draw colors signals
|
# Setting Editor Draw colors signals
|
||||||
self.draw_color_entry.editingFinished.connect(self.on_draw_color_entry)
|
self.draw_color_entry.editingFinished.connect(self.on_draw_color_entry)
|
||||||
self.draw_color_button.clicked.connect(self.on_draw_color_button)
|
|
||||||
|
|
||||||
self.sel_draw_color_entry.editingFinished.connect(self.on_sel_draw_color_entry)
|
self.sel_draw_color_entry.editingFinished.connect(self.on_sel_draw_color_entry)
|
||||||
self.sel_draw_color_button.clicked.connect(self.on_sel_draw_color_button)
|
|
||||||
|
|
||||||
self.proj_color_entry.editingFinished.connect(self.on_proj_color_entry)
|
self.proj_color_entry.editingFinished.connect(self.on_proj_color_entry)
|
||||||
self.proj_color_button.clicked.connect(self.on_proj_color_button)
|
|
||||||
|
|
||||||
self.proj_color_dis_entry.editingFinished.connect(self.on_proj_color_dis_entry)
|
self.proj_color_dis_entry.editingFinished.connect(self.on_proj_color_dis_entry)
|
||||||
self.proj_color_dis_button.clicked.connect(self.on_proj_color_dis_button)
|
|
||||||
|
|
||||||
self.layout_combo.activated.connect(self.on_layout)
|
self.layout_combo.activated.connect(self.on_layout)
|
||||||
|
|
||||||
|
@ -417,20 +351,10 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][7:9]
|
self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][7:9]
|
||||||
self.sf_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_fill'])[:7])
|
self.sf_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_fill'])[:7])
|
||||||
|
|
||||||
def on_sf_color_button(self):
|
def on_sl_color_entry(self):
|
||||||
current_color = QtGui.QColor(self.app.defaults['global_sel_fill'][:7])
|
self.app.defaults['global_sel_line'] = self.sl_color_entry.get_value()[:7] + \
|
||||||
|
self.app.defaults['global_sel_line'][7:9]
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
self.sl_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_line'])[:7])
|
||||||
plot_fill_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_fill_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.sf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
|
|
||||||
|
|
||||||
new_val = str(plot_fill_color.name()) + str(self.app.defaults['global_sel_fill'][7:9])
|
|
||||||
self.sf_color_entry.set_value(new_val)
|
|
||||||
self.app.defaults['global_sel_fill'] = new_val
|
|
||||||
|
|
||||||
def on_left_right_alpha_changed(self, spinner_value):
|
def on_left_right_alpha_changed(self, spinner_value):
|
||||||
"""
|
"""
|
||||||
|
@ -448,26 +372,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
self.app.defaults['global_sel_line'] = self.app.defaults['global_sel_line'][:7] + \
|
self.app.defaults['global_sel_line'] = self.app.defaults['global_sel_line'][:7] + \
|
||||||
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
||||||
|
|
||||||
def on_sl_color_entry(self):
|
|
||||||
self.app.defaults['global_sel_line'] = self.sl_color_entry.get_value()[:7] + \
|
|
||||||
self.app.defaults['global_sel_line'][7:9]
|
|
||||||
self.sl_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_line'])[:7])
|
|
||||||
|
|
||||||
def on_sl_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['global_sel_line'][:7])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_line_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_line_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.sl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
|
|
||||||
|
|
||||||
new_val_line = str(plot_line_color.name()) + str(self.app.defaults['global_sel_line'][7:9])
|
|
||||||
self.sl_color_entry.set_value(new_val_line)
|
|
||||||
self.app.defaults['global_sel_line'] = new_val_line
|
|
||||||
|
|
||||||
# Setting selection colors (right - left) handlers
|
# Setting selection colors (right - left) handlers
|
||||||
def on_alt_sf_color_entry(self):
|
def on_alt_sf_color_entry(self):
|
||||||
self.app.defaults['global_alt_sel_fill'] = self.alt_sf_color_entry.get_value()[:7] + \
|
self.app.defaults['global_alt_sel_fill'] = self.alt_sf_color_entry.get_value()[:7] + \
|
||||||
|
@ -476,20 +380,12 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
"background-color:%s" % str(self.app.defaults['global_alt_sel_fill'])[:7]
|
"background-color:%s" % str(self.app.defaults['global_alt_sel_fill'])[:7]
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_alt_sf_color_button(self):
|
def on_alt_sl_color_entry(self):
|
||||||
current_color = QtGui.QColor(self.app.defaults['global_alt_sel_fill'][:7])
|
self.app.defaults['global_alt_sel_line'] = self.alt_sl_color_entry.get_value()[:7] + \
|
||||||
|
self.app.defaults['global_alt_sel_line'][7:9]
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
self.alt_sl_color_button.setStyleSheet(
|
||||||
plot_fill_color = c_dialog.getColor(initial=current_color)
|
"background-color:%s" % str(self.app.defaults['global_alt_sel_line'])[:7]
|
||||||
|
)
|
||||||
if plot_fill_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.alt_sf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
|
|
||||||
|
|
||||||
new_val = str(plot_fill_color.name()) + str(self.app.defaults['global_alt_sel_fill'][7:9])
|
|
||||||
self.alt_sf_color_entry.set_value(new_val)
|
|
||||||
self.app.defaults['global_alt_sel_fill'] = new_val
|
|
||||||
|
|
||||||
def on_right_left_alpha_changed(self, spinner_value):
|
def on_right_left_alpha_changed(self, spinner_value):
|
||||||
"""
|
"""
|
||||||
|
@ -507,112 +403,26 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||||
self.app.defaults['global_alt_sel_line'] = self.app.defaults['global_alt_sel_line'][:7] + \
|
self.app.defaults['global_alt_sel_line'] = self.app.defaults['global_alt_sel_line'][:7] + \
|
||||||
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
||||||
|
|
||||||
def on_alt_sf_color_slider(self):
|
|
||||||
slider_value = self.alt_sf_color_alpha_slider.value()
|
|
||||||
self.alt_sf_color_alpha_spinner.setValue(slider_value)
|
|
||||||
|
|
||||||
def on_alt_sl_color_entry(self):
|
|
||||||
self.app.defaults['global_alt_sel_line'] = self.alt_sl_color_entry.get_value()[:7] + \
|
|
||||||
self.app.defaults['global_alt_sel_line'][7:9]
|
|
||||||
self.alt_sl_color_button.setStyleSheet(
|
|
||||||
"background-color:%s" % str(self.app.defaults['global_alt_sel_line'])[:7]
|
|
||||||
)
|
|
||||||
|
|
||||||
def on_alt_sl_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['global_alt_sel_line'][:7])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_line_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_line_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.alt_sl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
|
|
||||||
|
|
||||||
new_val_line = str(plot_line_color.name()) + str(self.app.defaults['global_alt_sel_line'][7:9])
|
|
||||||
self.alt_sl_color_entry.set_value(new_val_line)
|
|
||||||
self.app.defaults['global_alt_sel_line'] = new_val_line
|
|
||||||
|
|
||||||
# Setting Editor colors
|
# Setting Editor colors
|
||||||
def on_draw_color_entry(self):
|
def on_draw_color_entry(self):
|
||||||
self.app.defaults['global_draw_color'] = self.draw_color_entry.get_value()
|
self.app.defaults['global_draw_color'] = self.draw_color_entry.get_value()
|
||||||
self.draw_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_draw_color']))
|
self.draw_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_draw_color']))
|
||||||
|
|
||||||
def on_draw_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['global_draw_color'])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
draw_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if draw_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.draw_color_button.setStyleSheet("background-color:%s" % str(draw_color.name()))
|
|
||||||
|
|
||||||
new_val = str(draw_color.name())
|
|
||||||
self.draw_color_entry.set_value(new_val)
|
|
||||||
self.app.defaults['global_draw_color'] = new_val
|
|
||||||
|
|
||||||
def on_sel_draw_color_entry(self):
|
def on_sel_draw_color_entry(self):
|
||||||
self.app.defaults['global_sel_draw_color'] = self.sel_draw_color_entry.get_value()
|
self.app.defaults['global_sel_draw_color'] = self.sel_draw_color_entry.get_value()
|
||||||
self.sel_draw_color_button.setStyleSheet(
|
self.sel_draw_color_button.setStyleSheet(
|
||||||
"background-color:%s" % str(self.app.defaults['global_sel_draw_color']))
|
"background-color:%s" % str(self.app.defaults['global_sel_draw_color']))
|
||||||
|
|
||||||
def on_sel_draw_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['global_sel_draw_color'])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
sel_draw_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if sel_draw_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.sel_draw_color_button.setStyleSheet("background-color:%s" % str(sel_draw_color.name()))
|
|
||||||
|
|
||||||
new_val_sel = str(sel_draw_color.name())
|
|
||||||
self.sel_draw_color_entry.set_value(new_val_sel)
|
|
||||||
self.app.defaults['global_sel_draw_color'] = new_val_sel
|
|
||||||
|
|
||||||
def on_proj_color_entry(self):
|
def on_proj_color_entry(self):
|
||||||
self.app.defaults['global_proj_item_color'] = self.proj_color_entry.get_value()
|
self.app.defaults['global_proj_item_color'] = self.proj_color_entry.get_value()
|
||||||
self.proj_color_button.setStyleSheet(
|
self.proj_color_button.setStyleSheet(
|
||||||
"background-color:%s" % str(self.app.defaults['global_proj_item_color']))
|
"background-color:%s" % str(self.app.defaults['global_proj_item_color']))
|
||||||
|
|
||||||
def on_proj_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['global_proj_item_color'])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
proj_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if proj_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.proj_color_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
|
|
||||||
|
|
||||||
new_val_sel = str(proj_color.name())
|
|
||||||
self.proj_color_entry.set_value(new_val_sel)
|
|
||||||
self.app.defaults['global_proj_item_color'] = new_val_sel
|
|
||||||
|
|
||||||
def on_proj_color_dis_entry(self):
|
def on_proj_color_dis_entry(self):
|
||||||
self.app.defaults['global_proj_item_dis_color'] = self.proj_color_dis_entry.get_value()
|
self.app.defaults['global_proj_item_dis_color'] = self.proj_color_dis_entry.get_value()
|
||||||
self.proj_color_dis_button.setStyleSheet(
|
self.proj_color_dis_button.setStyleSheet(
|
||||||
"background-color:%s" % str(self.app.defaults['global_proj_item_dis_color']))
|
"background-color:%s" % str(self.app.defaults['global_proj_item_dis_color']))
|
||||||
|
|
||||||
def on_proj_color_dis_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['global_proj_item_dis_color'])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
proj_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if proj_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.proj_color_dis_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
|
|
||||||
|
|
||||||
new_val_sel = str(proj_color.name())
|
|
||||||
self.proj_color_dis_entry.set_value(new_val_sel)
|
|
||||||
self.app.defaults['global_proj_item_dis_color'] = new_val_sel
|
|
||||||
|
|
||||||
def on_layout(self, index=None, lay=None):
|
def on_layout(self, index=None, lay=None):
|
||||||
"""
|
"""
|
||||||
Set the toolbars layout (location)
|
Set the toolbars layout (location)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
from PyQt5 import QtWidgets
|
||||||
from PyQt5.QtCore import QSettings
|
from PyQt5.QtCore import QSettings
|
||||||
|
|
||||||
from AppGUI.GUIElements import FCCheckBox, FCSpinner, FCEntry
|
from AppGUI.GUIElements import FCCheckBox, FCSpinner, FCEntry, FCColorEntry
|
||||||
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
|
@ -32,7 +32,7 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
|
||||||
self.layout.addWidget(self.plot_options_label)
|
self.layout.addWidget(self.plot_options_label)
|
||||||
|
|
||||||
plot_hlay = QtWidgets.QHBoxLayout()
|
plot_hlay = QtWidgets.QHBoxLayout()
|
||||||
self.layout.addLayout((plot_hlay))
|
self.layout.addLayout(plot_hlay)
|
||||||
|
|
||||||
# Plot CB
|
# Plot CB
|
||||||
self.plot_cb = FCCheckBox(label=_('Plot'))
|
self.plot_cb = FCCheckBox(label=_('Plot'))
|
||||||
|
@ -87,7 +87,7 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
|
||||||
grid0.addWidget(separator_line, 9, 0, 1, 2)
|
grid0.addWidget(separator_line, 9, 0, 1, 2)
|
||||||
|
|
||||||
# Geometry Object Color
|
# Geometry Object Color
|
||||||
self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Geometry Object Color'))
|
self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Object Color'))
|
||||||
grid0.addWidget(self.gerber_color_label, 10, 0, 1, 2)
|
grid0.addWidget(self.gerber_color_label, 10, 0, 1, 2)
|
||||||
|
|
||||||
# Plot Line Color
|
# Plot Line Color
|
||||||
|
@ -95,39 +95,15 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
|
||||||
self.line_color_label.setToolTip(
|
self.line_color_label.setToolTip(
|
||||||
_("Set the line color for plotted objects.")
|
_("Set the line color for plotted objects.")
|
||||||
)
|
)
|
||||||
self.line_color_entry = FCEntry()
|
self.line_color_entry = FCColorEntry()
|
||||||
self.line_color_button = QtWidgets.QPushButton()
|
|
||||||
self.line_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_2 = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child_2.addWidget(self.line_color_entry)
|
|
||||||
self.form_box_child_2.addWidget(self.line_color_button)
|
|
||||||
self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.line_color_label, 11, 0)
|
grid0.addWidget(self.line_color_label, 11, 0)
|
||||||
grid0.addLayout(self.form_box_child_2, 11, 1)
|
grid0.addWidget(self.line_color_entry, 11, 1)
|
||||||
|
|
||||||
self.layout.addStretch()
|
self.layout.addStretch()
|
||||||
|
|
||||||
# Setting plot colors signals
|
# Setting plot colors signals
|
||||||
self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
|
self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
|
||||||
self.line_color_button.clicked.connect(self.on_line_color_button)
|
|
||||||
|
|
||||||
def on_line_color_entry(self):
|
def on_line_color_entry(self):
|
||||||
self.app.defaults['geometry_plot_line'] = self.line_color_entry.get_value()[:7] + 'FF'
|
self.app.defaults['geometry_plot_line'] = self.line_color_entry.get_value()[:7] + 'FF'
|
||||||
self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['geometry_plot_line'])[:7])
|
|
||||||
|
|
||||||
def on_line_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['geometry_plot_line'][:7])
|
|
||||||
# print(current_color)
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_line_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_line_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
|
|
||||||
|
|
||||||
new_val_line = str(plot_line_color.name()) + str(self.app.defaults['geometry_plot_line'][7:9])
|
|
||||||
self.line_color_entry.set_value(new_val_line)
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||||
from PyQt5.QtCore import QSettings
|
from PyQt5.QtCore import QSettings
|
||||||
|
|
||||||
from AppGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCEntry, FCSliderWithSpinner
|
from AppGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCEntry, FCSliderWithSpinner, FCColorEntry
|
||||||
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
|
@ -146,44 +146,30 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
|
||||||
grid0.addWidget(separator_line, 9, 0, 1, 3)
|
grid0.addWidget(separator_line, 9, 0, 1, 3)
|
||||||
|
|
||||||
# Gerber Object Color
|
# Gerber Object Color
|
||||||
self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Gerber Object Color'))
|
self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Object Color'))
|
||||||
grid0.addWidget(self.gerber_color_label, 10, 0, 1, 3)
|
grid0.addWidget(self.gerber_color_label, 10, 0, 1, 3)
|
||||||
|
|
||||||
# Plot Line Color
|
# Plot Line Color
|
||||||
self.pl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
|
self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
|
||||||
self.pl_color_label.setToolTip(
|
self.line_color_label.setToolTip(
|
||||||
_("Set the line color for plotted objects.")
|
_("Set the line color for plotted objects.")
|
||||||
)
|
)
|
||||||
self.pl_color_entry = FCEntry()
|
self.line_color_entry = FCColorEntry()
|
||||||
self.pl_color_button = QtWidgets.QPushButton()
|
|
||||||
self.pl_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_2 = QtWidgets.QHBoxLayout()
|
grid0.addWidget(self.line_color_label, 11, 0)
|
||||||
self.form_box_child_2.addWidget(self.pl_color_entry)
|
grid0.addWidget(self.line_color_entry, 11, 1, 1, 2)
|
||||||
self.form_box_child_2.addWidget(self.pl_color_button)
|
|
||||||
self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.pl_color_label, 11, 0)
|
|
||||||
grid0.addLayout(self.form_box_child_2, 11, 1, 1, 2)
|
|
||||||
|
|
||||||
# Plot Fill Color
|
# Plot Fill Color
|
||||||
self.pf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
||||||
self.pf_color_label.setToolTip(
|
self.fill_color_label.setToolTip(
|
||||||
_("Set the fill color for plotted objects.\n"
|
_("Set the fill color for plotted objects.\n"
|
||||||
"First 6 digits are the color and the last 2\n"
|
"First 6 digits are the color and the last 2\n"
|
||||||
"digits are for alpha (transparency) level.")
|
"digits are for alpha (transparency) level.")
|
||||||
)
|
)
|
||||||
self.pf_color_entry = FCEntry()
|
self.fill_color_entry = FCColorEntry()
|
||||||
self.pf_color_button = QtWidgets.QPushButton()
|
|
||||||
self.pf_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child_1 = QtWidgets.QHBoxLayout()
|
grid0.addWidget(self.fill_color_label, 12, 0)
|
||||||
self.form_box_child_1.addWidget(self.pf_color_entry)
|
grid0.addWidget(self.fill_color_entry, 12, 1, 1, 2)
|
||||||
self.form_box_child_1.addWidget(self.pf_color_button)
|
|
||||||
self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
grid0.addWidget(self.pf_color_label, 12, 0)
|
|
||||||
grid0.addLayout(self.form_box_child_1, 12, 1, 1, 2)
|
|
||||||
|
|
||||||
# Plot Fill Transparency Level
|
# Plot Fill Transparency Level
|
||||||
self.gerber_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
self.gerber_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
||||||
|
@ -198,33 +184,15 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
|
||||||
self.layout.addStretch()
|
self.layout.addStretch()
|
||||||
|
|
||||||
# Setting plot colors signals
|
# Setting plot colors signals
|
||||||
self.pl_color_entry.editingFinished.connect(self.on_pl_color_entry)
|
self.line_color_entry.editingFinished.connect(self.on_line_color_changed)
|
||||||
self.pl_color_button.clicked.connect(self.on_pl_color_button)
|
self.fill_color_entry.editingFinished.connect(self.on_fill_color_changed)
|
||||||
self.pf_color_entry.editingFinished.connect(self.on_pf_color_entry)
|
|
||||||
self.pf_color_button.clicked.connect(self.on_pf_color_button)
|
|
||||||
|
|
||||||
self.gerber_alpha_entry.valueChanged.connect(self.on_gerber_alpha_changed) # alpha
|
self.gerber_alpha_entry.valueChanged.connect(self.on_gerber_alpha_changed) # alpha
|
||||||
|
|
||||||
# Setting plot colors handlers
|
# Setting plot colors handlers
|
||||||
def on_pf_color_entry(self):
|
def on_fill_color_changed(self):
|
||||||
self.app.defaults['gerber_plot_fill'] = self.pf_color_entry.get_value()[:7] + \
|
self.app.defaults['gerber_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
|
||||||
self.app.defaults['gerber_plot_fill'][7:9]
|
self.app.defaults['gerber_plot_fill'][7:9]
|
||||||
self.pf_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['gerber_plot_fill'])[:7])
|
|
||||||
|
|
||||||
def on_pf_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['gerber_plot_fill'][:7])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_fill_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_fill_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.pf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
|
|
||||||
|
|
||||||
new_val = str(plot_fill_color.name()) + str(self.app.defaults['gerber_plot_fill'][7:9])
|
|
||||||
self.pf_color_entry.set_value(new_val)
|
|
||||||
self.app.defaults['gerber_plot_fill'] = new_val
|
|
||||||
|
|
||||||
def on_gerber_alpha_changed(self, spinner_value):
|
def on_gerber_alpha_changed(self, spinner_value):
|
||||||
self.app.defaults['gerber_plot_fill'] = \
|
self.app.defaults['gerber_plot_fill'] = \
|
||||||
|
@ -234,23 +202,6 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
|
||||||
self.app.defaults['gerber_plot_line'][:7] + \
|
self.app.defaults['gerber_plot_line'][:7] + \
|
||||||
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
(hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
||||||
|
|
||||||
def on_pl_color_entry(self):
|
def on_line_color_changed(self):
|
||||||
self.app.defaults['gerber_plot_line'] = self.pl_color_entry.get_value()[:7] + \
|
self.app.defaults['gerber_plot_line'] = self.line_color_entry.get_value()[:7] + \
|
||||||
self.app.defaults['gerber_plot_line'][7:9]
|
self.app.defaults['gerber_plot_line'][7:9]
|
||||||
self.pl_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['gerber_plot_line'])[:7])
|
|
||||||
|
|
||||||
def on_pl_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['gerber_plot_line'][:7])
|
|
||||||
# print(current_color)
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
plot_line_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if plot_line_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.pl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
|
|
||||||
|
|
||||||
new_val_line = str(plot_line_color.name()) + str(self.app.defaults['gerber_plot_line'][7:9])
|
|
||||||
self.pl_color_entry.set_value(new_val_line)
|
|
||||||
self.app.defaults['gerber_plot_line'] = new_val_line
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||||
from PyQt5.QtCore import Qt, QSettings
|
from PyQt5.QtCore import Qt, QSettings
|
||||||
|
|
||||||
from AppGUI.GUIElements import FCSpinner, RadioSet, FCTextArea, FCEntry
|
from AppGUI.GUIElements import FCSpinner, RadioSet, FCTextArea, FCEntry, FCColorEntry
|
||||||
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
|
@ -153,42 +153,20 @@ class Tools2QRCodePrefGroupUI(OptionsGroupUI):
|
||||||
self.fill_color_label.setToolTip(
|
self.fill_color_label.setToolTip(
|
||||||
_("Set the QRCode fill color (squares color).")
|
_("Set the QRCode fill color (squares color).")
|
||||||
)
|
)
|
||||||
self.fill_color_entry = FCEntry()
|
self.fill_color_entry = FCColorEntry()
|
||||||
self.fill_color_button = QtWidgets.QPushButton()
|
|
||||||
self.fill_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
fill_lay_child = QtWidgets.QHBoxLayout()
|
|
||||||
fill_lay_child.setContentsMargins(0, 0, 0, 0)
|
|
||||||
fill_lay_child.addWidget(self.fill_color_entry)
|
|
||||||
fill_lay_child.addWidget(self.fill_color_button, alignment=Qt.AlignRight)
|
|
||||||
fill_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
fill_color_widget = QtWidgets.QWidget()
|
|
||||||
fill_color_widget.setLayout(fill_lay_child)
|
|
||||||
|
|
||||||
grid_lay.addWidget(self.fill_color_label, 9, 0)
|
grid_lay.addWidget(self.fill_color_label, 9, 0)
|
||||||
grid_lay.addWidget(fill_color_widget, 9, 1)
|
grid_lay.addWidget(self.fill_color_entry, 9, 1)
|
||||||
|
|
||||||
# BACK COLOR #
|
# BACK COLOR #
|
||||||
self.back_color_label = QtWidgets.QLabel('%s:' % _('Back Color'))
|
self.back_color_label = QtWidgets.QLabel('%s:' % _('Back Color'))
|
||||||
self.back_color_label.setToolTip(
|
self.back_color_label.setToolTip(
|
||||||
_("Set the QRCode background color.")
|
_("Set the QRCode background color.")
|
||||||
)
|
)
|
||||||
self.back_color_entry = FCEntry()
|
self.back_color_entry = FCColorEntry()
|
||||||
self.back_color_button = QtWidgets.QPushButton()
|
|
||||||
self.back_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
back_lay_child = QtWidgets.QHBoxLayout()
|
|
||||||
back_lay_child.setContentsMargins(0, 0, 0, 0)
|
|
||||||
back_lay_child.addWidget(self.back_color_entry)
|
|
||||||
back_lay_child.addWidget(self.back_color_button, alignment=Qt.AlignRight)
|
|
||||||
back_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
back_color_widget = QtWidgets.QWidget()
|
|
||||||
back_color_widget.setLayout(back_lay_child)
|
|
||||||
|
|
||||||
grid_lay.addWidget(self.back_color_label, 10, 0)
|
grid_lay.addWidget(self.back_color_label, 10, 0)
|
||||||
grid_lay.addWidget(back_color_widget, 10, 1)
|
grid_lay.addWidget(self.back_color_entry, 10, 1)
|
||||||
|
|
||||||
# Selection Limit
|
# Selection Limit
|
||||||
self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
|
self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
|
||||||
|
@ -208,64 +186,10 @@ class Tools2QRCodePrefGroupUI(OptionsGroupUI):
|
||||||
|
|
||||||
# QRCode Tool
|
# QRCode Tool
|
||||||
self.fill_color_entry.editingFinished.connect(self.on_qrcode_fill_color_entry)
|
self.fill_color_entry.editingFinished.connect(self.on_qrcode_fill_color_entry)
|
||||||
self.fill_color_button.clicked.connect(self.on_qrcode_fill_color_button)
|
|
||||||
self.back_color_entry.editingFinished.connect(self.on_qrcode_back_color_entry)
|
self.back_color_entry.editingFinished.connect(self.on_qrcode_back_color_entry)
|
||||||
self.back_color_button.clicked.connect(self.on_qrcode_back_color_button)
|
|
||||||
|
|
||||||
def on_qrcode_fill_color_entry(self):
|
def on_qrcode_fill_color_entry(self):
|
||||||
self.app.defaults['tools_qrcode_fill_color'] = self.fill_color_entry.get_value()
|
self.app.defaults['tools_qrcode_fill_color'] = self.fill_color_entry.get_value()
|
||||||
self.fill_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['tools_qrcode_fill_color'])
|
|
||||||
)
|
|
||||||
|
|
||||||
def on_qrcode_fill_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['tools_qrcode_fill_color'])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
fill_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if fill_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
# if new color is different then mark that the Preferences are changed
|
|
||||||
if fill_color != current_color:
|
|
||||||
self.app.preferencesUiManager.on_preferences_edited()
|
|
||||||
|
|
||||||
self.fill_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(fill_color.name())
|
|
||||||
)
|
|
||||||
|
|
||||||
new_val_sel = str(fill_color.name())
|
|
||||||
self.fill_color_entry.set_value(new_val_sel)
|
|
||||||
self.app.defaults['tools_qrcode_fill_color'] = new_val_sel
|
|
||||||
|
|
||||||
def on_qrcode_back_color_entry(self):
|
def on_qrcode_back_color_entry(self):
|
||||||
self.app.defaults['tools_qrcode_back_color'] = self.back_color_entry.get_value()
|
self.app.defaults['tools_qrcode_back_color'] = self.back_color_entry.get_value()
|
||||||
self.back_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['tools_qrcode_back_color'])
|
|
||||||
)
|
|
||||||
|
|
||||||
def on_qrcode_back_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['tools_qrcode_back_color'])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
back_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if back_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
# if new color is different then mark that the Preferences are changed
|
|
||||||
if back_color != current_color:
|
|
||||||
self.app.preferencesUiManager.on_preferences_edited()
|
|
||||||
|
|
||||||
self.back_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(back_color.name())
|
|
||||||
)
|
|
||||||
|
|
||||||
new_val_sel = str(back_color.name())
|
|
||||||
self.back_color_entry.set_value(new_val_sel)
|
|
||||||
self.app.defaults['tools_qrcode_back_color'] = new_val_sel
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||||
from PyQt5.QtCore import Qt, QSettings
|
from PyQt5.QtCore import Qt, QSettings
|
||||||
|
|
||||||
from AppGUI.GUIElements import RadioSet, FCEntry, FCDoubleSpinner, FCCheckBox, FCComboBox
|
from AppGUI.GUIElements import RadioSet, FCEntry, FCDoubleSpinner, FCCheckBox, FCComboBox, FCColorEntry
|
||||||
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
|
@ -57,20 +57,10 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
|
||||||
self.film_color_label.setToolTip(
|
self.film_color_label.setToolTip(
|
||||||
_("Set the film color when positive film is selected.")
|
_("Set the film color when positive film is selected.")
|
||||||
)
|
)
|
||||||
self.film_color_entry = FCEntry()
|
self.film_color_entry = FCColorEntry()
|
||||||
self.film_color_button = QtWidgets.QPushButton()
|
|
||||||
self.film_color_button.setFixedSize(15, 15)
|
|
||||||
|
|
||||||
self.form_box_child = QtWidgets.QHBoxLayout()
|
|
||||||
self.form_box_child.setContentsMargins(0, 0, 0, 0)
|
|
||||||
self.form_box_child.addWidget(self.film_color_entry)
|
|
||||||
self.form_box_child.addWidget(self.film_color_button, alignment=Qt.AlignRight)
|
|
||||||
self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
||||||
|
|
||||||
film_color_widget = QtWidgets.QWidget()
|
|
||||||
film_color_widget.setLayout(self.form_box_child)
|
|
||||||
grid0.addWidget(self.film_color_label, 1, 0)
|
grid0.addWidget(self.film_color_label, 1, 0)
|
||||||
grid0.addWidget(film_color_widget, 1, 1)
|
grid0.addWidget(self.film_color_entry, 1, 1)
|
||||||
|
|
||||||
# Film Border
|
# Film Border
|
||||||
self.film_boundary_entry = FCDoubleSpinner()
|
self.film_boundary_entry = FCDoubleSpinner()
|
||||||
|
@ -316,32 +306,6 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
|
||||||
|
|
||||||
# Film Tool
|
# Film Tool
|
||||||
self.film_color_entry.editingFinished.connect(self.on_film_color_entry)
|
self.film_color_entry.editingFinished.connect(self.on_film_color_entry)
|
||||||
self.film_color_button.clicked.connect(self.on_film_color_button)
|
|
||||||
|
|
||||||
def on_film_color_entry(self):
|
def on_film_color_entry(self):
|
||||||
self.app.defaults['tools_film_color'] = self.film_color_entry.get_value()
|
self.app.defaults['tools_film_color'] = self.film_color_entry.get_value()
|
||||||
self.film_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(self.defaults['tools_film_color'])
|
|
||||||
)
|
|
||||||
|
|
||||||
def on_film_color_button(self):
|
|
||||||
current_color = QtGui.QColor(self.app.defaults['tools_film_color'])
|
|
||||||
|
|
||||||
c_dialog = QtWidgets.QColorDialog()
|
|
||||||
film_color = c_dialog.getColor(initial=current_color)
|
|
||||||
|
|
||||||
if film_color.isValid() is False:
|
|
||||||
return
|
|
||||||
|
|
||||||
# if new color is different then mark that the Preferences are changed
|
|
||||||
if film_color != current_color:
|
|
||||||
self.app.preferencesUiManager.on_preferences_edited()
|
|
||||||
|
|
||||||
self.film_color_button.setStyleSheet(
|
|
||||||
"background-color:%s;"
|
|
||||||
"border-color: dimgray" % str(film_color.name())
|
|
||||||
)
|
|
||||||
new_val_sel = str(film_color.name())
|
|
||||||
self.film_color_entry.set_value(new_val_sel)
|
|
||||||
self.app.defaults['tools_film_color'] = new_val_sel
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ CHANGELOG for FlatCAM beta
|
||||||
- added a button for Transformations Tool in the lower side (common) of the Object UI
|
- added a button for Transformations Tool in the lower side (common) of the Object UI
|
||||||
- some other UI changes
|
- some other UI changes
|
||||||
- after using Isolation Tool it will switch automatically to the Geometry UI
|
- after using Isolation Tool it will switch automatically to the Geometry UI
|
||||||
- in Preferences replaced some widgets with a new one that combine a Slider with a Spinner (courtesy of David Robertson)
|
- in Preferences replaced some widgets with a new one that combine a Slider with a Spinner (from David Robertson)
|
||||||
|
- in Preferences replaced the widgets that sets colors with a compound one (from David Robertson)
|
||||||
|
|
||||||
31.05.2020
|
31.05.2020
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue