move the excellon export settings sync code out of FlatCAMApp
This commit is contained in:
@@ -19,12 +19,23 @@ class ExcellonPreferencesUI(PreferencesSectionUI):
|
||||
def __init__(self, decimals, **kwargs):
|
||||
self.decimals = decimals
|
||||
self.excellon_gen_group = ExcellonGenPrefGroupUI(decimals=self.decimals)
|
||||
|
||||
# FIXME: remove the need for external access to excellon_opt_group
|
||||
self.excellon_opt_group = ExcellonOptPrefGroupUI(decimals=self.decimals)
|
||||
|
||||
self.excellon_exp_group = ExcellonExpPrefGroupUI(decimals=self.decimals)
|
||||
self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI(decimals=self.decimals)
|
||||
self.excellon_editor_group = ExcellonEditorPrefGroupUI(decimals=self.decimals)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.excellon_gen_group.excellon_format_upper_in_entry.returnPressed.connect(self.sync_export)
|
||||
self.excellon_gen_group.excellon_format_lower_in_entry.returnPressed.connect(self.sync_export)
|
||||
self.excellon_gen_group.excellon_format_upper_mm_entry.returnPressed.connect(self.sync_export)
|
||||
self.excellon_gen_group.excellon_format_lower_mm_entry.returnPressed.connect(self.sync_export)
|
||||
self.excellon_gen_group.excellon_zeros_radio.activated_custom.connect(self.sync_export)
|
||||
self.excellon_gen_group.excellon_units_radio.activated_custom.connect(self.sync_export)
|
||||
|
||||
|
||||
def build_groups(self) -> [OptionsGroupUI]:
|
||||
return [
|
||||
self.excellon_gen_group,
|
||||
@@ -40,3 +51,18 @@ class ExcellonPreferencesUI(PreferencesSectionUI):
|
||||
def get_tab_label(self):
|
||||
return _("EXCELLON")
|
||||
|
||||
def sync_export(self):
|
||||
if not self.excellon_gen_group.update_excellon_cb.get_value():
|
||||
# User has disabled sync.
|
||||
return
|
||||
|
||||
self.excellon_exp_group.zeros_radio.set_value(self.excellon_gen_group.excellon_zeros_radio.get_value() + 'Z')
|
||||
self.excellon_exp_group.excellon_units_radio.set_value(self.excellon_gen_group.excellon_units_radio.get_value())
|
||||
if self.excellon_gen_group.excellon_units_radio.get_value().upper() == 'METRIC':
|
||||
self.excellon_exp_group.format_whole_entry.set_value(self.excellon_gen_group.excellon_format_upper_mm_entry.get_value())
|
||||
self.excellon_exp_group.format_dec_entry.set_value(self.excellon_gen_group.excellon_format_lower_mm_entry.get_value())
|
||||
else:
|
||||
self.excellon_exp_group.format_whole_entry.set_value(self.excellon_gen_group.excellon_format_upper_in_entry.get_value())
|
||||
self.excellon_exp_group.format_dec_entry.set_value(self.excellon_gen_group.excellon_format_lower_in_entry.get_value())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user