- 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

@@ -15,6 +15,7 @@ CHANGELOG for FlatCAM beta
- added a shortcut to select all apertures in the Excellon Editor (Ctrl+A) - added a shortcut to select all apertures in the Excellon Editor (Ctrl+A)
- in Cutout Plugin simplified the UI - in Cutout Plugin simplified the UI
- Gerber Extra Buffering is now OFf by default. For those cases where the Gerber file is not rendered correctly it will need to be activated. It has a performance penalty so it will no longer be enabled by default for everybody. - Gerber Extra Buffering is now OFf by default. For those cases where the Gerber file is not rendered correctly it will need to be activated. It has a performance penalty so it will no longer be enabled by default for everybody.
- Gerber UI in Preferences is now updated
27.09.2021 27.09.2021

View File

@@ -1,6 +1,7 @@
from PyQt6 import QtWidgets from PyQt6 import QtWidgets
from appGUI.GUIElements import FCCheckBox, RadioSet, FCDoubleSpinner, FCLabel, OptionalInputSection, FCGridLayout from appGUI.GUIElements import FCCheckBox, RadioSet, FCDoubleSpinner, FCLabel, OptionalInputSection, FCGridLayout, \
FCFrame
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext import gettext
@@ -21,17 +22,14 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI):
self.decimals = decimals self.decimals = decimals
self.defaults = defaults self.defaults = defaults
# ## Advanced Gerber Parameters # #############################################################################################################
self.adv_param_label = FCLabel('<b>%s:</b>' % _('Advanced Options')) # Advanced Gerber Frame
self.adv_param_label.setToolTip( # #############################################################################################################
_("A list of advanced parameters.\n" adv_frame = FCFrame()
"Those parameters are available only for\n" self.layout.addWidget(adv_frame)
"Advanced App. Level.")
)
self.layout.addWidget(self.adv_param_label)
grid0 = FCGridLayout(v_spacing=5, h_spacing=3) adv_grid = FCGridLayout(v_spacing=5, h_spacing=3)
self.layout.addLayout(grid0) adv_frame.setLayout(adv_grid)
# Follow Attribute # Follow Attribute
self.follow_cb = FCCheckBox(label=_('"Follow"')) self.follow_cb = FCCheckBox(label=_('"Follow"'))
@@ -40,19 +38,19 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI):
"This means that it will cut through\n" "This means that it will cut through\n"
"the middle of the trace.") "the middle of the trace.")
) )
grid0.addWidget(self.follow_cb, 0, 0, 1, 2) adv_grid.addWidget(self.follow_cb, 0, 0, 1, 2)
# Aperture Table Visibility CB # Aperture Table Visibility CB
self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide')) self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
self.aperture_table_visibility_cb.setToolTip( self.aperture_table_visibility_cb.setToolTip(
_("Toggle the display of the Tools Table.") _("Toggle the display of the Tools Table.")
) )
grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2) adv_grid.addWidget(self.aperture_table_visibility_cb, 2, 0, 1, 2)
separator_line = QtWidgets.QFrame() separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
grid0.addWidget(separator_line, 2, 0, 1, 2) adv_grid.addWidget(separator_line, 4, 0, 1, 2)
# Buffering Type # Buffering Type
buffering_label = FCLabel('%s:' % _('Buffering')) buffering_label = FCLabel('%s:' % _('Buffering'))
@@ -64,15 +62,15 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI):
) )
self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'}, self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
{'label': _('Full'), 'value': 'full'}]) {'label': _('Full'), 'value': 'full'}])
grid0.addWidget(buffering_label, 9, 0) adv_grid.addWidget(buffering_label, 6, 0)
grid0.addWidget(self.buffering_radio, 9, 1) adv_grid.addWidget(self.buffering_radio, 6, 1)
# Delayed Buffering # Delayed Buffering
self.delayed_buffer_cb = FCCheckBox(label=_('Delayed Buffering')) self.delayed_buffer_cb = FCCheckBox(label=_('Delayed Buffering'))
self.delayed_buffer_cb.setToolTip( self.delayed_buffer_cb.setToolTip(
_("When checked it will do the buffering in background.") _("When checked it will do the buffering in background.")
) )
grid0.addWidget(self.delayed_buffer_cb, 10, 0, 1, 2) adv_grid.addWidget(self.delayed_buffer_cb, 8, 0, 1, 2)
# Simplification # Simplification
self.simplify_cb = FCCheckBox(label=_('Simplify')) self.simplify_cb = FCCheckBox(label=_('Simplify'))
@@ -81,7 +79,7 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI):
"loaded with simplification having a set tolerance.\n" "loaded with simplification having a set tolerance.\n"
"<<WARNING>>: Don't change this unless you know what you are doing !!!") "<<WARNING>>: Don't change this unless you know what you are doing !!!")
) )
grid0.addWidget(self.simplify_cb, 11, 0, 1, 2) adv_grid.addWidget(self.simplify_cb, 10, 0, 1, 2)
# Simplification tolerance # Simplification tolerance
self.simplification_tol_label = FCLabel(_('Tolerance')) self.simplification_tol_label = FCLabel(_('Tolerance'))
@@ -93,8 +91,8 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI):
self.simplification_tol_spinner.setRange(0.00000, 0.01000) self.simplification_tol_spinner.setRange(0.00000, 0.01000)
self.simplification_tol_spinner.setSingleStep(0.0001) self.simplification_tol_spinner.setSingleStep(0.0001)
grid0.addWidget(self.simplification_tol_label, 12, 0) adv_grid.addWidget(self.simplification_tol_label, 12, 0)
grid0.addWidget(self.simplification_tol_spinner, 12, 1) adv_grid.addWidget(self.simplification_tol_spinner, 12, 1)
self.ois_simplif = OptionalInputSection( self.ois_simplif = OptionalInputSection(
self.simplify_cb, self.simplify_cb,
[ [
@@ -102,7 +100,7 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI):
], ],
logic=True) logic=True)
self.layout.addStretch() # self.layout.addStretch()
# signals # signals
self.buffering_radio.activated_custom.connect(self.on_buffering_change) self.buffering_radio.activated_custom.connect(self.on_buffering_change)

