gerber advanced options

This commit is contained in:
David Robertson
2020-05-09 15:28:48 +01:00
parent 4fc98482de
commit 126ed47783
2 changed files with 105 additions and 172 deletions

View File

@@ -50,19 +50,8 @@ class PreferencesUIManager:
self.defaults_form_fields = { self.defaults_form_fields = {
# Gerber Advanced Options # Gerber Advanced Options
"gerber_aperture_display": self.ui.gerber_defaults_form.gerber_adv_opt_group.aperture_table_visibility_cb,
# "gerber_aperture_scale_factor": self.ui.gerber_defaults_form.gerber_adv_opt_group.scale_aperture_entry, # "gerber_aperture_scale_factor": self.ui.gerber_defaults_form.gerber_adv_opt_group.scale_aperture_entry,
# "gerber_aperture_buffer_factor": self.ui.gerber_defaults_form.gerber_adv_opt_group.buffer_aperture_entry, # "gerber_aperture_buffer_factor": self.ui.gerber_defaults_form.gerber_adv_opt_group.buffer_aperture_entry,
"gerber_follow": self.ui.gerber_defaults_form.gerber_adv_opt_group.follow_cb,
"gerber_tool_type": self.ui.gerber_defaults_form.gerber_adv_opt_group.tool_type_radio,
"gerber_vtipdia": self.ui.gerber_defaults_form.gerber_adv_opt_group.tipdia_spinner,
"gerber_vtipangle": self.ui.gerber_defaults_form.gerber_adv_opt_group.tipangle_spinner,
"gerber_vcutz": self.ui.gerber_defaults_form.gerber_adv_opt_group.cutz_spinner,
"gerber_iso_type": self.ui.gerber_defaults_form.gerber_adv_opt_group.iso_type_radio,
"gerber_buffering": self.ui.gerber_defaults_form.gerber_adv_opt_group.buffering_radio,
"gerber_simplification": self.ui.gerber_defaults_form.gerber_adv_opt_group.simplify_cb,
"gerber_simp_tolerance": self.ui.gerber_defaults_form.gerber_adv_opt_group.simplification_tol_spinner,
# Gerber Editor # Gerber Editor

View File

@@ -1,7 +1,6 @@
from PyQt5 import QtWidgets from flatcamGUI.GUIElements import OptionalInputSection
from flatcamGUI.preferences.OptionUI import *
from flatcamGUI.GUIElements import FCCheckBox, RadioSet, FCDoubleSpinner, FCSpinner, OptionalInputSection from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI2
from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext import gettext
import FlatCAMTranslation as fcTranslate import FlatCAMTranslation as fcTranslate
@@ -12,167 +11,112 @@ if '_' not in builtins.__dict__:
_ = gettext.gettext _ = gettext.gettext
class GerberAdvOptPrefGroupUI(OptionsGroupUI): class GerberAdvOptPrefGroupUI(OptionsGroupUI2):
def __init__(self, decimals=4, parent=None):
super(GerberAdvOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Gerber Adv. Options"))) def __init__(self, decimals=4, **kwargs):
self.decimals = decimals self.decimals = decimals
super().__init__(**kwargs)
self.setTitle(str(_("Gerber Adv. Options")))
# ## Advanced Gerber Parameters self.simplify_cb = self.option_dict()["gerber_simplification"].get_field()
self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options')) self.simplification_tol_label = self.option_dict()["gerber_simp_tolerance"].label_widget
self.adv_param_label.setToolTip( self.simplification_tol_spinner = self.option_dict()["gerber_simp_tolerance"].get_field()
_("A list of Gerber advanced parameters.\n" self.ois_simplif = OptionalInputSection(self.simplify_cb, [self.simplification_tol_label, self.simplification_tol_spinner], logic=True)
def build_options(self) -> [OptionUI]:
return [
HeadingOptionUI(
label_text="Advanced Options",
label_tooltip="A list of Gerber advanced parameters.\n"
"Those parameters are available only for\n" "Those parameters are available only for\n"
"Advanced App. Level.") "Advanced App. Level."
) ),
self.layout.addWidget(self.adv_param_label) CheckboxOptionUI(
option="gerber_follow",
grid0 = QtWidgets.QGridLayout() label_text='"Follow"',
self.layout.addLayout(grid0) label_tooltip="Generate a 'Follow' geometry.\n"
# Follow Attribute
self.follow_cb = FCCheckBox(label=_('"Follow"'))
self.follow_cb.setToolTip(
_("Generate a 'Follow' geometry.\n"
"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) CheckboxOptionUI(
option="gerber_aperture_display",
# Aperture Table Visibility CB label_text="Table Show/Hide",
self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide')) label_tooltip="Toggle the display of the Gerber Apertures Table.\n"
self.aperture_table_visibility_cb.setToolTip(
_("Toggle the display of the Gerber Apertures Table.\n"
"Also, on hide, it will delete all mark shapes\n" "Also, on hide, it will delete all mark shapes\n"
"that are drawn on canvas.") "that are drawn on canvas."
),
SeparatorOptionUI(),
) RadioSetOptionUI(
grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2) option="gerber_tool_type",
label_text="Tool Type",
separator_line = QtWidgets.QFrame() label_bold=True,
separator_line.setFrameShape(QtWidgets.QFrame.HLine) label_tooltip="Choose which tool to use for Gerber isolation:\n"
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid0.addWidget(separator_line, 2, 0, 1, 2)
# Tool Type
self.tool_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Tool Type'))
self.tool_type_label.setToolTip(
_("Choose which tool to use for Gerber isolation:\n"
"'Circular' or 'V-shape'.\n" "'Circular' or 'V-shape'.\n"
"When the 'V-shape' is selected then the tool\n" "When the 'V-shape' is selected then the tool\n"
"diameter will depend on the chosen cut depth.") "diameter will depend on the chosen cut depth.",
) choices=[{'label': 'Circular', 'value': 'circular'},
self.tool_type_radio = RadioSet([{'label': 'Circular', 'value': 'circular'}, {'label': 'V-Shape', 'value': 'v'}]
{'label': 'V-Shape', 'value': 'v'}]) ),
DoubleSpinnerOptionUI(
option="gerber_vtipdia",
label_text="V-Tip Dia",
label_tooltip="The tip diameter for V-Shape Tool",
min_value=-99.9999, max_value=99.9999, step=0.1, decimals=self.decimals
),
SpinnerOptionUI(
option="gerber_vtipangle",
label_text="V-Tip Angle",
label_tooltip="The tip angle for V-Shape Tool.\n"
"In degrees.",
min_value=1, max_value=180, step=5
),
DoubleSpinnerOptionUI(
option="gerber_vcutz",
label_text="Cut Z",
label_tooltip="Cutting depth (negative)\n"
"below the copper surface.",
min_value=-99.9999, max_value=0.0000, step=0.1, decimals=self.decimals
),
grid0.addWidget(self.tool_type_label, 3, 0) RadioSetOptionUI(
grid0.addWidget(self.tool_type_radio, 3, 1, 1, 2) option="gerber_iso_type",
label_text="Isolation Type",
# Tip Dia label_tooltip="Choose how the isolation will be executed:\n"
self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
self.tipdialabel.setToolTip(
_("The tip diameter for V-Shape Tool")
)
self.tipdia_spinner = FCDoubleSpinner()
self.tipdia_spinner.set_precision(self.decimals)
self.tipdia_spinner.set_range(-99.9999, 99.9999)
self.tipdia_spinner.setSingleStep(0.1)
self.tipdia_spinner.setWrapping(True)
grid0.addWidget(self.tipdialabel, 4, 0)
grid0.addWidget(self.tipdia_spinner, 4, 1, 1, 2)
# Tip Angle
self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
self.tipanglelabel.setToolTip(
_("The tip angle for V-Shape Tool.\n"
"In degree.")
)
self.tipangle_spinner = FCSpinner()
self.tipangle_spinner.set_range(1, 180)
self.tipangle_spinner.set_step(5)
self.tipangle_spinner.setWrapping(True)
grid0.addWidget(self.tipanglelabel, 5, 0)
grid0.addWidget(self.tipangle_spinner, 5, 1, 1, 2)
# Cut Z
self.cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
self.cutzlabel.setToolTip(
_("Cutting depth (negative)\n"
"below the copper surface.")
)
self.cutz_spinner = FCDoubleSpinner()
self.cutz_spinner.set_precision(self.decimals)
self.cutz_spinner.set_range(-99.9999, 0.0000)
self.cutz_spinner.setSingleStep(0.1)
self.cutz_spinner.setWrapping(True)
grid0.addWidget(self.cutzlabel, 6, 0)
grid0.addWidget(self.cutz_spinner, 6, 1, 1, 2)
# Isolation Type
self.iso_type_label = QtWidgets.QLabel('%s:' % _('Isolation Type'))
self.iso_type_label.setToolTip(
_("Choose how the isolation will be executed:\n"
"- 'Full' -> complete isolation of polygons\n" "- 'Full' -> complete isolation of polygons\n"
"- 'Ext' -> will isolate only on the outside\n" "- 'Ext' -> will isolate only on the outside\n"
"- 'Int' -> will isolate only on the inside\n" "- 'Int' -> will isolate only on the inside\n"
"'Exterior' isolation is almost always possible\n" "'Exterior' isolation is almost always possible\n"
"(with the right tool) but 'Interior'\n" "(with the right tool) but 'Interior'\n"
"isolation can be done only when there is an opening\n" "isolation can be done only when there is an opening\n"
"inside of the polygon (e.g polygon is a 'doughnut' shape).") "inside of the polygon (e.g polygon is a 'doughnut' shape).",
) choices=[{'label': _('Full'), 'value': 'full'},
self.iso_type_radio = RadioSet([{'label': _('Full'), 'value': 'full'},
{'label': _('Exterior'), 'value': 'ext'}, {'label': _('Exterior'), 'value': 'ext'},
{'label': _('Interior'), 'value': 'int'}]) {'label': _('Interior'), 'value': 'int'}]
),
SeparatorOptionUI(),
grid0.addWidget(self.iso_type_label, 7, 0,) RadioSetOptionUI(
grid0.addWidget(self.iso_type_radio, 7, 1, 1, 2) option="gerber_buffering",
label_text="Buffering",
separator_line = QtWidgets.QFrame() label_tooltip="Buffering type:\n"
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid0.addWidget(separator_line, 8, 0, 1, 2)
# Buffering Type
buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
buffering_label.setToolTip(
_("Buffering type:\n"
"- None --> best performance, fast file loading but no so good display\n" "- None --> best performance, fast file loading but no so good display\n"
"- Full --> slow file loading but good visuals. This is the default.\n" "- Full --> slow file loading but good visuals. This is the default.\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 !!!",
) choices=[{'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) CheckboxOptionUI(
grid0.addWidget(self.buffering_radio, 9, 1) option="gerber_simplification",
label_text="Simplify",
# Simplification label_tooltip="When checked all the Gerber polygons will be\n"
self.simplify_cb = FCCheckBox(label=_('Simplify'))
self.simplify_cb.setToolTip(
_("When checked all the Gerber polygons will be\n"
"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 !!!"
),
DoubleSpinnerOptionUI(
option="gerber_simp_tolerance",
label_text="Tolerance",
label_tooltip="Tolerance for polygon simplification.",
min_value=0.0, max_value=0.01, step=0.0001, decimals=self.decimals+1
) )
grid0.addWidget(self.simplify_cb, 10, 0, 1, 2) ]
# Simplification tolerance
self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification."))
self.simplification_tol_spinner = FCDoubleSpinner()
self.simplification_tol_spinner.set_precision(self.decimals + 1)
self.simplification_tol_spinner.setWrapping(True)
self.simplification_tol_spinner.setRange(0.00000, 0.01000)
self.simplification_tol_spinner.setSingleStep(0.0001)
grid0.addWidget(self.simplification_tol_label, 11, 0)
grid0.addWidget(self.simplification_tol_spinner, 11, 1)
self.ois_simplif = OptionalInputSection(
self.simplify_cb,
[
self.simplification_tol_label, self.simplification_tol_spinner
],
logic=True)
self.layout.addStretch()