- Gerber UI in Preferences is now updated

This commit is contained in:
Marius Stanciu
2021-09-29 00:06:13 +03:00
committed by Marius Stanciu
parent 1fb520e829
commit ad5bf57861
7 changed files with 248 additions and 142 deletions

View File

@@ -1,7 +1,7 @@
from PyQt6 import QtWidgets, QtCore, QtGui
from appGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCButton, FCSliderWithSpinner, FCColorEntry, FCLabel, \
FCGridLayout
FCGridLayout, FCFrame
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext
@@ -23,32 +23,40 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
self.defaults = defaults
# ## Plot options
self.plot_options_label = FCLabel("<b>%s:</b>" % _("Plot Options"))
self.plot_options_label = FCLabel('<span style="color:blue;"><b>%s</b></span>' % _("Plot Options"))
self.layout.addWidget(self.plot_options_label)
grid0 = FCGridLayout(v_spacing=5, h_spacing=3)
self.layout.addLayout(grid0)
# #############################################################################################################
# Plot Frame
# #############################################################################################################
plot_frame = FCFrame()
self.layout.addWidget(plot_frame)
# ## Grid Layout
plot_grid = FCGridLayout(v_spacing=5, h_spacing=3)
plot_frame.setLayout(plot_grid)
# Plot CB
self.plot_cb = FCCheckBox(label='%s' % _('Plot'))
self.plot_options_label.setToolTip(
_("Plot (show) this object.")
)
grid0.addWidget(self.plot_cb, 0, 0)
plot_grid.addWidget(self.plot_cb, 0, 0)
# Solid CB
self.solid_cb = FCCheckBox(label='%s' % _('Solid'))
self.solid_cb.setToolTip(
_("Solid color polygons.")
)
grid0.addWidget(self.solid_cb, 0, 1)
plot_grid.addWidget(self.solid_cb, 0, 1)
# Multicolored CB
self.multicolored_cb = FCCheckBox(label='%s' % _('M-Color'))
self.multicolored_cb.setToolTip(
_("Draw polygons in different colors.")
)
grid0.addWidget(self.multicolored_cb, 0, 2)
plot_grid.addWidget(self.multicolored_cb, 0, 2)
# Number of circle steps for circular aperture linear approximation
self.circle_steps_label = FCLabel('%s:' % _("Circle Steps"))
@@ -59,19 +67,28 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
self.circle_steps_entry = FCSpinner()
self.circle_steps_entry.set_range(0, 9999)
grid0.addWidget(self.circle_steps_label, 1, 0)
grid0.addWidget(self.circle_steps_entry, 1, 1, 1, 2)
plot_grid.addWidget(self.circle_steps_label, 2, 0)
plot_grid.addWidget(self.circle_steps_entry, 2, 1, 1, 2)
grid0.addWidget(FCLabel(''), 2, 0, 1, 3)
# #############################################################################################################
# Default Values Frame
# #############################################################################################################
# Default format for Gerber
self.gerber_default_label = FCLabel('<b>%s:</b>' % _('Default Values'))
self.gerber_default_label = FCLabel('<span style="color:green;"><b>%s</b></span>' % _('Default Values'))
self.gerber_default_label.setToolTip(
_("Those values will be used as fallback values\n"
"in case that they are not found in the Gerber file.")
)
grid0.addWidget(self.gerber_default_label, 3, 0, 1, 3)
self.layout.addWidget(self.gerber_default_label)
def_frame = FCFrame()
self.layout.addWidget(def_frame)
# ## Grid Layout
def_grid = FCGridLayout(v_spacing=5, h_spacing=3)
def_frame.setLayout(def_grid)
# Gerber Units
self.gerber_units_label = FCLabel('%s:' % _('Units'))
@@ -80,13 +97,13 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
)
self.gerber_units_radio = RadioSet([{'label': _('Inch'), 'value': 'IN'},
{'label': _('mm'), 'value': 'MM'}])
{'label': _('mm'), 'value': 'MM'}], compact=True)
self.gerber_units_radio.setToolTip(
_("The units used in the Gerber file.")
)
grid0.addWidget(self.gerber_units_label, 4, 0)
grid0.addWidget(self.gerber_units_radio, 4, 1, 1, 2)
def_grid.addWidget(self.gerber_units_label, 0, 0)
def_grid.addWidget(self.gerber_units_radio, 0, 1, 1, 2)
# Gerber Zeros
self.gerber_zeros_label = FCLabel('%s:' % _('Zeros'))
@@ -100,7 +117,7 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
)
self.gerber_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
{'label': _('TZ'), 'value': 'T'}])
{'label': _('TZ'), 'value': 'T'}], compact=True)
self.gerber_zeros_radio.setToolTip(
_("This sets the type of Gerber zeros.\n"
"If LZ then Leading Zeros are removed and\n"
@@ -109,13 +126,21 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
"and Leading Zeros are kept.")
)
grid0.addWidget(self.gerber_zeros_label, 5, 0)
grid0.addWidget(self.gerber_zeros_radio, 5, 1, 1, 2)
def_grid.addWidget(self.gerber_zeros_label, 2, 0)
def_grid.addWidget(self.gerber_zeros_radio, 2, 1, 1, 2)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
grid0.addWidget(separator_line, 6, 0, 1, 3)
# #############################################################################################################
# Parameters Frame
# #############################################################################################################
self.param_label = FCLabel('<span style="color:indigo;"><b>%s</b></span>' % _('Parameters'))
self.layout.addWidget(self.param_label)
par_frame = FCFrame()
self.layout.addWidget(par_frame)
# ## Grid Layout
param_grid = FCGridLayout(v_spacing=5, h_spacing=3)
par_frame.setLayout(param_grid)
# Apertures Cleaning
self.gerber_clean_cb = FCCheckBox(label='%s' % _('Clean Apertures'))
@@ -123,7 +148,7 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
_("Will remove apertures that do not have geometry\n"
"thus lowering the number of apertures in the Gerber object.")
)
grid0.addWidget(self.gerber_clean_cb, 7, 0, 1, 3)
param_grid.addWidget(self.gerber_clean_cb, 0, 0, 1, 3)
# Apply Extra Buffering
self.gerber_extra_buffering = FCCheckBox(label='%s' % _('Polarity change buffer'))
@@ -133,7 +158,7 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
"May help loading Gerber files that otherwise\n"
"do not load correctly.")
)
grid0.addWidget(self.gerber_extra_buffering, 8, 0, 1, 3)
param_grid.addWidget(self.gerber_extra_buffering, 2, 0, 1, 3)
# Store colors
self.store_colors_cb = FCCheckBox(label='%s' % _('Store colors'))
@@ -141,24 +166,37 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
_("It will store the set colors for Gerber objects.\n"
"Those will be used each time the application is started.")
)
grid0.addWidget(self.store_colors_cb, 11, 0)
# Clear stored colors
self.clear_colors_button = FCButton('%s' % _('Clear Colors'))
self.clear_colors_button = FCButton()
# self.clear_colors_button.setToolButtonStyle(QtCore.Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
self.clear_colors_button.setText('%s' % _('Clear Colors'))
self.clear_colors_button.setIcon(QtGui.QIcon(self.app.resource_location + '/trash32.png'))
self.clear_colors_button.setToolTip(
_("Reset the colors associated with Gerber objects.")
)
grid0.addWidget(self.clear_colors_button, 11, 1, 1, 2)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
grid0.addWidget(separator_line, 13, 0, 1, 3)
param_grid.addWidget(self.store_colors_cb, 4, 0, 1, 3)
param_grid.addWidget(self.clear_colors_button, 6, 0, 1, 3)
# separator_line = QtWidgets.QFrame()
# separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
# separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
# plot_grid.addWidget(separator_line, 13, 0, 1, 3)
# #############################################################################################################
# Object Frame
# #############################################################################################################
# Gerber Object Color
self.gerber_color_label = FCLabel('<b>%s</b>' % _('Object Color'))
grid0.addWidget(self.gerber_color_label, 15, 0, 1, 3)
self.gerber_color_label = FCLabel('<span style="color:darkorange;"><b>%s</b></span>' % _('Object Color'))
self.layout.addWidget(self.gerber_color_label)
obj_frame = FCFrame()
self.layout.addWidget(obj_frame)
# ## Grid Layout
obj_grid = FCGridLayout(v_spacing=5, h_spacing=3)
obj_frame.setLayout(obj_grid)
# Plot Line Color
self.line_color_label = FCLabel('%s:' % _('Outline'))
@@ -167,8 +205,8 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
)
self.line_color_entry = FCColorEntry()
grid0.addWidget(self.line_color_label, 17, 0)
grid0.addWidget(self.line_color_entry, 17, 1, 1, 2)
obj_grid.addWidget(self.line_color_label, 0, 0)
obj_grid.addWidget(self.line_color_entry, 0, 1, 1, 2)
# Plot Fill Color
self.fill_color_label = FCLabel('%s:' % _('Fill'))
@@ -179,8 +217,8 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
)
self.fill_color_entry = FCColorEntry()
grid0.addWidget(self.fill_color_label, 20, 0)
grid0.addWidget(self.fill_color_entry, 20, 1, 1, 2)
obj_grid.addWidget(self.fill_color_label, 2, 0)
obj_grid.addWidget(self.fill_color_entry, 2, 1, 1, 2)
# Plot Fill Transparency Level
self.gerber_alpha_label = FCLabel('%s:' % _('Alpha'))
@@ -189,8 +227,10 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
)
self.gerber_alpha_entry = FCSliderWithSpinner(0, 255, 1)
grid0.addWidget(self.gerber_alpha_label, 22, 0)
grid0.addWidget(self.gerber_alpha_entry, 22, 1, 1, 2)
obj_grid.addWidget(self.gerber_alpha_label, 4, 0)
obj_grid.addWidget(self.gerber_alpha_entry, 4, 1, 1, 2)
FCGridLayout.set_common_column_size([plot_grid, param_grid, def_grid, obj_grid], 0)
self.layout.addStretch()