From 846e68a8c2c27e72bfec185b6710252ffa03123d Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 16 Sep 2019 05:22:07 +0300 Subject: [PATCH] - some GUI optimizations --- FlatCAMApp.py | 12 ++-- README.md | 1 + flatcamGUI/FlatCAMGUI.py | 100 +++++++++++++++++------------ flatcamGUI/ObjectUI.py | 6 +- flatcamTools/ToolNonCopperClear.py | 6 +- flatcamTools/ToolPaint.py | 6 +- 6 files changed, 80 insertions(+), 51 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index d31f44ae..1c8059f5 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -446,9 +446,6 @@ class App(QtCore.QObject): "gerber_solid": self.ui.gerber_defaults_form.gerber_gen_group.solid_cb, "gerber_multicolored": self.ui.gerber_defaults_form.gerber_gen_group.multicolored_cb, "gerber_circle_steps": self.ui.gerber_defaults_form.gerber_gen_group.circle_steps_entry, - "gerber_buffering": self.ui.gerber_defaults_form.gerber_gen_group.buffering_radio, - "gerber_simplification": self.ui.gerber_defaults_form.gerber_gen_group.simplify_cb, - "gerber_simp_tolerance": self.ui.gerber_defaults_form.gerber_gen_group.simplification_tol_spinner, # Gerber Options "gerber_isotooldia": self.ui.gerber_defaults_form.gerber_opt_group.iso_tool_dia_entry, @@ -466,6 +463,9 @@ class App(QtCore.QObject): # "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_follow": self.ui.gerber_defaults_form.gerber_adv_opt_group.follow_cb, + "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 Export "gerber_exp_units": self.ui.gerber_defaults_form.gerber_exp_group.gerber_units_radio, @@ -871,9 +871,6 @@ class App(QtCore.QObject): "gerber_multicolored": False, "gerber_circle_steps": 128, "gerber_use_buffer_for_union": True, - "gerber_buffering": "full", - "gerber_simplification": False, - "gerber_simp_tolerance": 0.0005, # Gerber Options "gerber_isotooldia": 0.00787402, @@ -891,6 +888,9 @@ class App(QtCore.QObject): "gerber_aperture_scale_factor": 1.0, "gerber_aperture_buffer_factor": 0.0, "gerber_follow": False, + "gerber_buffering": "full", + "gerber_simplification": False, + "gerber_simp_tolerance": 0.0005, # Gerber Export "gerber_exp_units": 'IN', diff --git a/README.md b/README.md index df64688c..d72b5459 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing. - modified the TclCommand New so it will no longer close all tabs when called (it closed the Code Editor tab which may have been holding the code that run) - fixed the App.on_view_source() method for CNCJob objects: the Gcode will now contain the Prepend and Append code from the Edit -> Preferences -> CNCJob -> CNCJob Options - added a new parameter named 'muted' for the TclCommands: cncjob, drillcncjob and write_gcode. Setting it as -muted 1 will disable the error reporting in TCL Shell +- some GUI optimizations 15.09.2019 diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index b6735abe..d1c6b85d 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -4442,40 +4442,6 @@ class GerberGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.circle_steps_label, 1, 0) grid0.addWidget(self.circle_steps_entry, 1, 1) - # Milling 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" - "- Full --> slow file loading but good visuals. This is the default.\n" - "<>: Don't change this unless you know what you are doing !!!") - ) - self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'}, - {'label': _('Full'), 'value': 'full'}]) - grid0.addWidget(buffering_label, 2, 0) - grid0.addWidget(self.buffering_radio, 2, 1) - - # Simplification - 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.")) - grid0.addWidget(self.simplify_cb, 3, 0) - - # Simplification tolerance - self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance')) - self.simplification_tol_label.setToolTip(_("Tolerance for poligon simplification.")) - - self.simplification_tol_spinner = FCDoubleSpinner() - self.simplification_tol_spinner.set_precision(5) - 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, 4, 0) - grid0.addWidget(self.simplification_tol_spinner, 4, 1) - self.ois_simplif = OptionalInputSection(self.simplify_cb, - [self.simplification_tol_label, self.simplification_tol_spinner], - logic=True) self.layout.addStretch() @@ -4525,7 +4491,11 @@ class GerberOptPrefGroupUI(OptionsGroupUI): "A value here of 0.25 means an overlap of 25%% from the tool diameter found above.") ) grid0.addWidget(overlabel, 2, 0) - self.iso_overlap_entry = FloatEntry() + self.iso_overlap_entry = FCDoubleSpinner() + self.iso_overlap_entry.set_precision(3) + self.iso_overlap_entry.setWrapping(True) + self.iso_overlap_entry.setRange(0.000, 0.999) + self.iso_overlap_entry.setSingleStep(0.1) grid0.addWidget(self.iso_overlap_entry, 2, 1) # Milling Type @@ -4633,7 +4603,7 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): "This means that it will cut through\n" "the middle of the trace.") ) - grid0.addWidget(self.follow_cb, 0, 0) + grid0.addWidget(self.follow_cb, 0, 0, 1, 2) # Aperture Table Visibility CB self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide')) @@ -4643,7 +4613,43 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): "that are drawn on canvas.") ) - grid0.addWidget(self.aperture_table_visibility_cb, 1, 0) + grid0.addWidget(self.aperture_table_visibility_cb, 1, 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" + "- Full --> slow file loading but good visuals. This is the default.\n" + "<>: Don't change this unless you know what you are doing !!!") + ) + self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'}, + {'label': _('Full'), 'value': 'full'}], + orientation='vertical', stretch=False) + grid0.addWidget(buffering_label, 2, 0) + grid0.addWidget(self.buffering_radio, 2, 1) + + # Simplification + 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.")) + grid0.addWidget(self.simplify_cb, 3, 0, 1, 2) + + # Simplification tolerance + self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance')) + self.simplification_tol_label.setToolTip(_("Tolerance for poligon simplification.")) + + self.simplification_tol_spinner = FCDoubleSpinner() + self.simplification_tol_spinner.set_precision(5) + 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, 4, 0) + grid0.addWidget(self.simplification_tol_spinner, 4, 1) + self.ois_simplif = OptionalInputSection(self.simplify_cb, + [self.simplification_tol_label, self.simplification_tol_spinner], + logic=True) # Scale Aperture Factor # self.scale_aperture_label = QtWidgets.QLabel(_('Ap. Scale Factor:')) @@ -5141,7 +5147,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): 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(self.update_excellon_cb, 2, 0, 1, 2) grid2.addWidget(QtWidgets.QLabel(""), 3, 0) @@ -5161,8 +5167,10 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): ) grid2.addWidget(self.excellon_optimization_label, 5, 0) - self.excellon_optimization_radio = RadioSet([{'label': _('MH'), 'value': 'M'}, - {'label': _('Basic'), 'value': 'B'}]) + self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'}, + {'label': _('Basic'), 'value': 'B'}, + {'label': _('TSA'), 'value': 'T'}], + orientation='vertical', stretch=False) self.excellon_optimization_radio.setToolTip( _("This sets the optimization type for the Excellon drill path.\n" "If MH is checked then Google OR-Tools algorithm with MetaHeuristic\n" @@ -6705,8 +6713,12 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI): "Higher values = slow processing and slow execution on CNC\n" "due of too many paths.") ) + self.ncc_overlap_entry = FCDoubleSpinner() + self.ncc_overlap_entry.set_precision(3) + self.ncc_overlap_entry.setWrapping(True) + self.ncc_overlap_entry.setRange(0.000, 0.999) + self.ncc_overlap_entry.setSingleStep(0.1) grid0.addWidget(nccoverlabel, 7, 0) - self.ncc_overlap_entry = FloatEntry() grid0.addWidget(self.ncc_overlap_entry, 7, 1) # Margin entry @@ -7050,8 +7062,12 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI): "Higher values = slow processing and slow execution on CNC\n" "due of too many paths.") ) + self.paintoverlap_entry = FCDoubleSpinner() + self.paintoverlap_entry.set_precision(3) + self.paintoverlap_entry.setWrapping(True) + self.paintoverlap_entry.setRange(0.000, 0.999) + self.paintoverlap_entry.setSingleStep(0.1) grid0.addWidget(ovlabel, 2, 0) - self.paintoverlap_entry = LengthEntry() grid0.addWidget(self.paintoverlap_entry, 2, 1) # Margin diff --git a/flatcamGUI/ObjectUI.py b/flatcamGUI/ObjectUI.py index f1d98791..94856810 100644 --- a/flatcamGUI/ObjectUI.py +++ b/flatcamGUI/ObjectUI.py @@ -292,7 +292,11 @@ class GerberObjectUI(ObjectUI): "A value here of 0.25 means an overlap of 25%% from the tool diameter found above.") ) overlabel.setMinimumWidth(90) - self.iso_overlap_entry = FloatEntry() + self.iso_overlap_entry = FCDoubleSpinner() + self.iso_overlap_entry.set_precision(3) + self.iso_overlap_entry.setWrapping(True) + self.iso_overlap_entry.setRange(0.000, 0.999) + self.iso_overlap_entry.setSingleStep(0.1) grid1.addWidget(overlabel, 2, 0) grid1.addWidget(self.iso_overlap_entry, 2, 1, 1, 2) diff --git a/flatcamTools/ToolNonCopperClear.py b/flatcamTools/ToolNonCopperClear.py index 20570378..ba00f92e 100644 --- a/flatcamTools/ToolNonCopperClear.py +++ b/flatcamTools/ToolNonCopperClear.py @@ -292,7 +292,11 @@ class NonCopperClear(FlatCAMTool, Gerber): "Higher values = slow processing and slow execution on CNC\n" "due of too many paths.") ) - self.ncc_overlap_entry = FCEntry() + self.ncc_overlap_entry = FCDoubleSpinner() + self.ncc_overlap_entry.set_precision(3) + self.ncc_overlap_entry.setWrapping(True) + self.ncc_overlap_entry.setRange(0.000, 0.999) + self.ncc_overlap_entry.setSingleStep(0.1) grid3.addWidget(nccoverlabel, 2, 0) grid3.addWidget(self.ncc_overlap_entry, 2, 1) diff --git a/flatcamTools/ToolPaint.py b/flatcamTools/ToolPaint.py index e91fb482..e60c92e8 100644 --- a/flatcamTools/ToolPaint.py +++ b/flatcamTools/ToolPaint.py @@ -214,8 +214,12 @@ class ToolPaint(FlatCAMTool, Gerber): "Higher values = slow processing and slow execution on CNC\n" "due of too many paths.") ) + self.paintoverlap_entry = FCDoubleSpinner() + self.paintoverlap_entry.set_precision(3) + self.paintoverlap_entry.setWrapping(True) + self.paintoverlap_entry.setRange(0.000, 0.999) + self.paintoverlap_entry.setSingleStep(0.1) grid3.addWidget(ovlabel, 1, 0) - self.paintoverlap_entry = FCEntry() grid3.addWidget(self.paintoverlap_entry, 1, 1) # Margin