From 23cf31f4f022fe8068aec716fa99fddfcf8107ec Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sat, 14 Sep 2019 14:59:39 +0300 Subject: [PATCH] - whenever the user changes the Excellon format values for loading files, the Export Excellon Format values will be updated --- FlatCAMApp.py | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 55 insertions(+) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 9d66e7fc..fcb36765 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -1828,6 +1828,21 @@ 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) + # 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( self.on_excellon_defaults_button) @@ -5134,6 +5149,45 @@ class App(QtCore.QObject): self.options_form_fields["excellon_units"].set_value('INCH') log.debug("Excellon options defaults loaded ...") + def on_excellon_format_changed(self): + """ + Slot activated when the user changes the Excellon format values in Preferences -> Excellon -> Excellon General + :return: None + """ + if self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.get_value().upper() == 'METRIC': + self.ui.excellon_defaults_form.excellon_exp_group.format_whole_entry.set_value( + self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.get_value() + ) + self.ui.excellon_defaults_form.excellon_exp_group.format_dec_entry.set_value( + self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.get_value() + ) + else: + self.ui.excellon_defaults_form.excellon_exp_group.format_whole_entry.set_value( + self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.get_value() + ) + self.ui.excellon_defaults_form.excellon_exp_group.format_dec_entry.set_value( + self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.get_value() + ) + + def on_excellon_zeros_changed(self): + """ + Slot activated when the user changes the Excellon zeros values in Preferences -> Excellon -> Excellon General + :return: None + """ + self.ui.excellon_defaults_form.excellon_exp_group.zeros_radio.set_value( + self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio.get_value() + 'Z' + ) + + def on_excellon_units_changed(self): + """ + Slot activated when the user changes the Excellon unit values in Preferences -> Excellon -> Excellon General + :return: None + """ + self.ui.excellon_defaults_form.excellon_exp_group.excellon_units_radio.set_value( + self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio.get_value() + ) + self.on_excellon_format_changed() + # Setting plot colors handlers def on_pf_color_entry(self): self.defaults['global_plot_fill'] = \ diff --git a/README.md b/README.md index 1555e474..05a08f10 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ CAD program, and create G-Code for Isolation routing. - added a new shortcut key F5 for doing the 'Plot All' - 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 13.09.2019