diff --git a/flatcamGUI/preferences/PreferencesUIManager.py b/flatcamGUI/preferences/PreferencesUIManager.py
index e9eae026..de0a23fd 100644
--- a/flatcamGUI/preferences/PreferencesUIManager.py
+++ b/flatcamGUI/preferences/PreferencesUIManager.py
@@ -68,29 +68,6 @@ class PreferencesUIManager:
"excellon_plot_fill": self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry,
"excellon_plot_line": self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry,
- # Excellon Options
- "excellon_operation": self.ui.excellon_defaults_form.excellon_opt_group.operation_radio,
- "excellon_milling_type": self.ui.excellon_defaults_form.excellon_opt_group.milling_type_radio,
-
- "excellon_milling_dia": self.ui.excellon_defaults_form.excellon_opt_group.mill_dia_entry,
-
- "excellon_cutz": self.ui.excellon_defaults_form.excellon_opt_group.cutz_entry,
- "excellon_multidepth": self.ui.excellon_defaults_form.excellon_opt_group.mpass_cb,
- "excellon_depthperpass": self.ui.excellon_defaults_form.excellon_opt_group.maxdepth_entry,
- "excellon_travelz": self.ui.excellon_defaults_form.excellon_opt_group.travelz_entry,
- "excellon_endz": self.ui.excellon_defaults_form.excellon_opt_group.endz_entry,
- "excellon_endxy": self.ui.excellon_defaults_form.excellon_opt_group.endxy_entry,
-
- "excellon_feedrate_z": self.ui.excellon_defaults_form.excellon_opt_group.feedrate_z_entry,
- "excellon_spindlespeed": self.ui.excellon_defaults_form.excellon_opt_group.spindlespeed_entry,
- "excellon_dwell": self.ui.excellon_defaults_form.excellon_opt_group.dwell_cb,
- "excellon_dwelltime": self.ui.excellon_defaults_form.excellon_opt_group.dwelltime_entry,
- "excellon_toolchange": self.ui.excellon_defaults_form.excellon_opt_group.toolchange_cb,
- "excellon_toolchangez": self.ui.excellon_defaults_form.excellon_opt_group.toolchangez_entry,
- "excellon_ppname_e": self.ui.excellon_defaults_form.excellon_opt_group.pp_excellon_name_cb,
- "excellon_tooldia": self.ui.excellon_defaults_form.excellon_opt_group.tooldia_entry,
- "excellon_slot_tooldia": self.ui.excellon_defaults_form.excellon_opt_group.slot_tooldia_entry,
- "excellon_gcode_type": self.ui.excellon_defaults_form.excellon_opt_group.excellon_gcode_type_radio,
# Excellon Advanced Options
"excellon_offset": self.ui.excellon_defaults_form.excellon_adv_opt_group.offset_entry,
diff --git a/flatcamGUI/preferences/excellon/ExcellonOptPrefGroupUI.py b/flatcamGUI/preferences/excellon/ExcellonOptPrefGroupUI.py
index cdc6ce5e..4f68eaca 100644
--- a/flatcamGUI/preferences/excellon/ExcellonOptPrefGroupUI.py
+++ b/flatcamGUI/preferences/excellon/ExcellonOptPrefGroupUI.py
@@ -1,10 +1,7 @@
-from PyQt5 import QtWidgets
-from PyQt5.QtCore import Qt, QSettings
-
-from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCEntry, FCSpinner, OptionalInputSection, \
- FCComboBox
+from flatcamGUI.GUIElements import OptionalInputSection
from flatcamGUI.preferences import machinist_setting
-from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
+from flatcamGUI.preferences.OptionUI import *
+from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI2
import gettext
import FlatCAMTranslation as fcTranslate
import builtins
@@ -20,298 +17,182 @@ else:
machinist_setting = 0
-class ExcellonOptPrefGroupUI(OptionsGroupUI):
+class ExcellonOptPrefGroupUI(OptionsGroupUI2):
- def __init__(self, decimals=4, parent=None):
- # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
- super(ExcellonOptPrefGroupUI, self).__init__(self, parent=parent)
-
- self.setTitle(str(_("Excellon Options")))
+ def __init__(self, decimals=4, **kwargs):
self.decimals = decimals
+ super().__init__(**kwargs)
+ self.setTitle(str(_("Excellon Options")))
- # ## Create CNC Job
- self.cncjob_label = QtWidgets.QLabel('%s' % _('Create CNC Job'))
- self.cncjob_label.setToolTip(
- _("Parameters used to create a CNC Job object\n"
- "for this drill object.")
- )
- self.layout.addWidget(self.cncjob_label)
+ self.pp_excellon_name_cb = self.option_dict()["excellon_ppname_e"].get_field()
- grid2 = QtWidgets.QGridLayout()
- self.layout.addLayout(grid2)
- grid2.setColumnStretch(0, 0)
- grid2.setColumnStretch(1, 1)
+ self.multidepth_cb = self.option_dict()["excellon_multidepth"].get_field()
+ self.depthperpass_entry = self.option_dict()["excellon_depthperpass"].get_field()
+ self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
- # Operation Type
- self.operation_label = QtWidgets.QLabel('%s:' % _('Operation'))
- self.operation_label.setToolTip(
- _("Operation type:\n"
- "- Drilling -> will drill the drills/slots associated with this tool\n"
- "- Milling -> will mill the drills/slots")
- )
- self.operation_radio = RadioSet(
- [
- {'label': _('Drilling'), 'value': 'drill'},
- {'label': _("Milling"), 'value': 'mill'}
- ]
- )
+ self.dwell_cb = self.option_dict()["excellon_dwell"].get_field()
+ self.dwelltime_entry = self.option_dict()["excellon_dwelltime"].get_field()
+ self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
- grid2.addWidget(self.operation_label, 0, 0)
- grid2.addWidget(self.operation_radio, 0, 1)
+ # FIXME until this feature is implemented these are disabled
+ self.option_dict()["excellon_gcode_type"].label_widget.hide()
+ self.option_dict()["excellon_gcode_type"].get_field().hide()
- self.mill_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
- self.mill_type_label.setToolTip(
- _("Milling type:\n"
- "- Drills -> will mill the drills associated with this tool\n"
- "- Slots -> will mill the slots associated with this tool\n"
- "- Both -> will mill both drills and mills or whatever is available")
- )
- self.milling_type_radio = RadioSet(
- [
- {'label': _('Drills'), 'value': 'drills'},
- {'label': _("Slots"), 'value': 'slots'},
- {'label': _("Both"), 'value': 'both'},
- ]
- )
+ def build_options(self) -> [OptionUI]:
+ return [
+ HeadingOptionUI(
+ label_text="Create CNC Job",
+ label_tooltip="Parameters used to create a CNC Job object\n"
+ "for this drill object."
+ ),
+ RadioSetOptionUI(
+ option="excellon_operation",
+ label_text="Operation",
+ label_bold=True,
+ label_tooltip="Operation type:\n"
+ "- Drilling -> will drill the drills/slots associated with this tool\n"
+ "- Milling -> will mill the drills/slots",
+ choices=[
+ {'label': _('Drilling'), 'value': 'drill'},
+ {'label': _("Milling"), 'value': 'mill'}
+ ]
+ ),
+ RadioSetOptionUI(
+ option="excellon_milling_type",
+ label_text="Milling Type",
+ label_tooltip="Milling type:\n"
+ "- Drills -> will mill the drills associated with this tool\n"
+ "- Slots -> will mill the slots associated with this tool\n"
+ "- Both -> will mill both drills and mills or whatever is available",
+ choices=[
+ {'label': _('Drills'), 'value': 'drills'},
+ {'label': _("Slots"), 'value': 'slots'},
+ {'label': _("Both"), 'value': 'both'},
+ ]
+ ),
+ DoubleSpinnerOptionUI(
+ option="excellon_milling_dia",
+ label_text="Milling Diameter",
+ label_tooltip="The diameter of the tool who will do the milling",
+ min_value=0.0, max_value=9999.9999, step=0.1, decimals=self.decimals
+ ),
+ DoubleSpinnerOptionUI(
+ option="excellon_cutz",
+ label_text="Cut Z",
+ label_tooltip="Drill depth (negative) \nbelow the copper surface.",
+ min_value=-9999.9999, max_value=(9999.9999 if machinist_setting else 0.0),
+ step=0.1, decimals=self.decimals
+ ),
- grid2.addWidget(self.mill_type_label, 1, 0)
- grid2.addWidget(self.milling_type_radio, 1, 1)
- self.mill_dia_label = QtWidgets.QLabel('%s:' % _('Milling Diameter'))
- self.mill_dia_label.setToolTip(
- _("The diameter of the tool who will do the milling")
- )
+ CheckboxOptionUI(
+ option="excellon_multidepth",
+ label_text="Multi-Depth",
+ label_tooltip="Use multiple passes to limit\n"
+ "the cut depth in each pass. Will\n"
+ "cut multiple times until Cut Z is\n"
+ "reached."
+ ),
+ DoubleSpinnerOptionUI(
+ option="excellon_depthperpass",
+ label_text="Depth/Pass",
+ label_tooltip="Depth of each pass (positive).",
+ min_value=0, max_value=99999, step=0.1, decimals=self.decimals
+ ),
+ DoubleSpinnerOptionUI(
+ option="excellon_travelz",
+ label_text="Travel Z",
+ label_tooltip="Tool height when travelling\nacross the XY plane.",
+ min_value=(-9999.9999 if machinist_setting else 0.0001), max_value=9999.9999,
+ step=0.1, decimals=self.decimals
+ ),
+ CheckboxOptionUI(
+ option="excellon_toolchange",
+ label_text="Tool change",
+ label_tooltip="Include tool-change sequence\nin G-Code (Pause for tool change)."
+ ),
+ DoubleSpinnerOptionUI(
+ option="excellon_toolchangez",
+ label_text="Toolchange Z",
+ label_tooltip="Z-axis position (height) for\ntool change.",
+ min_value=(-9999.9999 if machinist_setting else 0.0), max_value=9999.9999,
+ step=0.1, decimals=self.decimals
+ ),
+ DoubleSpinnerOptionUI(
+ option="excellon_endz",
+ label_text="End move Z",
+ label_tooltip="Height of the tool after\nthe last move at the end of the job.",
+ min_value=(-9999.9999 if machinist_setting else 0.0), max_value=9999.9999,
+ step=0.1, decimals=self.decimals
+ ),
+ LineEntryOptionUI(
+ option="excellon_endxy",
+ label_text="End move X,Y",
+ label_tooltip="End move X,Y position. In format (x,y).\n"
+ "If no value is entered then there is no move\n"
+ "on X,Y plane at the end of the job."
+ ),
+ DoubleSpinnerOptionUI(
+ option="excellon_feedrate_z",
+ label_text="Feedrate Z",
+ label_tooltip="Tool speed while drilling\n"
+ "(in units per minute).\n"
+ "So called 'Plunge' feedrate.\n"
+ "This is for linear move G01.",
+ min_value=0, max_value=99999.9999, step=0.1, decimals=self.decimals
+ ),
+ SpinnerOptionUI(
+ option="excellon_spindlespeed",
+ label_text="Spindle speed",
+ label_tooltip="Speed of the spindle in RPM (optional).",
+ min_value=0, max_value=1000000, step=100
+ ),
+ CheckboxOptionUI(
+ option="excellon_dwell",
+ label_text="Enable Dwell",
+ label_tooltip="Pause to allow the spindle to reach its\nspeed before cutting."
+ ),
+ DoubleSpinnerOptionUI(
+ option="excellon_dwelltime",
+ label_text="Duration",
+ label_tooltip="Number of time units for spindle to dwell.",
+ min_value=0, max_value=999999, step=0.5, decimals=self.decimals
+ ),
+ ComboboxOptionUI(
+ option="excellon_ppname_e",
+ label_text="Preprocessor",
+ label_tooltip="The preprocessor JSON file that dictates\nGcode output.", # FIXME tooltip incorrect?
+ choices=[] # Populated in App (FIXME)
+ ),
+ RadioSetOptionUI(
+ option="excellon_gcode_type",
+ label_text="Gcode",
+ label_bold=True,
+ label_tooltip="Choose what to use for GCode generation:\n"
+ "'Drills', 'Slots' or 'Both'.\n"
+ "When choosing 'Slots' or 'Both', slots will be\n"
+ "converted to drills.",
+ choices=[
+ {'label': 'Drills', 'value': 'drills'},
+ {'label': 'Slots', 'value': 'slots'},
+ {'label': 'Both', 'value': 'both'}
+ ]
+ ),
- self.mill_dia_entry = FCDoubleSpinner()
- self.mill_dia_entry.set_precision(self.decimals)
- self.mill_dia_entry.set_range(0.0000, 9999.9999)
-
- grid2.addWidget(self.mill_dia_label, 2, 0)
- grid2.addWidget(self.mill_dia_entry, 2, 1)
-
- # Cut Z
- cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
- cutzlabel.setToolTip(
- _("Drill depth (negative)\n"
- "below the copper surface.")
- )
-
- self.cutz_entry = FCDoubleSpinner()
-
- if machinist_setting == 0:
- self.cutz_entry.set_range(-9999.9999, 0.0000)
- else:
- self.cutz_entry.set_range(-9999.9999, 9999.9999)
-
- self.cutz_entry.setSingleStep(0.1)
- self.cutz_entry.set_precision(self.decimals)
-
- grid2.addWidget(cutzlabel, 3, 0)
- grid2.addWidget(self.cutz_entry, 3, 1)
-
- # Multi-Depth
- self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
- self.mpass_cb.setToolTip(
- _(
- "Use multiple passes to limit\n"
- "the cut depth in each pass. Will\n"
- "cut multiple times until Cut Z is\n"
- "reached."
+ HeadingOptionUI(
+ label_text="Mill Holes",
+ label_tooltip="Create Geometry for milling holes."
+ ),
+ DoubleSpinnerOptionUI(
+ option="excellon_tooldia",
+ label_text="Drill Tool dia",
+ label_tooltip="Diameter of the cutting tool",
+ min_value=0.0, max_value=999.9999, step=0.1, decimals=self.decimals
+ ),
+ DoubleSpinnerOptionUI(
+ option="excellon_slot_tooldia",
+ label_text="Slot Tool dia",
+ label_tooltip="Diameter of the cutting tool\nwhen milling slots.",
+ min_value=0.0, max_value=999.9999, step=0.1, decimals=self.decimals
)
- )
-
- self.maxdepth_entry = FCDoubleSpinner()
- self.maxdepth_entry.set_precision(self.decimals)
- self.maxdepth_entry.set_range(0, 9999.9999)
- self.maxdepth_entry.setSingleStep(0.1)
-
- self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
-
- grid2.addWidget(self.mpass_cb, 4, 0)
- grid2.addWidget(self.maxdepth_entry, 4, 1)
-
- # Travel Z
- travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
- travelzlabel.setToolTip(
- _("Tool height when travelling\n"
- "across the XY plane.")
- )
-
- self.travelz_entry = FCDoubleSpinner()
- self.travelz_entry.set_precision(self.decimals)
-
- if machinist_setting == 0:
- self.travelz_entry.set_range(0.0001, 9999.9999)
- else:
- self.travelz_entry.set_range(-9999.9999, 9999.9999)
-
- grid2.addWidget(travelzlabel, 5, 0)
- grid2.addWidget(self.travelz_entry, 5, 1)
-
- # Tool change:
- self.toolchange_cb = FCCheckBox('%s' % _("Tool change"))
- self.toolchange_cb.setToolTip(
- _("Include tool-change sequence\n"
- "in G-Code (Pause for tool change).")
- )
- grid2.addWidget(self.toolchange_cb, 6, 0, 1, 2)
-
- # Tool Change Z
- toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
- toolchangezlabel.setToolTip(
- _("Z-axis position (height) for\n"
- "tool change.")
- )
-
- self.toolchangez_entry = FCDoubleSpinner()
- self.toolchangez_entry.set_precision(self.decimals)
-
- if machinist_setting == 0:
- self.toolchangez_entry.set_range(0.0001, 9999.9999)
- else:
- self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
-
- grid2.addWidget(toolchangezlabel, 7, 0)
- grid2.addWidget(self.toolchangez_entry, 7, 1)
-
- # End Move Z
- endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
- endz_label.setToolTip(
- _("Height of the tool after\n"
- "the last move at the end of the job.")
- )
- self.endz_entry = FCDoubleSpinner()
- self.endz_entry.set_precision(self.decimals)
-
- if machinist_setting == 0:
- self.endz_entry.set_range(0.0000, 9999.9999)
- else:
- self.endz_entry.set_range(-9999.9999, 9999.9999)
-
- grid2.addWidget(endz_label, 8, 0)
- grid2.addWidget(self.endz_entry, 8, 1)
-
- # End Move X,Y
- endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
- endmove_xy_label.setToolTip(
- _("End move X,Y position. In format (x,y).\n"
- "If no value is entered then there is no move\n"
- "on X,Y plane at the end of the job.")
- )
- self.endxy_entry = FCEntry()
-
- grid2.addWidget(endmove_xy_label, 9, 0)
- grid2.addWidget(self.endxy_entry, 9, 1)
-
- # Feedrate Z
- frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
- frlabel.setToolTip(
- _("Tool speed while drilling\n"
- "(in units per minute).\n"
- "So called 'Plunge' feedrate.\n"
- "This is for linear move G01.")
- )
- self.feedrate_z_entry = FCDoubleSpinner()
- self.feedrate_z_entry.set_precision(self.decimals)
- self.feedrate_z_entry.set_range(0, 99999.9999)
-
- grid2.addWidget(frlabel, 10, 0)
- grid2.addWidget(self.feedrate_z_entry, 10, 1)
-
- # Spindle speed
- spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
- spdlabel.setToolTip(
- _("Speed of the spindle\n"
- "in RPM (optional)")
- )
-
- self.spindlespeed_entry = FCSpinner()
- self.spindlespeed_entry.set_range(0, 1000000)
- self.spindlespeed_entry.set_step(100)
-
- grid2.addWidget(spdlabel, 11, 0)
- grid2.addWidget(self.spindlespeed_entry, 11, 1)
-
- # Dwell
- self.dwell_cb = FCCheckBox('%s' % _('Enable Dwell'))
- self.dwell_cb .setToolTip(
- _("Pause to allow the spindle to reach its\n"
- "speed before cutting.")
- )
-
- grid2.addWidget(self.dwell_cb, 12, 0, 1, 2)
-
- # Dwell Time
- dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
- dwelltime.setToolTip(_("Number of time units for spindle to dwell."))
- self.dwelltime_entry = FCDoubleSpinner()
- self.dwelltime_entry.set_precision(self.decimals)
- self.dwelltime_entry.set_range(0, 99999.9999)
-
- grid2.addWidget(dwelltime, 13, 0)
- grid2.addWidget(self.dwelltime_entry, 13, 1)
-
- self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
-
- # preprocessor selection
- pp_excellon_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
- pp_excellon_label.setToolTip(
- _("The preprocessor JSON file that dictates\n"
- "Gcode output.")
- )
-
- self.pp_excellon_name_cb = FCComboBox()
- self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
-
- grid2.addWidget(pp_excellon_label, 14, 0)
- grid2.addWidget(self.pp_excellon_name_cb, 14, 1)
-
- # ### Choose what to use for Gcode creation: Drills, Slots or Both
- excellon_gcode_type_label = QtWidgets.QLabel('%s' % _('Gcode'))
- excellon_gcode_type_label.setToolTip(
- _("Choose what to use for GCode generation:\n"
- "'Drills', 'Slots' or 'Both'.\n"
- "When choosing 'Slots' or 'Both', slots will be\n"
- "converted to drills.")
- )
- self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
- {'label': 'Slots', 'value': 'slots'},
- {'label': 'Both', 'value': 'both'}])
- grid2.addWidget(excellon_gcode_type_label, 15, 0)
- grid2.addWidget(self.excellon_gcode_type_radio, 15, 1)
-
- # until I decide to implement this feature those remain disabled
- excellon_gcode_type_label.hide()
- self.excellon_gcode_type_radio.setVisible(False)
-
- # ### Milling Holes ## ##
- self.mill_hole_label = QtWidgets.QLabel('%s' % _('Mill Holes'))
- self.mill_hole_label.setToolTip(
- _("Create Geometry for milling holes.")
- )
- grid2.addWidget(self.mill_hole_label, 16, 0, 1, 2)
-
- tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
- tdlabel.setToolTip(
- _("Diameter of the cutting tool.")
- )
- self.tooldia_entry = FCDoubleSpinner()
- self.tooldia_entry.set_precision(self.decimals)
- self.tooldia_entry.set_range(0, 999.9999)
-
- grid2.addWidget(tdlabel, 18, 0)
- grid2.addWidget(self.tooldia_entry, 18, 1)
-
- stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
- stdlabel.setToolTip(
- _("Diameter of the cutting tool\n"
- "when milling slots.")
- )
- self.slot_tooldia_entry = FCDoubleSpinner()
- self.slot_tooldia_entry.set_precision(self.decimals)
- self.slot_tooldia_entry.set_range(0, 999.9999)
-
- grid2.addWidget(stdlabel, 21, 0)
- grid2.addWidget(self.slot_tooldia_entry, 21, 1)
-
- self.layout.addStretch()
+ ]
diff --git a/flatcamGUI/preferences/excellon/ExcellonPreferencesUI.py b/flatcamGUI/preferences/excellon/ExcellonPreferencesUI.py
index 01616d37..e3584129 100644
--- a/flatcamGUI/preferences/excellon/ExcellonPreferencesUI.py
+++ b/flatcamGUI/preferences/excellon/ExcellonPreferencesUI.py
@@ -6,6 +6,13 @@ from flatcamGUI.preferences.excellon.ExcellonAdvOptPrefGroupUI import ExcellonAd
from flatcamGUI.preferences.excellon.ExcellonOptPrefGroupUI import ExcellonOptPrefGroupUI
from flatcamGUI.preferences.excellon.ExcellonGenPrefGroupUI import ExcellonGenPrefGroupUI
+import gettext
+import FlatCAMTranslation as fcTranslate
+import builtins
+fcTranslate.apply_language('strings')
+if '_' not in builtins.__dict__:
+ _ = gettext.gettext
+
class ExcellonPreferencesUI(PreferencesSectionUI):