|
|
@@ -472,71 +472,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
|
|
grid0.addWidget(self.wk_orientation_label, 8, 0)
|
|
|
grid0.addWidget(self.wk_orientation_radio, 8, 1)
|
|
|
|
|
|
- separator_line = QtWidgets.QFrame()
|
|
|
- separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
|
|
- separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
|
- grid0.addWidget(separator_line, 9, 0, 1, 2)
|
|
|
-
|
|
|
- self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Gerber Object Color'))
|
|
|
- grid0.addWidget(self.gerber_color_label, 10, 0, 1, 2)
|
|
|
-
|
|
|
- # Plot Line Color
|
|
|
- self.pl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
|
|
|
- self.pl_color_label.setToolTip(
|
|
|
- _("Set the line color for plotted objects.")
|
|
|
- )
|
|
|
- self.pl_color_entry = FCEntry()
|
|
|
- self.pl_color_button = QtWidgets.QPushButton()
|
|
|
- self.pl_color_button.setFixedSize(15, 15)
|
|
|
-
|
|
|
- self.form_box_child_2 = QtWidgets.QHBoxLayout()
|
|
|
- self.form_box_child_2.addWidget(self.pl_color_entry)
|
|
|
- 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)
|
|
|
-
|
|
|
- # Plot Fill Color
|
|
|
- self.pf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
|
|
- self.pf_color_label.setToolTip(
|
|
|
- _("Set the fill color for plotted objects.\n"
|
|
|
- "First 6 digits are the color and the last 2\n"
|
|
|
- "digits are for alpha (transparency) level.")
|
|
|
- )
|
|
|
- self.pf_color_entry = FCEntry()
|
|
|
- self.pf_color_button = QtWidgets.QPushButton()
|
|
|
- self.pf_color_button.setFixedSize(15, 15)
|
|
|
-
|
|
|
- self.form_box_child_1 = QtWidgets.QHBoxLayout()
|
|
|
- self.form_box_child_1.addWidget(self.pf_color_entry)
|
|
|
- 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)
|
|
|
-
|
|
|
- # Plot Fill Transparency Level
|
|
|
- self.pf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
|
|
- self.pf_alpha_label.setToolTip(
|
|
|
- _("Set the fill transparency for plotted objects.")
|
|
|
- )
|
|
|
- self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
|
|
|
- self.pf_color_alpha_slider.setMinimum(0)
|
|
|
- self.pf_color_alpha_slider.setMaximum(255)
|
|
|
- self.pf_color_alpha_slider.setSingleStep(1)
|
|
|
-
|
|
|
- self.pf_color_alpha_spinner = FCSpinner()
|
|
|
- self.pf_color_alpha_spinner.setMinimumWidth(70)
|
|
|
- self.pf_color_alpha_spinner.set_range(0, 255)
|
|
|
-
|
|
|
- self.form_box_child_3 = QtWidgets.QHBoxLayout()
|
|
|
- self.form_box_child_3.addWidget(self.pf_color_alpha_slider)
|
|
|
- self.form_box_child_3.addWidget(self.pf_color_alpha_spinner)
|
|
|
-
|
|
|
- grid0.addWidget(self.pf_alpha_label, 13, 0)
|
|
|
- grid0.addLayout(self.form_box_child_3, 13, 1)
|
|
|
-
|
|
|
separator_line = QtWidgets.QFrame()
|
|
|
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
|
|
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
|
@@ -1701,8 +1636,138 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
|
|
|
)
|
|
|
grid0.addWidget(self.gerber_extra_buffering, 8, 0, 1, 3)
|
|
|
|
|
|
+ separator_line = QtWidgets.QFrame()
|
|
|
+ separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
|
|
+ separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
|
+ grid0.addWidget(separator_line, 9, 0, 1, 3)
|
|
|
+
|
|
|
+ # Gerber Object Color
|
|
|
+ self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Gerber Object Color'))
|
|
|
+ grid0.addWidget(self.gerber_color_label, 10, 0, 1, 3)
|
|
|
+
|
|
|
+ # Plot Line Color
|
|
|
+ self.pl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
|
|
|
+ self.pl_color_label.setToolTip(
|
|
|
+ _("Set the line color for plotted objects.")
|
|
|
+ )
|
|
|
+ self.pl_color_entry = FCEntry()
|
|
|
+ self.pl_color_button = QtWidgets.QPushButton()
|
|
|
+ self.pl_color_button.setFixedSize(15, 15)
|
|
|
+
|
|
|
+ self.form_box_child_2 = QtWidgets.QHBoxLayout()
|
|
|
+ self.form_box_child_2.addWidget(self.pl_color_entry)
|
|
|
+ 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
|
|
|
+ self.pf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
|
|
|
+ self.pf_color_label.setToolTip(
|
|
|
+ _("Set the fill color for plotted objects.\n"
|
|
|
+ "First 6 digits are the color and the last 2\n"
|
|
|
+ "digits are for alpha (transparency) level.")
|
|
|
+ )
|
|
|
+ self.pf_color_entry = FCEntry()
|
|
|
+ self.pf_color_button = QtWidgets.QPushButton()
|
|
|
+ self.pf_color_button.setFixedSize(15, 15)
|
|
|
+
|
|
|
+ self.form_box_child_1 = QtWidgets.QHBoxLayout()
|
|
|
+ self.form_box_child_1.addWidget(self.pf_color_entry)
|
|
|
+ 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
|
|
|
+ self.pf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
|
|
|
+ self.pf_alpha_label.setToolTip(
|
|
|
+ _("Set the fill transparency for plotted objects.")
|
|
|
+ )
|
|
|
+ self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
|
|
|
+ self.pf_color_alpha_slider.setMinimum(0)
|
|
|
+ self.pf_color_alpha_slider.setMaximum(255)
|
|
|
+ self.pf_color_alpha_slider.setSingleStep(1)
|
|
|
+
|
|
|
+ self.pf_color_alpha_spinner = FCSpinner()
|
|
|
+ self.pf_color_alpha_spinner.setMinimumWidth(70)
|
|
|
+ self.pf_color_alpha_spinner.set_range(0, 255)
|
|
|
+
|
|
|
+ self.form_box_child_3 = QtWidgets.QHBoxLayout()
|
|
|
+ self.form_box_child_3.addWidget(self.pf_color_alpha_slider)
|
|
|
+ self.form_box_child_3.addWidget(self.pf_color_alpha_spinner)
|
|
|
+
|
|
|
+ grid0.addWidget(self.pf_alpha_label, 13, 0)
|
|
|
+ grid0.addLayout(self.form_box_child_3, 13, 1, 1, 2)
|
|
|
+
|
|
|
self.layout.addStretch()
|
|
|
|
|
|
+ # Setting plot colors signals
|
|
|
+ self.pl_color_entry.editingFinished.connect(self.on_pl_color_entry)
|
|
|
+ self.pl_color_button.clicked.connect(self.on_pl_color_button)
|
|
|
+ self.pf_color_entry.editingFinished.connect(self.on_pf_color_entry)
|
|
|
+ self.pf_color_button.clicked.connect(self.on_pf_color_button)
|
|
|
+ self.pf_color_alpha_spinner.valueChanged.connect(self.on_pf_color_spinner)
|
|
|
+ self.pf_color_alpha_slider.valueChanged.connect(self.on_pf_color_slider)
|
|
|
+
|
|
|
+ # Setting plot colors handlers
|
|
|
+ def on_pf_color_entry(self):
|
|
|
+ self.app.defaults['gerber_plot_fill'] = self.pf_color_entry.get_value()[:7] + \
|
|
|
+ self.app.defaults['gerber_plot_fill'][7:9]
|
|
|
+ self.pf_color_button.setStyleSheet("background-color:%s" % str(self.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_pf_color_spinner(self):
|
|
|
+ spinner_value = self.pf_color_alpha_spinner.value()
|
|
|
+ self.pf_color_alpha_slider.setValue(spinner_value)
|
|
|
+ self.app.defaults['gerber_plot_fill'] = \
|
|
|
+ self.app.defaults['gerber_plot_fill'][:7] + \
|
|
|
+ (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
+ self.app.defaults['gerber_plot_line'] = \
|
|
|
+ self.app.defaults['gerber_plot_line'][:7] + \
|
|
|
+ (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
+
|
|
|
+ def on_pf_color_slider(self):
|
|
|
+ slider_value = self.pf_color_alpha_slider.value()
|
|
|
+ self.pf_color_alpha_spinner.setValue(slider_value)
|
|
|
+
|
|
|
+ def on_pl_color_entry(self):
|
|
|
+ self.app.defaults['gerber_plot_line'] = self.pl_color_entry.get_value()[:7] + \
|
|
|
+ self.app.defaults['gerber_plot_line'][7:9]
|
|
|
+ self.pl_color_button.setStyleSheet("background-color:%s" % str(self.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
|
|
|
+
|
|
|
|
|
|
class GerberOptPrefGroupUI(OptionsGroupUI):
|
|
|
def __init__(self, decimals=4, parent=None):
|