View File

@@ -1,7 +1,7 @@
from PyQt6 import QtWidgets from PyQt6 import QtWidgets
from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, FCComboBox, FCLabel, RadioSet, NumericalEvalTupleEntry, \ from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, FCComboBox, FCLabel, RadioSet, NumericalEvalTupleEntry, \
FCGridLayout FCGridLayout, FCFrame
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext import gettext
@@ -22,15 +22,21 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.decimals = decimals self.decimals = decimals
self.defaults = defaults self.defaults = defaults
# Advanced Gerber Parameters # #############################################################################################################
self.param_label = FCLabel("<b>%s:</b>" % _("Parameters")) # Gerber Editor Parameters Frame
# #############################################################################################################
self.param_label = FCLabel('<span style="color:blue;"><b>%s</b></span>' % _('Parameters'))
self.param_label.setToolTip( self.param_label.setToolTip(
_("A list of Gerber Editor parameters.") _("A list of Gerber Editor parameters.")
) )
self.layout.addWidget(self.param_label) self.layout.addWidget(self.param_label)
grid0 = FCGridLayout(v_spacing=5, h_spacing=3) par_frame = FCFrame()
self.layout.addLayout(grid0) self.layout.addWidget(par_frame)
param_grid = FCGridLayout(v_spacing=5, h_spacing=3)
par_frame.setLayout(param_grid)
# Selection Limit # Selection Limit
self.sel_limit_label = FCLabel('%s:' % _("Selection limit")) self.sel_limit_label = FCLabel('%s:' % _("Selection limit"))
@@ -44,8 +50,8 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.sel_limit_entry = FCSpinner() self.sel_limit_entry = FCSpinner()
self.sel_limit_entry.set_range(0, 10000) self.sel_limit_entry.set_range(0, 10000)
grid0.addWidget(self.sel_limit_label, 0, 0) param_grid.addWidget(self.sel_limit_label, 0, 0)
grid0.addWidget(self.sel_limit_entry, 0, 1) param_grid.addWidget(self.sel_limit_entry, 0, 1)
# New aperture code # New aperture code
self.addcode_entry_lbl = FCLabel('%s:' % _('New Aperture code')) self.addcode_entry_lbl = FCLabel('%s:' % _('New Aperture code'))
@@ -57,8 +63,8 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.addcode_entry.set_range(10, 99) self.addcode_entry.set_range(10, 99)
self.addcode_entry.setWrapping(True) self.addcode_entry.setWrapping(True)
grid0.addWidget(self.addcode_entry_lbl, 1, 0) param_grid.addWidget(self.addcode_entry_lbl, 2, 0)
grid0.addWidget(self.addcode_entry, 1, 1) param_grid.addWidget(self.addcode_entry, 2, 1)
# New aperture size # New aperture size
self.addsize_entry_lbl = FCLabel('%s:' % _('New Aperture size')) self.addsize_entry_lbl = FCLabel('%s:' % _('New Aperture size'))
@@ -70,8 +76,8 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.addsize_entry.set_range(0, 100) self.addsize_entry.set_range(0, 100)
self.addsize_entry.set_precision(self.decimals) self.addsize_entry.set_precision(self.decimals)
grid0.addWidget(self.addsize_entry_lbl, 2, 0) param_grid.addWidget(self.addsize_entry_lbl, 4, 0)
grid0.addWidget(self.addsize_entry, 2, 1) param_grid.addWidget(self.addsize_entry, 4, 1)
# New aperture type # New aperture type
self.addtype_combo_lbl = FCLabel('%s:' % _('New Aperture type')) self.addtype_combo_lbl = FCLabel('%s:' % _('New Aperture type'))
@@ -83,8 +89,8 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.addtype_combo = FCComboBox() self.addtype_combo = FCComboBox()
self.addtype_combo.addItems(['C', 'R', 'O']) self.addtype_combo.addItems(['C', 'R', 'O'])
grid0.addWidget(self.addtype_combo_lbl, 3, 0) param_grid.addWidget(self.addtype_combo_lbl, 6, 0)
grid0.addWidget(self.addtype_combo, 3, 1) param_grid.addWidget(self.addtype_combo, 6, 1)
# Number of pads in a pad array # Number of pads in a pad array
self.grb_array_size_label = FCLabel('%s:' % _('Nr of pads')) self.grb_array_size_label = FCLabel('%s:' % _('Nr of pads'))
@@ -95,8 +101,8 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_array_size_entry = FCSpinner() self.grb_array_size_entry = FCSpinner()
self.grb_array_size_entry.set_range(0, 10000) self.grb_array_size_entry.set_range(0, 10000)
grid0.addWidget(self.grb_array_size_label, 4, 0) param_grid.addWidget(self.grb_array_size_label, 8, 0)
grid0.addWidget(self.grb_array_size_entry, 4, 1) param_grid.addWidget(self.grb_array_size_entry, 8, 1)
self.adddim_label = FCLabel('%s:' % _('Aperture Dimensions')) self.adddim_label = FCLabel('%s:' % _('Aperture Dimensions'))
self.adddim_label.setToolTip( self.adddim_label.setToolTip(
@@ -106,11 +112,21 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
) )
self.adddim_entry = NumericalEvalTupleEntry(border_color='#0069A9') self.adddim_entry = NumericalEvalTupleEntry(border_color='#0069A9')
grid0.addWidget(self.adddim_label, 5, 0) param_grid.addWidget(self.adddim_label, 10, 0)
grid0.addWidget(self.adddim_entry, 5, 1) param_grid.addWidget(self.adddim_entry, 10, 1)
self.grb_array_linear_label = FCLabel('<b>%s:</b>' % _('Linear Pad Array')) # #############################################################################################################
grid0.addWidget(self.grb_array_linear_label, 6, 0, 1, 2) # Linear Pad Array Frame
# #############################################################################################################
self.grb_array_linear_label = FCLabel('<span style="color:brown;"><b>%s</b></span>' % _('Linear Pad Array'))
self.layout.addWidget(self.grb_array_linear_label)
lin_frame = FCFrame()
self.layout.addWidget(lin_frame)
# ## Grid Layout
lin_grid = FCGridLayout(v_spacing=5, h_spacing=3)
lin_frame.setLayout(lin_grid)
# Linear Pad Array direction # Linear Pad Array direction
self.grb_axis_label = FCLabel('%s:' % _('Linear Direction')) self.grb_axis_label = FCLabel('%s:' % _('Linear Direction'))
@@ -125,8 +141,8 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
{'label': _('Y'), 'value': 'Y'}, {'label': _('Y'), 'value': 'Y'},
{'label': _('Angle'), 'value': 'A'}]) {'label': _('Angle'), 'value': 'A'}])
grid0.addWidget(self.grb_axis_label, 7, 0) lin_grid.addWidget(self.grb_axis_label, 0, 0)
grid0.addWidget(self.grb_axis_radio, 7, 1) lin_grid.addWidget(self.grb_axis_radio, 0, 1)
# Linear Pad Array pitch distance # Linear Pad Array pitch distance
self.grb_pitch_label = FCLabel('%s:' % _('Pitch')) self.grb_pitch_label = FCLabel('%s:' % _('Pitch'))
@@ -137,8 +153,8 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_pitch_entry = FCDoubleSpinner() self.grb_pitch_entry = FCDoubleSpinner()
self.grb_pitch_entry.set_precision(self.decimals) self.grb_pitch_entry.set_precision(self.decimals)
grid0.addWidget(self.grb_pitch_label, 8, 0) lin_grid.addWidget(self.grb_pitch_label, 2, 0)
grid0.addWidget(self.grb_pitch_entry, 8, 1) lin_grid.addWidget(self.grb_pitch_entry, 2, 1)
# Linear Pad Array custom angle # Linear Pad Array custom angle
self.grb_angle_label = FCLabel('%s:' % _('Angle')) self.grb_angle_label = FCLabel('%s:' % _('Angle'))
@@ -150,11 +166,21 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_angle_entry.set_range(-360, 360) self.grb_angle_entry.set_range(-360, 360)
self.grb_angle_entry.setSingleStep(5) self.grb_angle_entry.setSingleStep(5)
grid0.addWidget(self.grb_angle_label, 9, 0) lin_grid.addWidget(self.grb_angle_label, 4, 0)
grid0.addWidget(self.grb_angle_entry, 9, 1) lin_grid.addWidget(self.grb_angle_entry, 4, 1)
self.grb_array_circ_label = FCLabel('<b>%s:</b>' % _('Circular Pad Array')) # #############################################################################################################
grid0.addWidget(self.grb_array_circ_label, 10, 0, 1, 2) # Circular Pad Array Frame
# #############################################################################################################
self.grb_array_circ_label = FCLabel('<span style="color:green;"><b>%s</b></span>' % _('Circular Pad Array'))
self.layout.addWidget(self.grb_array_circ_label)
circ_frame = FCFrame()
self.layout.addWidget(circ_frame)
# ## Grid Layout
circ_grid = FCGridLayout(v_spacing=5, h_spacing=3)
circ_frame.setLayout(circ_grid)
# Circular Pad Array direction # Circular Pad Array direction
self.grb_circular_direction_label = FCLabel('%s:' % _('Circular Direction')) self.grb_circular_direction_label = FCLabel('%s:' % _('Circular Direction'))
@@ -166,8 +192,8 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'}, self.grb_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
{'label': _('CCW'), 'value': 'CCW'}]) {'label': _('CCW'), 'value': 'CCW'}])
grid0.addWidget(self.grb_circular_direction_label, 11, 0) circ_grid.addWidget(self.grb_circular_direction_label, 0, 0)
grid0.addWidget(self.grb_circular_dir_radio, 11, 1) circ_grid.addWidget(self.grb_circular_dir_radio, 0, 1)
# Circular Pad Array Angle # Circular Pad Array Angle
self.grb_circular_angle_label = FCLabel('%s:' % _('Circular Angle')) self.grb_circular_angle_label = FCLabel('%s:' % _('Circular Angle'))
@@ -180,11 +206,21 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_circular_angle_entry.setSingleStep(5) self.grb_circular_angle_entry.setSingleStep(5)
grid0.addWidget(self.grb_circular_angle_label, 12, 0) circ_grid.addWidget(self.grb_circular_angle_label, 2, 0)
grid0.addWidget(self.grb_circular_angle_entry, 12, 1) circ_grid.addWidget(self.grb_circular_angle_entry, 2, 1)
self.grb_array_tools_b_label = FCLabel('<b>%s:</b>' % _('Buffer Tool')) # #############################################################################################################
grid0.addWidget(self.grb_array_tools_b_label, 13, 0, 1, 2) # Buffer Frame
# #############################################################################################################
self.grb_array_tools_b_label = FCLabel('<span style="color:darkorange;"><b>%s</b></span>' % _('Buffer Tool'))
self.layout.addWidget(self.grb_array_tools_b_label)
buff_frame = FCFrame()
self.layout.addWidget(buff_frame)
# ## Grid Layout
buf_grid = FCGridLayout(v_spacing=5, h_spacing=3)
buff_frame.setLayout(buf_grid)
# Buffer Distance # Buffer Distance
self.grb_buff_label = FCLabel('%s:' % _('Buffer distance')) self.grb_buff_label = FCLabel('%s:' % _('Buffer distance'))
@@ -195,11 +231,21 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_buff_entry.set_precision(self.decimals) self.grb_buff_entry.set_precision(self.decimals)
self.grb_buff_entry.set_range(-10000, 10000) self.grb_buff_entry.set_range(-10000, 10000)
grid0.addWidget(self.grb_buff_label, 14, 0) buf_grid.addWidget(self.grb_buff_label, 0, 0)
grid0.addWidget(self.grb_buff_entry, 14, 1) buf_grid.addWidget(self.grb_buff_entry, 0, 1)
self.grb_array_tools_s_label = FCLabel('<b>%s:</b>' % _('Scale Tool')) # #############################################################################################################
grid0.addWidget(self.grb_array_tools_s_label, 15, 0, 1, 2) # Scale Frame
# #############################################################################################################
self.grb_array_tools_s_label = FCLabel('<span style="color:magenta;"><b>%s</b></span>' % _('Scale Tool'))
self.layout.addWidget(self.grb_array_tools_s_label)
scale_frame = FCFrame()
self.layout.addWidget(scale_frame)
# ## Grid Layout
scale_grid = FCGridLayout(v_spacing=5, h_spacing=3)
scale_frame.setLayout(scale_grid)
# Scale Factor # Scale Factor
self.grb_scale_label = FCLabel('%s:' % _('Scale factor')) self.grb_scale_label = FCLabel('%s:' % _('Scale factor'))
@@ -210,11 +256,21 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_scale_entry.set_precision(self.decimals) self.grb_scale_entry.set_precision(self.decimals)
self.grb_scale_entry.set_range(0, 10000) self.grb_scale_entry.set_range(0, 10000)
grid0.addWidget(self.grb_scale_label, 16, 0) scale_grid.addWidget(self.grb_scale_label, 0, 0)
grid0.addWidget(self.grb_scale_entry, 16, 1) scale_grid.addWidget(self.grb_scale_entry, 0, 1)
self.grb_array_tools_ma_label = FCLabel('<b>%s:</b>' % _('Mark Area Tool')) # #############################################################################################################
grid0.addWidget(self.grb_array_tools_ma_label, 17, 0, 1, 2) # Mark Area Frame
# #############################################################################################################
self.grb_array_tools_ma_label = FCLabel('<span style="color:blue;"><b>%s</b></span>' % _('Mark Area Tool'))
self.layout.addWidget(self.grb_array_tools_ma_label)
ma_frame = FCFrame()
self.layout.addWidget(ma_frame)
# ## Grid Layout
ma_grid = FCGridLayout(v_spacing=5, h_spacing=3)
ma_frame.setLayout(ma_grid)
# Mark area Tool low threshold # Mark area Tool low threshold
self.grb_ma_low_label = FCLabel('%s:' % _('Threshold low')) self.grb_ma_low_label = FCLabel('%s:' % _('Threshold low'))
@@ -225,8 +281,8 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_ma_low_entry.set_precision(self.decimals) self.grb_ma_low_entry.set_precision(self.decimals)
self.grb_ma_low_entry.set_range(0, 10000) self.grb_ma_low_entry.set_range(0, 10000)
grid0.addWidget(self.grb_ma_low_label, 18, 0) ma_grid.addWidget(self.grb_ma_low_label, 0, 0)
grid0.addWidget(self.grb_ma_low_entry, 18, 1) ma_grid.addWidget(self.grb_ma_low_entry, 0, 1)
# Mark area Tool high threshold # Mark area Tool high threshold
self.grb_ma_high_label = FCLabel('%s:' % _('Threshold high')) self.grb_ma_high_label = FCLabel('%s:' % _('Threshold high'))
@@ -237,7 +293,9 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_ma_high_entry.set_precision(self.decimals) self.grb_ma_high_entry.set_precision(self.decimals)
self.grb_ma_high_entry.set_range(0, 10000) self.grb_ma_high_entry.set_range(0, 10000)
grid0.addWidget(self.grb_ma_high_label, 19, 0) ma_grid.addWidget(self.grb_ma_high_label, 2, 0)
grid0.addWidget(self.grb_ma_high_entry, 19, 1) ma_grid.addWidget(self.grb_ma_high_entry, 2, 1)
FCGridLayout.set_common_column_size([param_grid, lin_grid, circ_grid, buf_grid, scale_grid, ma_grid], 0)
self.layout.addStretch() self.layout.addStretch()

