From f85be8d095269b712728aa9fbbeaf395415b36e5 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sat, 27 Feb 2021 02:08:17 +0200 Subject: [PATCH] - added possibility of changing the Axis color and created a new parameter for that in Preferences - some refactoring - in a FCColorEntry GUI element, setting a color in the Color dialog will trigger the editingFinished signal therefore propagating the changes --- CHANGELOG.md | 6 + appGUI/GUIElements.py | 1 + appGUI/PlotCanvas.py | 46 ++++++- appGUI/PlotCanvasLegacy.py | 36 +++++- appGUI/preferences/PreferencesUIManager.py | 2 + .../general/GeneralAPPSetGroupUI.py | 116 +++++++++++------- {appTools => appPlugins}/ToolAlignObjects.py | 0 {appTools => appPlugins}/ToolCalculators.py | 0 {appTools => appPlugins}/ToolCalibration.py | 0 .../ToolCopperThieving.py | 0 {appTools => appPlugins}/ToolCorners.py | 0 {appTools => appPlugins}/ToolCutOut.py | 0 {appTools => appPlugins}/ToolDblSided.py | 0 {appTools => appPlugins}/ToolDistance.py | 0 {appTools => appPlugins}/ToolDistanceMin.py | 0 {appTools => appPlugins}/ToolDrilling.py | 0 .../ToolEtchCompensation.py | 0 {appTools => appPlugins}/ToolExtract.py | 0 {appTools => appPlugins}/ToolFiducials.py | 0 {appTools => appPlugins}/ToolFilm.py | 0 {appTools => appPlugins}/ToolFollow.py | 0 {appTools => appPlugins}/ToolImage.py | 0 {appTools => appPlugins}/ToolInvertGerber.py | 0 {appTools => appPlugins}/ToolIsolation.py | 0 {appTools => appPlugins}/ToolLevelling.py | 0 {appTools => appPlugins}/ToolMilling.py | 0 {appTools => appPlugins}/ToolMove.py | 0 {appTools => appPlugins}/ToolNCC.py | 0 {appTools => appPlugins}/ToolOptimal.py | 0 {appTools => appPlugins}/ToolPDF.py | 0 {appTools => appPlugins}/ToolPaint.py | 0 {appTools => appPlugins}/ToolPanelize.py | 0 {appTools => appPlugins}/ToolPcbWizard.py | 0 {appTools => appPlugins}/ToolPunchGerber.py | 0 {appTools => appPlugins}/ToolQRCode.py | 0 {appTools => appPlugins}/ToolReport.py | 0 {appTools => appPlugins}/ToolRulesCheck.py | 0 {appTools => appPlugins}/ToolShell.py | 0 {appTools => appPlugins}/ToolSolderPaste.py | 0 {appTools => appPlugins}/ToolSub.py | 0 {appTools => appPlugins}/ToolTransform.py | 0 appPlugins/__init__.py | 48 ++++++++ appTools/__init__.py | 48 -------- app_Main.py | 2 +- defaults.py | 1 + 45 files changed, 204 insertions(+), 102 deletions(-) rename {appTools => appPlugins}/ToolAlignObjects.py (100%) rename {appTools => appPlugins}/ToolCalculators.py (100%) rename {appTools => appPlugins}/ToolCalibration.py (100%) rename {appTools => appPlugins}/ToolCopperThieving.py (100%) rename {appTools => appPlugins}/ToolCorners.py (100%) rename {appTools => appPlugins}/ToolCutOut.py (100%) rename {appTools => appPlugins}/ToolDblSided.py (100%) rename {appTools => appPlugins}/ToolDistance.py (100%) rename {appTools => appPlugins}/ToolDistanceMin.py (100%) rename {appTools => appPlugins}/ToolDrilling.py (100%) rename {appTools => appPlugins}/ToolEtchCompensation.py (100%) rename {appTools => appPlugins}/ToolExtract.py (100%) rename {appTools => appPlugins}/ToolFiducials.py (100%) rename {appTools => appPlugins}/ToolFilm.py (100%) rename {appTools => appPlugins}/ToolFollow.py (100%) rename {appTools => appPlugins}/ToolImage.py (100%) rename {appTools => appPlugins}/ToolInvertGerber.py (100%) rename {appTools => appPlugins}/ToolIsolation.py (100%) rename {appTools => appPlugins}/ToolLevelling.py (100%) rename {appTools => appPlugins}/ToolMilling.py (100%) rename {appTools => appPlugins}/ToolMove.py (100%) rename {appTools => appPlugins}/ToolNCC.py (100%) rename {appTools => appPlugins}/ToolOptimal.py (100%) rename {appTools => appPlugins}/ToolPDF.py (100%) rename {appTools => appPlugins}/ToolPaint.py (100%) rename {appTools => appPlugins}/ToolPanelize.py (100%) rename {appTools => appPlugins}/ToolPcbWizard.py (100%) rename {appTools => appPlugins}/ToolPunchGerber.py (100%) rename {appTools => appPlugins}/ToolQRCode.py (100%) rename {appTools => appPlugins}/ToolReport.py (100%) rename {appTools => appPlugins}/ToolRulesCheck.py (100%) rename {appTools => appPlugins}/ToolShell.py (100%) rename {appTools => appPlugins}/ToolSolderPaste.py (100%) rename {appTools => appPlugins}/ToolSub.py (100%) rename {appTools => appPlugins}/ToolTransform.py (100%) create mode 100644 appPlugins/__init__.py delete mode 100644 appTools/__init__.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 61c16e3f..f7fd0229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ CHANGELOG for FlatCAM beta ================================================= +27.01.2021 + +- added possibility of changing the Axis color and created a new parameter for that in Preferences +- some refactoring +- in a FCColorEntry GUI element, setting a color in the Color dialog will trigger the editingFinished signal therefore propagating the changes + 26.02.2021 - fixes in Drilling & Milling Plugins for the error: "RuntimeError: wrapped C/C++ object of type ... has been deleted" diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index dbe42a77..81ac8d44 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -857,6 +857,7 @@ class FCColorEntry(QtWidgets.QFrame): new_value = str(selected_color.name()) + self._extract_alpha(value) self.set_value(new_value) + self.editingFinished.emit() def _extract_color(self, value: str) -> str: return value[:7] diff --git a/appGUI/PlotCanvas.py b/appGUI/PlotCanvas.py index 2f260fe7..fbe134b3 100644 --- a/appGUI/PlotCanvas.py +++ b/appGUI/PlotCanvas.py @@ -127,11 +127,19 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): self.create_native() self.native.setParent(self.fcapp.ui) - # ## AXIS # ## - self.v_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 0.8), vertical=True, - parent=self.view.scene) + axis_default_color = self.fcapp.defaults['global_axis_color'] + self.axis_transparency = 0.8 - self.h_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 0.8), vertical=False, + axis_color = self.color_hex2tuple(axis_default_color) + axis_color = axis_color[0], axis_color[1], axis_color[2], self.axis_transparency + + # ## AXIS # ## + # self.v_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 0.8), vertical=True, + # parent=self.view.scene) + + self.v_line = InfiniteLine(pos=0, color=axis_color, vertical=True, + parent=self.view.scene) + self.h_line = InfiniteLine(pos=0, color=axis_color, vertical=False, parent=self.view.scene) self.line_parent = None @@ -220,6 +228,17 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): # # self.container.addWidget(self.native) + @staticmethod + def color_hex2tuple(hex_color): + # strip the # from the beginning + color = hex_color[1:] + + # convert color RGB components from range 0...255 to 0...1 + r_color = int(color[:2], 16) / 255 + g_color = int(color[2:4], 16) / 255 + b_color = int(color[4:6], 16) / 255 + return r_color, g_color, b_color + def on_toggle_axis(self, signal=None, state=None, silent=None): if not state: state = not self.axis_enabled @@ -247,6 +266,25 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): if silent is None: self.fcapp.inform[str, bool].emit(_("Axis disabled."), False) + def apply_axis_color(self): + self.fcapp.log.debug('PlotCanvas.apply_axis_color() -> axis color applied') + + axis_default_color = self.fcapp.defaults['global_axis_color'] + + axis_color = self.color_hex2tuple(axis_default_color) + axis_color = axis_color[0], axis_color[1], axis_color[2], self.axis_transparency + + if axis_color is not None: + axis_color = np.array(axis_color, dtype=np.float32) + if axis_color.ndim != 1 or axis_color.shape[0] != 4: + self.fcapp.log.error('axis color must be a 4 element float rgba tuple,' + ' list or array') + self.v_line._color = axis_color + self.v_line._changed['color'] = True + + self.h_line._color = axis_color + self.h_line._changed['color'] = True + def on_toggle_hud(self, signal=None, state=None, silent=None): if state is None: state = not self.hud_enabled diff --git a/appGUI/PlotCanvasLegacy.py b/appGUI/PlotCanvasLegacy.py index a1172f35..4b92c91b 100644 --- a/appGUI/PlotCanvasLegacy.py +++ b/appGUI/PlotCanvasLegacy.py @@ -231,8 +231,16 @@ class PlotCanvasLegacy(QtCore.QObject): self.axes = self.figure.add_axes([0.05, 0.05, 0.9, 0.9], label="base", alpha=0.0) self.axes.set_aspect(1) self.axes.grid(True, color='gray') - self.h_line = self.axes.axhline(color=(0.70, 0.3, 0.3), linewidth=2) - self.v_line = self.axes.axvline(color=(0.70, 0.3, 0.3), linewidth=2) + + axis_default_color = self.app.defaults['global_axis_color'] + self.axis_transparency = 0.8 + + axis_color = self.color_hex2tuple(axis_default_color) + axis_color = axis_color[0], axis_color[1], axis_color[2] + + # self.h_line = self.axes.axhline(color=(0.70, 0.3, 0.3), linewidth=2) + self.h_line = self.axes.axhline(color=axis_color, linewidth=2) + self.v_line = self.axes.axvline(color=axis_color, linewidth=2) self.axes.tick_params(axis='x', color=tick_color, labelcolor=tick_color) self.axes.tick_params(axis='y', color=tick_color, labelcolor=tick_color) @@ -334,6 +342,30 @@ class PlotCanvasLegacy(QtCore.QObject): # self.container.attach(self.canvas, 0, 0, 600, 400) # self.container.addWidget(self.canvas) # Qt + + @staticmethod + def color_hex2tuple(hex_color): + # strip the # from the beginning + color = hex_color[1:] + + # convert color RGB components from range 0...255 to 0...1 + r_color = int(color[:2], 16) / 255 + g_color = int(color[2:4], 16) / 255 + b_color = int(color[4:6], 16) / 255 + return r_color, g_color, b_color + + def apply_axis_color(self): + self.app.log.debug('PlotCanvasLegacy.apply_axis_color() -> axis color applied') + + axis_default_color = self.app.defaults['global_axis_color'] + + axis_color = self.color_hex2tuple(axis_default_color) + axis_color = axis_color[0], axis_color[1], axis_color[2] + + self.h_line.set_color(axis_color) + self.v_line.set_color(axis_color) + self.canvas.draw() + def on_toggle_axis(self, signal=None, state=None, silent=None): if not state: state = not self.axis_enabled diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index a3a6f3be..a2a71d7c 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -97,6 +97,8 @@ class PreferencesUIManager: "global_workspaceT": self.ui.general_defaults_form.general_app_set_group.wk_cb, "global_workspace_orientation": self.ui.general_defaults_form.general_app_set_group.wk_orientation_radio, + "global_axis_color": self.ui.general_defaults_form.general_app_set_group.axis_color_entry, + "global_cursor_type": self.ui.general_defaults_form.general_app_set_group.cursor_radio, "global_cursor_size": self.ui.general_defaults_form.general_app_set_group.cursor_size_entry, "global_cursor_width": self.ui.general_defaults_form.general_app_set_group.cursor_width_entry, diff --git a/appGUI/preferences/general/GeneralAPPSetGroupUI.py b/appGUI/preferences/general/GeneralAPPSetGroupUI.py index aa716df6..c220bc6a 100644 --- a/appGUI/preferences/general/GeneralAPPSetGroupUI.py +++ b/appGUI/preferences/general/GeneralAPPSetGroupUI.py @@ -51,8 +51,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): self.gridx_entry.set_precision(self.decimals) self.gridx_entry.setSingleStep(0.1) - grid0.addWidget(self.gridx_label, 1, 0) - grid0.addWidget(self.gridx_entry, 1, 1) + grid0.addWidget(self.gridx_label, 2, 0) + grid0.addWidget(self.gridx_entry, 2, 1) # Grid Y Entry self.gridy_label = FCLabel('%s:' % _('Y value')) @@ -63,8 +63,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): self.gridy_entry.set_precision(self.decimals) self.gridy_entry.setSingleStep(0.1) - grid0.addWidget(self.gridy_label, 2, 0) - grid0.addWidget(self.gridy_entry, 2, 1) + grid0.addWidget(self.gridy_label, 4, 0) + grid0.addWidget(self.gridy_entry, 4, 1) # Snap Max Entry self.snap_max_label = FCLabel('%s:' % _('Snap Max')) @@ -73,17 +73,17 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): self.snap_max_dist_entry.set_precision(self.decimals) self.snap_max_dist_entry.setSingleStep(0.1) - grid0.addWidget(self.snap_max_label, 3, 0) - grid0.addWidget(self.snap_max_dist_entry, 3, 1) + grid0.addWidget(self.snap_max_label, 6, 0) + grid0.addWidget(self.snap_max_dist_entry, 6, 1) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - grid0.addWidget(separator_line, 4, 0, 1, 2) + grid0.addWidget(separator_line, 8, 0, 1, 2) # Workspace self.workspace_label = FCLabel('%s' % _('Workspace Settings')) - grid0.addWidget(self.workspace_label, 5, 0, 1, 2) + grid0.addWidget(self.workspace_label, 10, 0, 1, 2) self.workspace_cb = FCCheckBox('%s' % _('Active')) self.workspace_cb.setToolTip( @@ -91,7 +91,7 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): "The purpose is to illustrate the limits for our work.") ) - grid0.addWidget(self.workspace_cb, 6, 0, 1, 2) + grid0.addWidget(self.workspace_cb, 12, 0, 1, 2) self.workspace_type_lbl = FCLabel('%s:' % _('Size')) self.workspace_type_lbl.setToolTip( @@ -100,8 +100,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): ) self.wk_cb = FCComboBox() - grid0.addWidget(self.workspace_type_lbl, 7, 0) - grid0.addWidget(self.wk_cb, 7, 1) + grid0.addWidget(self.workspace_type_lbl, 14, 0) + grid0.addWidget(self.wk_cb, 14, 1) self.pagesize = {} self.pagesize.update( @@ -170,17 +170,17 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): {'label': _('Landscape'), 'value': 'l'}, ], stretch=False) - grid0.addWidget(self.wk_orientation_label, 8, 0) - grid0.addWidget(self.wk_orientation_radio, 8, 1) + grid0.addWidget(self.wk_orientation_label, 16, 0) + grid0.addWidget(self.wk_orientation_radio, 16, 1) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - grid0.addWidget(separator_line, 9, 0, 1, 2) + grid0.addWidget(separator_line, 18, 0, 1, 2) # Font Size self.font_size_label = FCLabel('%s' % _('Font Size')) - grid0.addWidget(self.font_size_label, 10, 0, 1, 2) + grid0.addWidget(self.font_size_label, 20, 0, 1, 2) # Notebook Font Size self.notebook_font_size_label = FCLabel('%s:' % _('Notebook')) @@ -200,8 +200,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): else: self.notebook_font_size_spinner.set_value(12) - grid0.addWidget(self.notebook_font_size_label, 11, 0) - grid0.addWidget(self.notebook_font_size_spinner, 11, 1) + grid0.addWidget(self.notebook_font_size_label, 22, 0) + grid0.addWidget(self.notebook_font_size_spinner, 22, 1) # Axis Font Size self.axis_font_size_label = FCLabel('%s:' % _('Axis')) @@ -219,8 +219,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): else: self.axis_font_size_spinner.set_value(8) - grid0.addWidget(self.axis_font_size_label, 12, 0) - grid0.addWidget(self.axis_font_size_spinner, 12, 1) + grid0.addWidget(self.axis_font_size_label, 24, 0) + grid0.addWidget(self.axis_font_size_spinner, 24, 1) # TextBox Font Size self.textbox_font_size_label = FCLabel('%s:' % _('Textbox')) @@ -239,8 +239,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): else: self.textbox_font_size_spinner.set_value(10) - grid0.addWidget(self.textbox_font_size_label, 13, 0) - grid0.addWidget(self.textbox_font_size_spinner, 13, 1) + grid0.addWidget(self.textbox_font_size_label, 26, 0) + grid0.addWidget(self.textbox_font_size_spinner, 26, 1) # HUD Font Size self.hud_font_size_label = FCLabel('%s:' % _('HUD')) @@ -258,20 +258,35 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): else: self.hud_font_size_spinner.set_value(8) - grid0.addWidget(self.hud_font_size_label, 14, 0) - grid0.addWidget(self.hud_font_size_spinner, 14, 1) + grid0.addWidget(self.hud_font_size_label, 28, 0) + grid0.addWidget(self.hud_font_size_spinner, 28, 1) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - grid0.addWidget(separator_line, 16, 0, 1, 2) + grid0.addWidget(separator_line, 30, 0, 1, 2) + + # Axis Color + self.axis_color_label = FCLabel('%s:' % _('Axis Color')) + self.axis_color_label.setToolTip( + _("Set the color of the screen axis.") + ) + self.axis_color_entry = FCColorEntry() + + grid0.addWidget(self.axis_color_label, 32, 0) + grid0.addWidget(self.axis_color_entry, 32, 1) + + separator_line = QtWidgets.QFrame() + separator_line.setFrameShape(QtWidgets.QFrame.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) + grid0.addWidget(separator_line, 34, 0, 1, 2) # ----------------------------------------------------------- # -------------- MOUSE SETTINGS ----------------------------- # ----------------------------------------------------------- self.mouse_lbl = FCLabel('%s' % _('Mouse Settings')) - grid0.addWidget(self.mouse_lbl, 21, 0, 1, 2) + grid0.addWidget(self.mouse_lbl, 36, 0, 1, 2) # Mouse Cursor Shape self.cursor_lbl = FCLabel('%s:' % _('Cursor Shape')) @@ -286,8 +301,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): {"label": _("Big"), "value": "big"} ], orientation='horizontal', stretch=False) - grid0.addWidget(self.cursor_lbl, 22, 0) - grid0.addWidget(self.cursor_radio, 22, 1) + grid0.addWidget(self.cursor_lbl, 38, 0) + grid0.addWidget(self.cursor_radio, 38, 1) # Mouse Cursor Size self.cursor_size_lbl = FCLabel('%s:' % _('Cursor Size')) @@ -299,8 +314,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): self.cursor_size_entry.set_range(10, 70) self.cursor_size_entry.setWrapping(True) - grid0.addWidget(self.cursor_size_lbl, 23, 0) - grid0.addWidget(self.cursor_size_entry, 23, 1) + grid0.addWidget(self.cursor_size_lbl, 40, 0) + grid0.addWidget(self.cursor_size_entry, 40, 1) # Cursor Width self.cursor_width_lbl = FCLabel('%s:' % _('Cursor Width')) @@ -312,15 +327,15 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): self.cursor_width_entry.set_range(1, 10) self.cursor_width_entry.setWrapping(True) - grid0.addWidget(self.cursor_width_lbl, 24, 0) - grid0.addWidget(self.cursor_width_entry, 24, 1) + grid0.addWidget(self.cursor_width_lbl, 42, 0) + grid0.addWidget(self.cursor_width_entry, 42, 1) # Cursor Color Enable self.mouse_cursor_color_cb = FCCheckBox(label='%s' % _('Cursor Color')) self.mouse_cursor_color_cb.setToolTip( _("Check this box to color mouse cursor.") ) - grid0.addWidget(self.mouse_cursor_color_cb, 25, 0, 1, 2) + grid0.addWidget(self.mouse_cursor_color_cb, 44, 0, 1, 2) # Cursor Color self.mouse_color_label = FCLabel('%s:' % _('Cursor Color')) @@ -329,8 +344,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): ) self.mouse_cursor_entry = FCColorEntry() - grid0.addWidget(self.mouse_color_label, 26, 0) - grid0.addWidget(self.mouse_cursor_entry, 26, 1) + grid0.addWidget(self.mouse_color_label, 46, 0) + grid0.addWidget(self.mouse_cursor_entry, 46, 1) self.mois = OptionalInputSection( self.mouse_cursor_color_cb, @@ -339,6 +354,7 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): self.mouse_cursor_entry ] ) + # Select mouse pan button self.panbuttonlabel = FCLabel('%s:' % _('Pan Button')) self.panbuttonlabel.setToolTip( @@ -349,8 +365,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): self.pan_button_radio = RadioSet([{'label': _('MMB'), 'value': '3'}, {'label': _('RMB'), 'value': '2'}]) - grid0.addWidget(self.panbuttonlabel, 27, 0) - grid0.addWidget(self.pan_button_radio, 27, 1) + grid0.addWidget(self.panbuttonlabel, 48, 0) + grid0.addWidget(self.pan_button_radio, 48, 1) # Multiple Selection Modifier Key self.mselectlabel = FCLabel('%s:' % _('Multiple Selection')) @@ -360,13 +376,13 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'}, {'label': _('SHIFT'), 'value': 'Shift'}]) - grid0.addWidget(self.mselectlabel, 28, 0) - grid0.addWidget(self.mselect_radio, 28, 1) + grid0.addWidget(self.mselectlabel, 50, 0) + grid0.addWidget(self.mselect_radio, 50, 1) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - grid0.addWidget(separator_line, 29, 0, 1, 2) + grid0.addWidget(separator_line, 52, 0, 1, 2) # Delete confirmation self.delete_conf_cb = FCCheckBox(_('Delete object confirmation')) @@ -375,14 +391,14 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): "whenever the Delete object(s) event is triggered, either by\n" "menu shortcut or key shortcut.") ) - grid0.addWidget(self.delete_conf_cb, 30, 0, 1, 2) + grid0.addWidget(self.delete_conf_cb, 54, 0, 1, 2) self.allow_edit_cb = FCCheckBox(_("Allow Edit")) self.allow_edit_cb.setToolTip( _("When checked, the user can edit the object names in the Project Tab\n" "by clicking on the object name. Active after restart.") ) - grid0.addWidget(self.allow_edit_cb, 31, 0, 1, 2) + grid0.addWidget(self.allow_edit_cb, 56, 0, 1, 2) # Open behavior self.open_style_cb = FCCheckBox('%s' % _('"Open" behavior')) @@ -393,7 +409,7 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): "path for saving files or the path for opening files.") ) - grid0.addWidget(self.open_style_cb, 32, 0, 1, 2) + grid0.addWidget(self.open_style_cb, 58, 0, 1, 2) # Enable/Disable ToolTips globally self.toggle_tooltips_cb = FCCheckBox(label=_('Enable ToolTips')) @@ -402,7 +418,7 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): "when hovering with mouse over items throughout the App.") ) - grid0.addWidget(self.toggle_tooltips_cb, 33, 0, 1, 2) + grid0.addWidget(self.toggle_tooltips_cb, 60, 0, 1, 2) # Bookmarks Limit in the Help Menu self.bm_limit_spinner = FCSpinner() @@ -414,8 +430,8 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): "but the menu will hold only so much.") ) - grid0.addWidget(self.bm_limit_label, 35, 0) - grid0.addWidget(self.bm_limit_spinner, 35, 1) + grid0.addWidget(self.bm_limit_label, 62, 0) + grid0.addWidget(self.bm_limit_spinner, 62, 1) # Activity monitor icon self.activity_label = FCLabel('%s:' % _("Activity Icon")) @@ -425,14 +441,16 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): self.activity_combo = FCComboBox() self.activity_combo.addItems(['Ball black', 'Ball green', 'Arrow green', 'Eclipse green']) - grid0.addWidget(self.activity_label, 36, 0) - grid0.addWidget(self.activity_combo, 36, 1) + grid0.addWidget(self.activity_label, 64, 0) + grid0.addWidget(self.activity_combo, 64, 1) self.layout.addStretch() self.mouse_cursor_color_cb.stateChanged.connect(self.on_mouse_cursor_color_enable) self.mouse_cursor_entry.editingFinished.connect(self.on_mouse_cursor_entry) + self.axis_color_entry.editingFinished.connect(self.on_axis_color_entry) + def on_mouse_cursor_color_enable(self, val): if val: self.app.cursor_color_3D = self.app.defaults["global_cursor_color"] @@ -451,3 +469,7 @@ class GeneralAPPSetGroupUI(OptionsGroupUI): def on_mouse_cursor_entry(self): self.app.defaults['global_cursor_color'] = self.mouse_cursor_entry.get_value() self.app.cursor_color_3D = self.app.defaults["global_cursor_color"] + + def on_axis_color_entry(self): + self.app.defaults['global_axis_color'] = self.axis_color_entry.get_value() + self.app.plotcanvas.apply_axis_color() \ No newline at end of file diff --git a/appTools/ToolAlignObjects.py b/appPlugins/ToolAlignObjects.py similarity index 100% rename from appTools/ToolAlignObjects.py rename to appPlugins/ToolAlignObjects.py diff --git a/appTools/ToolCalculators.py b/appPlugins/ToolCalculators.py similarity index 100% rename from appTools/ToolCalculators.py rename to appPlugins/ToolCalculators.py diff --git a/appTools/ToolCalibration.py b/appPlugins/ToolCalibration.py similarity index 100% rename from appTools/ToolCalibration.py rename to appPlugins/ToolCalibration.py diff --git a/appTools/ToolCopperThieving.py b/appPlugins/ToolCopperThieving.py similarity index 100% rename from appTools/ToolCopperThieving.py rename to appPlugins/ToolCopperThieving.py diff --git a/appTools/ToolCorners.py b/appPlugins/ToolCorners.py similarity index 100% rename from appTools/ToolCorners.py rename to appPlugins/ToolCorners.py diff --git a/appTools/ToolCutOut.py b/appPlugins/ToolCutOut.py similarity index 100% rename from appTools/ToolCutOut.py rename to appPlugins/ToolCutOut.py diff --git a/appTools/ToolDblSided.py b/appPlugins/ToolDblSided.py similarity index 100% rename from appTools/ToolDblSided.py rename to appPlugins/ToolDblSided.py diff --git a/appTools/ToolDistance.py b/appPlugins/ToolDistance.py similarity index 100% rename from appTools/ToolDistance.py rename to appPlugins/ToolDistance.py diff --git a/appTools/ToolDistanceMin.py b/appPlugins/ToolDistanceMin.py similarity index 100% rename from appTools/ToolDistanceMin.py rename to appPlugins/ToolDistanceMin.py diff --git a/appTools/ToolDrilling.py b/appPlugins/ToolDrilling.py similarity index 100% rename from appTools/ToolDrilling.py rename to appPlugins/ToolDrilling.py diff --git a/appTools/ToolEtchCompensation.py b/appPlugins/ToolEtchCompensation.py similarity index 100% rename from appTools/ToolEtchCompensation.py rename to appPlugins/ToolEtchCompensation.py diff --git a/appTools/ToolExtract.py b/appPlugins/ToolExtract.py similarity index 100% rename from appTools/ToolExtract.py rename to appPlugins/ToolExtract.py diff --git a/appTools/ToolFiducials.py b/appPlugins/ToolFiducials.py similarity index 100% rename from appTools/ToolFiducials.py rename to appPlugins/ToolFiducials.py diff --git a/appTools/ToolFilm.py b/appPlugins/ToolFilm.py similarity index 100% rename from appTools/ToolFilm.py rename to appPlugins/ToolFilm.py diff --git a/appTools/ToolFollow.py b/appPlugins/ToolFollow.py similarity index 100% rename from appTools/ToolFollow.py rename to appPlugins/ToolFollow.py diff --git a/appTools/ToolImage.py b/appPlugins/ToolImage.py similarity index 100% rename from appTools/ToolImage.py rename to appPlugins/ToolImage.py diff --git a/appTools/ToolInvertGerber.py b/appPlugins/ToolInvertGerber.py similarity index 100% rename from appTools/ToolInvertGerber.py rename to appPlugins/ToolInvertGerber.py diff --git a/appTools/ToolIsolation.py b/appPlugins/ToolIsolation.py similarity index 100% rename from appTools/ToolIsolation.py rename to appPlugins/ToolIsolation.py diff --git a/appTools/ToolLevelling.py b/appPlugins/ToolLevelling.py similarity index 100% rename from appTools/ToolLevelling.py rename to appPlugins/ToolLevelling.py diff --git a/appTools/ToolMilling.py b/appPlugins/ToolMilling.py similarity index 100% rename from appTools/ToolMilling.py rename to appPlugins/ToolMilling.py diff --git a/appTools/ToolMove.py b/appPlugins/ToolMove.py similarity index 100% rename from appTools/ToolMove.py rename to appPlugins/ToolMove.py diff --git a/appTools/ToolNCC.py b/appPlugins/ToolNCC.py similarity index 100% rename from appTools/ToolNCC.py rename to appPlugins/ToolNCC.py diff --git a/appTools/ToolOptimal.py b/appPlugins/ToolOptimal.py similarity index 100% rename from appTools/ToolOptimal.py rename to appPlugins/ToolOptimal.py diff --git a/appTools/ToolPDF.py b/appPlugins/ToolPDF.py similarity index 100% rename from appTools/ToolPDF.py rename to appPlugins/ToolPDF.py diff --git a/appTools/ToolPaint.py b/appPlugins/ToolPaint.py similarity index 100% rename from appTools/ToolPaint.py rename to appPlugins/ToolPaint.py diff --git a/appTools/ToolPanelize.py b/appPlugins/ToolPanelize.py similarity index 100% rename from appTools/ToolPanelize.py rename to appPlugins/ToolPanelize.py diff --git a/appTools/ToolPcbWizard.py b/appPlugins/ToolPcbWizard.py similarity index 100% rename from appTools/ToolPcbWizard.py rename to appPlugins/ToolPcbWizard.py diff --git a/appTools/ToolPunchGerber.py b/appPlugins/ToolPunchGerber.py similarity index 100% rename from appTools/ToolPunchGerber.py rename to appPlugins/ToolPunchGerber.py diff --git a/appTools/ToolQRCode.py b/appPlugins/ToolQRCode.py similarity index 100% rename from appTools/ToolQRCode.py rename to appPlugins/ToolQRCode.py diff --git a/appTools/ToolReport.py b/appPlugins/ToolReport.py similarity index 100% rename from appTools/ToolReport.py rename to appPlugins/ToolReport.py diff --git a/appTools/ToolRulesCheck.py b/appPlugins/ToolRulesCheck.py similarity index 100% rename from appTools/ToolRulesCheck.py rename to appPlugins/ToolRulesCheck.py diff --git a/appTools/ToolShell.py b/appPlugins/ToolShell.py similarity index 100% rename from appTools/ToolShell.py rename to appPlugins/ToolShell.py diff --git a/appTools/ToolSolderPaste.py b/appPlugins/ToolSolderPaste.py similarity index 100% rename from appTools/ToolSolderPaste.py rename to appPlugins/ToolSolderPaste.py diff --git a/appTools/ToolSub.py b/appPlugins/ToolSub.py similarity index 100% rename from appTools/ToolSub.py rename to appPlugins/ToolSub.py diff --git a/appTools/ToolTransform.py b/appPlugins/ToolTransform.py similarity index 100% rename from appTools/ToolTransform.py rename to appPlugins/ToolTransform.py diff --git a/appPlugins/__init__.py b/appPlugins/__init__.py new file mode 100644 index 00000000..a169694c --- /dev/null +++ b/appPlugins/__init__.py @@ -0,0 +1,48 @@ +from appPlugins.ToolCalculators import ToolCalculator +from appPlugins.ToolCalibration import ToolCalibration + +from appPlugins.ToolDblSided import DblSidedTool +from appPlugins.ToolExtract import ToolExtract +from appPlugins.ToolAlignObjects import AlignObjects + +from appPlugins.ToolFilm import Film + +from appPlugins.ToolImage import ToolImage + +from appPlugins.ToolDistance import Distance +from appPlugins.ToolDistanceMin import DistanceMin + +from appPlugins.ToolMove import ToolMove + +from appPlugins.ToolCutOut import CutOut +from appPlugins.ToolNCC import NonCopperClear +from appPlugins.ToolPaint import ToolPaint +from appPlugins.ToolIsolation import ToolIsolation +from appPlugins.ToolFollow import ToolFollow +from appPlugins.ToolDrilling import ToolDrilling +from appPlugins.ToolMilling import ToolMilling +from appPlugins.ToolLevelling import ToolLevelling + +from appPlugins.ToolOptimal import ToolOptimal + +from appPlugins.ToolPanelize import Panelize +from appPlugins.ToolPcbWizard import PcbWizard +from appPlugins.ToolPDF import ToolPDF +from appPlugins.ToolReport import ObjectReport + +from appPlugins.ToolQRCode import QRCode +from appPlugins.ToolRulesCheck import RulesCheck + +from appPlugins.ToolCopperThieving import ToolCopperThieving +from appPlugins.ToolFiducials import ToolFiducials + +from appPlugins.ToolShell import FCShell +from appPlugins.ToolSolderPaste import SolderPaste +from appPlugins.ToolSub import ToolSub + +from appPlugins.ToolTransform import ToolTransform +from appPlugins.ToolPunchGerber import ToolPunchGerber + +from appPlugins.ToolInvertGerber import ToolInvertGerber +from appPlugins.ToolCorners import ToolCorners +from appPlugins.ToolEtchCompensation import ToolEtchCompensation \ No newline at end of file diff --git a/appTools/__init__.py b/appTools/__init__.py deleted file mode 100644 index 91c083dd..00000000 --- a/appTools/__init__.py +++ /dev/null @@ -1,48 +0,0 @@ -from appTools.ToolCalculators import ToolCalculator -from appTools.ToolCalibration import ToolCalibration - -from appTools.ToolDblSided import DblSidedTool -from appTools.ToolExtract import ToolExtract -from appTools.ToolAlignObjects import AlignObjects - -from appTools.ToolFilm import Film - -from appTools.ToolImage import ToolImage - -from appTools.ToolDistance import Distance -from appTools.ToolDistanceMin import DistanceMin - -from appTools.ToolMove import ToolMove - -from appTools.ToolCutOut import CutOut -from appTools.ToolNCC import NonCopperClear -from appTools.ToolPaint import ToolPaint -from appTools.ToolIsolation import ToolIsolation -from appTools.ToolFollow import ToolFollow -from appTools.ToolDrilling import ToolDrilling -from appTools.ToolMilling import ToolMilling -from appTools.ToolLevelling import ToolLevelling - -from appTools.ToolOptimal import ToolOptimal - -from appTools.ToolPanelize import Panelize -from appTools.ToolPcbWizard import PcbWizard -from appTools.ToolPDF import ToolPDF -from appTools.ToolReport import ObjectReport - -from appTools.ToolQRCode import QRCode -from appTools.ToolRulesCheck import RulesCheck - -from appTools.ToolCopperThieving import ToolCopperThieving -from appTools.ToolFiducials import ToolFiducials - -from appTools.ToolShell import FCShell -from appTools.ToolSolderPaste import SolderPaste -from appTools.ToolSub import ToolSub - -from appTools.ToolTransform import ToolTransform -from appTools.ToolPunchGerber import ToolPunchGerber - -from appTools.ToolInvertGerber import ToolInvertGerber -from appTools.ToolCorners import ToolCorners -from appTools.ToolEtchCompensation import ToolEtchCompensation \ No newline at end of file diff --git a/app_Main.py b/app_Main.py index 5412adb9..afdffc63 100644 --- a/app_Main.py +++ b/app_Main.py @@ -93,7 +93,7 @@ from appProcess import * from appWorkerStack import WorkerStack # FlatCAM Tools -from appTools import * +from appPlugins import * # FlatCAM Translation import gettext diff --git a/defaults.py b/defaults.py index 87e2f896..34bb57f9 100644 --- a/defaults.py +++ b/defaults.py @@ -134,6 +134,7 @@ class FlatCAMDefaults: "global_workspaceT": "A4", "global_workspace_orientation": 'p', "global_axis": True, + "global_axis_color": '#B34D4D', "global_hud": True, "global_grid_lines": True, "global_grid_snap": True,