- made optional the behavior of Excellon Export values following the values in the Excellon Loading section

This commit is contained in:
Marius Stanciu 2019-09-14 15:33:50 +03:00 committed by Marius
parent 23cf31f4f0
commit 0e75352266
3 changed files with 111 additions and 20 deletions

View File

@ -504,6 +504,7 @@ class App(QtCore.QObject):
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry,
"excellon_zeros": self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio,
"excellon_units": self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio,
"excellon_update": self.ui.excellon_defaults_form.excellon_gen_group.update_excellon_cb,
"excellon_optimization_type": self.ui.excellon_defaults_form.excellon_gen_group.excellon_optimization_radio,
"excellon_search_time": self.ui.excellon_defaults_form.excellon_gen_group.optimization_time_entry,
@ -907,6 +908,7 @@ class App(QtCore.QObject):
"excellon_format_lower_mm": 3,
"excellon_zeros": "L",
"excellon_units": "INCH",
"excellon_update": True,
"excellon_optimization_type": 'B',
"excellon_search_time": 3,
@ -1828,20 +1830,13 @@ class App(QtCore.QObject):
# Monitor the checkbox from the Application Defaults Tab and show the TCL shell or not depending on it's value
self.ui.general_defaults_form.general_app_group.shell_startup_cb.clicked.connect(self.on_toggle_shell)
# make sure that when the Excellon loading parameters are changed, the change is reflected in the
# Export Excellon paraemters. That's because users expect to load the exported file and show correctly
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.textChanged.connect(
self.on_excellon_format_changed)
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.textChanged.connect(
self.on_excellon_format_changed)
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.textChanged.connect(
self.on_excellon_format_changed)
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.textChanged.connect(
self.on_excellon_format_changed)
self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio.activated_custom.connect(
self.on_excellon_zeros_changed)
self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.activated_custom.connect(
self.on_excellon_units_changed)
# Make sure that when the Excellon loading parameters are changed, the change is reflected in the
# Export Excellon parameters.
self.ui.excellon_defaults_form.excellon_gen_group.update_excellon_cb.stateChanged.connect(
self.on_update_exc_export
)
# call it once to make sure it is updated at startup
self.on_update_exc_export(state=self.defaults["excellon_update"])
# Load the defaults values into the Excellon Format and Excellon Zeros fields
self.ui.excellon_defaults_form.excellon_opt_group.excellon_defaults_button.clicked.connect(
@ -5149,6 +5144,95 @@ class App(QtCore.QObject):
self.options_form_fields["excellon_units"].set_value('INCH')
log.debug("Excellon options defaults loaded ...")
def on_update_exc_export(self, state):
"""
This is handling the update of Excellon Export parameters based on the ones in the Excellon General but only
if the update_excellon_cb checkbox is checked
:param state: state of the checkbox whose signals is tied to his slot
:return:
"""
if state:
# first try to disconnect
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.textChanged.\
disconnect(self.on_excellon_format_changed)
except TypeError:
pass
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.textChanged.\
disconnect(self.on_excellon_format_changed)
except TypeError:
pass
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.textChanged.\
disconnect(self.on_excellon_format_changed)
except TypeError:
pass
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.textChanged.\
disconnect(self.on_excellon_format_changed)
except TypeError:
pass
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio.activated_custom.\
disconnect(self.on_excellon_zeros_changed)
except TypeError:
pass
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.activated_custom.\
disconnect(self.on_excellon_zeros_changed)
except TypeError:
pass
# the connect them
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.textChanged.connect(
self.on_excellon_format_changed)
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.textChanged.connect(
self.on_excellon_format_changed)
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.textChanged.connect(
self.on_excellon_format_changed)
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.textChanged.connect(
self.on_excellon_format_changed)
self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio.activated_custom.connect(
self.on_excellon_zeros_changed)
self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.activated_custom.connect(
self.on_excellon_units_changed)
else:
# disconnect the signals
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.textChanged. \
disconnect(self.on_excellon_format_changed)
except TypeError:
pass
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.textChanged. \
disconnect(self.on_excellon_format_changed)
except TypeError:
pass
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.textChanged. \
disconnect(self.on_excellon_format_changed)
except TypeError:
pass
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.textChanged. \
disconnect(self.on_excellon_format_changed)
except TypeError:
pass
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio.activated_custom. \
disconnect(self.on_excellon_zeros_changed)
except TypeError:
pass
try:
self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.activated_custom. \
disconnect(self.on_excellon_zeros_changed)
except TypeError:
pass
def on_excellon_format_changed(self):
"""
Slot activated when the user changes the Excellon format values in Preferences -> Excellon -> Excellon General

View File

@ -20,6 +20,7 @@ CAD program, and create G-Code for Isolation routing.
- updated the google-translated Spanish translation strings
- fixed the layouts to include toolbars breaks where it was needed
- whenever the user changes the Excellon format values for loading files, the Export Excellon Format values will be updated
- made optional the behavior of Excellon Export values following the values in the Excellon Loading section
13.09.2019

View File

@ -5137,10 +5137,16 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
)
grid2.addWidget(self.excellon_units_radio, 1, 1)
grid2.addWidget(QtWidgets.QLabel(""), 2, 0)
self.update_excellon_cb = FCCheckBox(label=_('Update Export settings'))
self.update_excellon_cb.setToolTip(
"If checked, the Excellon Export settings will be updated with the ones above."
)
grid2.addWidget(self.update_excellon_cb, 2, 0)
grid2.addWidget(QtWidgets.QLabel(""), 3, 0)
self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Optimization"))
grid2.addWidget(self.excellon_general_label, 3, 0, 1, 2)
grid2.addWidget(self.excellon_general_label, 4, 0, 1, 2)
self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm: '))
self.excellon_optimization_label.setToolTip(
@ -5153,7 +5159,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
"If DISABLED, then FlatCAM works in 32bit mode and it uses \n"
"Travelling Salesman algorithm for path optimization.")
)
grid2.addWidget(self.excellon_optimization_label, 4, 0)
grid2.addWidget(self.excellon_optimization_label, 5, 0)
self.excellon_optimization_radio = RadioSet([{'label': _('MH'), 'value': 'M'},
{'label': _('Basic'), 'value': 'B'}])
@ -5167,7 +5173,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
"If DISABLED, then FlatCAM works in 32bit mode and it uses \n"
"Travelling Salesman algorithm for path optimization.")
)
grid2.addWidget(self.excellon_optimization_radio, 4, 1)
grid2.addWidget(self.excellon_optimization_radio, 5, 1)
self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Optimization Time'))
self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft)
@ -5178,11 +5184,11 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
"In seconds.")
)
grid2.addWidget(self.optimization_time_label, 5, 0)
grid2.addWidget(self.optimization_time_label, 6, 0)
self.optimization_time_entry = IntEntry()
self.optimization_time_entry.setValidator(QtGui.QIntValidator(0, 999))
grid2.addWidget(self.optimization_time_entry, 5, 1)
grid2.addWidget(self.optimization_time_entry, 6, 1)
current_platform = platform.architecture()[0]
if current_platform == '64bit':