View File

@@ -1,6 +1,6 @@
from PyQt6 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore
from appGUI.GUIElements import RadioSet, FCSpinner, FCLabel, FCGridLayout from appGUI.GUIElements import RadioSet, FCSpinner, FCLabel, FCGridLayout, FCFrame
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext import gettext
@@ -21,16 +21,15 @@ class GerberExpPrefGroupUI(OptionsGroupUI):
self.decimals = decimals self.decimals = decimals
self.defaults = defaults self.defaults = defaults
# Plot options # #############################################################################################################
self.export_options_label = FCLabel("<b>%s:</b>" % _("Export Options")) # Export Frame
self.export_options_label.setToolTip( # #############################################################################################################
_("The parameters set here are used in the file exported\n" exp_frame = FCFrame()
"when using the File -> Export -> Export Gerber menu entry.") self.layout.addWidget(exp_frame)
)
self.layout.addWidget(self.export_options_label)
grid0 = FCGridLayout(v_spacing=5, h_spacing=3) # ## Grid Layout
self.layout.addLayout(grid0) exp_grid = FCGridLayout(v_spacing=5, h_spacing=3)
exp_frame.setLayout(exp_grid)
# Gerber Units # Gerber Units
self.gerber_units_label = FCLabel('%s:' % _('Units')) self.gerber_units_label = FCLabel('%s:' % _('Units'))
@@ -44,8 +43,8 @@ class GerberExpPrefGroupUI(OptionsGroupUI):
_("The units used in the Gerber file.") _("The units used in the Gerber file.")
) )
grid0.addWidget(self.gerber_units_label, 0, 0) exp_grid.addWidget(self.gerber_units_label, 0, 0)
grid0.addWidget(self.gerber_units_radio, 0, 1) exp_grid.addWidget(self.gerber_units_radio, 0, 1)
# Gerber format # Gerber format
self.digits_label = FCLabel("%s:" % _("Int/Decimals")) self.digits_label = FCLabel("%s:" % _("Int/Decimals"))
@@ -85,8 +84,8 @@ class GerberExpPrefGroupUI(OptionsGroupUI):
hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignmentFlag.AlignLeft) hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignmentFlag.AlignLeft)
hlay1.addStretch() hlay1.addStretch()
grid0.addWidget(self.digits_label, 2, 0) exp_grid.addWidget(self.digits_label, 2, 0)
grid0.addLayout(hlay1, 2, 1) exp_grid.addLayout(hlay1, 2, 1)
# Gerber Zeros # Gerber Zeros
self.zeros_label = FCLabel('%s:' % _('Zeros')) self.zeros_label = FCLabel('%s:' % _('Zeros'))
@@ -109,7 +108,7 @@ class GerberExpPrefGroupUI(OptionsGroupUI):
"and Leading Zeros are kept.") "and Leading Zeros are kept.")
) )
grid0.addWidget(self.zeros_label, 4, 0) exp_grid.addWidget(self.zeros_label, 4, 0)
grid0.addWidget(self.zeros_radio, 4, 1) exp_grid.addWidget(self.zeros_radio, 4, 1)
self.layout.addStretch() self.layout.addStretch()

View File

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

View File

@@ -1,6 +1,6 @@
from PyQt6 import QtWidgets from PyQt6 import QtWidgets
from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCLabel, FCGridLayout from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCLabel, FCGridLayout, FCFrame
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext import gettext
@@ -22,8 +22,10 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
self.setTitle(str(_("Gerber Options"))) self.setTitle(str(_("Gerber Options")))
# ## Clear non-copper regions # #############################################################################################################
self.clearcopper_label = FCLabel("<b>%s:</b>" % _("Non-copper regions")) # Non-copper Regions Frame
# #############################################################################################################
self.clearcopper_label = FCLabel('<span style="color:blue;"><b>%s</b></span>' % _("Non-copper regions"))
self.clearcopper_label.setToolTip( self.clearcopper_label.setToolTip(
_("Create polygons covering the\n" _("Create polygons covering the\n"
"areas without copper on the PCB.\n" "areas without copper on the PCB.\n"
@@ -33,8 +35,12 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
) )
self.layout.addWidget(self.clearcopper_label) self.layout.addWidget(self.clearcopper_label)
grid1 = FCGridLayout(v_spacing=5, h_spacing=3) ncc_frame = FCFrame()
self.layout.addLayout(grid1) self.layout.addWidget(ncc_frame)
# ## Grid Layout
ncc_grid = FCGridLayout(v_spacing=5, h_spacing=3)
ncc_frame.setLayout(ncc_grid)
# Margin # Margin
bmlabel = FCLabel('%s:' % _('Boundary Margin')) bmlabel = FCLabel('%s:' % _('Boundary Margin'))
@@ -44,31 +50,32 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
"objects with this minimum\n" "objects with this minimum\n"
"distance.") "distance.")
) )
grid1.addWidget(bmlabel, 0, 0)
self.noncopper_margin_entry = FCDoubleSpinner() self.noncopper_margin_entry = FCDoubleSpinner()
self.noncopper_margin_entry.set_precision(self.decimals) self.noncopper_margin_entry.set_precision(self.decimals)
self.noncopper_margin_entry.setSingleStep(0.1) self.noncopper_margin_entry.setSingleStep(0.1)
self.noncopper_margin_entry.set_range(-9999, 9999) self.noncopper_margin_entry.set_range(-9999, 9999)
grid1.addWidget(self.noncopper_margin_entry, 0, 1)
ncc_grid.addWidget(bmlabel, 0, 0)
ncc_grid.addWidget(self.noncopper_margin_entry, 0, 1)
# Rounded corners # Rounded corners
self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo")) self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
self.noncopper_rounded_cb.setToolTip( self.noncopper_rounded_cb.setToolTip(
_("Resulting geometry will have rounded corners.") _("Resulting geometry will have rounded corners.")
) )
grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2) ncc_grid.addWidget(self.noncopper_rounded_cb, 2, 0, 1, 2)
separator_line = QtWidgets.QFrame() # #############################################################################################################
separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) # Bounding Box Frame
separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) # #############################################################################################################
grid1.addWidget(separator_line, 2, 0, 1, 2) self.boundingbox_label = FCLabel('<span style="color:brown;"><b>%s</b></span>' % _('Bounding Box'))
# ## Bounding box
self.boundingbox_label = FCLabel('<b>%s:</b>' % _('Bounding Box'))
self.layout.addWidget(self.boundingbox_label) self.layout.addWidget(self.boundingbox_label)
grid2 = FCGridLayout(v_spacing=5, h_spacing=3) bb_frame = FCFrame()
self.layout.addLayout(grid2) self.layout.addWidget(bb_frame)
bb_grid = FCGridLayout(v_spacing=5, h_spacing=3)
bb_frame.setLayout(bb_grid)
bbmargin = FCLabel('%s:' % _('Boundary Margin')) bbmargin = FCLabel('%s:' % _('Boundary Margin'))
bbmargin.setToolTip( bbmargin.setToolTip(
@@ -80,8 +87,8 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
self.bbmargin_entry.setSingleStep(0.1) self.bbmargin_entry.setSingleStep(0.1)
self.bbmargin_entry.set_range(-9999, 9999) self.bbmargin_entry.set_range(-9999, 9999)
grid2.addWidget(bbmargin, 0, 0) bb_grid.addWidget(bbmargin, 0, 0)
grid2.addWidget(self.bbmargin_entry, 0, 1) bb_grid.addWidget(self.bbmargin_entry, 0, 1)
self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo")) self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo"))
self.bbrounded_cb.setToolTip( self.bbrounded_cb.setToolTip(
@@ -90,5 +97,8 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
"their radius is equal to\n" "their radius is equal to\n"
"the margin.") "the margin.")
) )
grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2) bb_grid.addWidget(self.bbrounded_cb, 2, 0, 1, 2)
FCGridLayout.set_common_column_size([ncc_grid, bb_grid], 0)
self.layout.addStretch() self.layout.addStretch()

View File

@@ -25,7 +25,7 @@ class GerberPreferencesUI(QtWidgets.QWidget):
self.defaults = defaults self.defaults = defaults
self.gerber_gen_group = GerberGenPrefGroupUI(decimals=self.decimals, defaults=self.defaults) self.gerber_gen_group = GerberGenPrefGroupUI(decimals=self.decimals, defaults=self.defaults)
self.gerber_gen_group.setMinimumWidth(250) self.gerber_gen_group.setMinimumWidth(200)
self.gerber_opt_group = GerberOptPrefGroupUI(decimals=self.decimals, defaults=self.defaults) self.gerber_opt_group = GerberOptPrefGroupUI(decimals=self.decimals, defaults=self.defaults)
self.gerber_opt_group.setMinimumWidth(250) self.gerber_opt_group.setMinimumWidth(250)
self.gerber_exp_group = GerberExpPrefGroupUI(decimals=self.decimals, defaults=self.defaults) self.gerber_exp_group = GerberExpPrefGroupUI(decimals=self.decimals, defaults=self.defaults)