From 40c52455e1ee32e64701a94180283c0f06f0ccdf Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 11 May 2020 22:56:06 +0300 Subject: [PATCH] - made sure that the corner snap buttons are shown only in Editors - changed the HUD color when using Dark theme --- CHANGELOG.md | 2 ++ flatcamEditors/FlatCAMExcEditor.py | 30 ++----------------- flatcamEditors/FlatCAMGeoEditor.py | 27 ++--------------- flatcamEditors/FlatCAMGrbEditor.py | 29 ++---------------- flatcamGUI/FlatCAMGUI.py | 29 ++++++------------ flatcamGUI/PlotCanvas.py | 2 +- .../general/GeneralGUIPrefGroupUI.py | 11 ++----- 7 files changed, 24 insertions(+), 106 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62d94acc..938e7d72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ CHANGELOG for FlatCAM beta - Snap Toolbar is now visible in Fullscreen - in Fullscreen now the Notebook is available but it will be hidden on Fullscreen launch - fixed some minor issues (in the HUD added a separating line, missing an icon in toolbars on first launch) +- made sure that the corner snap buttons are shown only in Editors +- changed the HUD color when using Dark theme 10.05.2020 diff --git a/flatcamEditors/FlatCAMExcEditor.py b/flatcamEditors/FlatCAMExcEditor.py index 5023386c..e77d0928 100644 --- a/flatcamEditors/FlatCAMExcEditor.py +++ b/flatcamEditors/FlatCAMExcEditor.py @@ -2819,10 +2819,8 @@ class FlatCAMExcEditor(QtCore.QObject): self.tool_shape.enabled = True # self.app.app_cursor.enabled = True - self.app.ui.snap_max_dist_entry.setEnabled(True) - self.app.ui.corner_snap_btn.setEnabled(True) - self.app.ui.snap_magnet.setVisible(True) self.app.ui.corner_snap_btn.setVisible(True) + self.app.ui.snap_magnet.setVisible(True) self.app.ui.exc_editor_menu.setDisabled(False) self.app.ui.exc_editor_menu.menuAction().setVisible(True) @@ -2868,30 +2866,8 @@ class FlatCAMExcEditor(QtCore.QObject): self.clear() self.app.ui.exc_edit_toolbar.setDisabled(True) - settings = QSettings("Open Source", "FlatCAM") - if settings.contains("layout"): - layout = settings.value('layout', type=str) - if layout == 'standard': - # self.app.ui.exc_edit_toolbar.setVisible(False) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) - else: - # self.app.ui.exc_edit_toolbar.setVisible(True) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(True) - self.app.ui.corner_snap_btn.setVisible(True) - else: - # self.app.ui.exc_edit_toolbar.setVisible(False) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.snap_magnet.setVisible(False) # set the Editor Toolbar visibility to what was before entering in the Editor self.app.ui.exc_edit_toolbar.setVisible(False) if self.toolbar_old_state is False \ diff --git a/flatcamEditors/FlatCAMGeoEditor.py b/flatcamEditors/FlatCAMGeoEditor.py index d3675cfb..6e4b616b 100644 --- a/flatcamEditors/FlatCAMGeoEditor.py +++ b/flatcamEditors/FlatCAMGeoEditor.py @@ -3654,10 +3654,8 @@ class FlatCAMGeoEditor(QtCore.QObject): self.tool_shape.enabled = True self.app.app_cursor.enabled = True - self.app.ui.snap_max_dist_entry.setEnabled(True) - self.app.ui.corner_snap_btn.setEnabled(True) - self.app.ui.snap_magnet.setVisible(True) self.app.ui.corner_snap_btn.setVisible(True) + self.app.ui.snap_magnet.setVisible(True) self.app.ui.geo_editor_menu.setDisabled(False) self.app.ui.geo_editor_menu.menuAction().setVisible(True) @@ -3713,27 +3711,8 @@ class FlatCAMGeoEditor(QtCore.QObject): self.app.ui.geo_edit_toolbar.setDisabled(True) settings = QSettings("Open Source", "FlatCAM") - if settings.contains("layout"): - layout = settings.value('layout', type=str) - if layout == 'standard': - # self.app.ui.geo_edit_toolbar.setVisible(False) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) - else: - # self.app.ui.geo_edit_toolbar.setVisible(True) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - else: - # self.app.ui.geo_edit_toolbar.setVisible(False) - - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) + self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.snap_magnet.setVisible(False) # set the Editor Toolbar visibility to what was before entering in the Editor self.app.ui.geo_edit_toolbar.setVisible(False) if self.toolbar_old_state is False \ diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py index 54dd72b4..0658926b 100644 --- a/flatcamEditors/FlatCAMGrbEditor.py +++ b/flatcamEditors/FlatCAMGrbEditor.py @@ -3685,10 +3685,8 @@ class FlatCAMGrbEditor(QtCore.QObject): self.shapes.enabled = True self.tool_shape.enabled = True - self.app.ui.snap_max_dist_entry.setEnabled(True) - self.app.ui.corner_snap_btn.setEnabled(True) - self.app.ui.snap_magnet.setVisible(True) self.app.ui.corner_snap_btn.setVisible(True) + self.app.ui.snap_magnet.setVisible(True) self.app.ui.grb_editor_menu.setDisabled(False) self.app.ui.grb_editor_menu.menuAction().setVisible(True) @@ -3735,29 +3733,8 @@ class FlatCAMGrbEditor(QtCore.QObject): self.app.ui.grb_edit_toolbar.setDisabled(True) settings = QSettings("Open Source", "FlatCAM") - if settings.contains("layout"): - layout = settings.value('layout', type=str) - if layout == 'standard': - # self.app.ui.exc_edit_toolbar.setVisible(False) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) - else: - # self.app.ui.exc_edit_toolbar.setVisible(True) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(True) - self.app.ui.corner_snap_btn.setVisible(True) - else: - # self.app.ui.exc_edit_toolbar.setVisible(False) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.snap_magnet.setVisible(False) # set the Editor Toolbar visibility to what was before entering in the Editor self.app.ui.grb_edit_toolbar.setVisible(False) if self.toolbar_old_state is False \ diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 62eeaa13..08821168 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -1110,6 +1110,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.snap_max_dist_entry.setToolTip(_("Max. magnet distance")) self.snap_magnet = self.snap_toolbar.addWidget(self.snap_max_dist_entry) + self.corner_snap_btn.setVisible(False) + self.snap_magnet.setVisible(False) + # ######################################################################## # ########################## Notebook # ################################## # ######################################################################## @@ -2384,29 +2387,21 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.restoreState(saved_gui_state) log.debug("FlatCAMGUI.__init__() --> UI state restored from QSettings.") + self.corner_snap_btn.setVisible(False) + self.snap_magnet.setVisible(False) + if flat_settings.contains("layout"): layout = flat_settings.value('layout', type=str) self.exc_edit_toolbar.setDisabled(True) self.geo_edit_toolbar.setDisabled(True) self.grb_edit_toolbar.setDisabled(True) - if layout == 'standard': - self.corner_snap_btn.setVisible(False) - self.snap_magnet.setVisible(False) - else: - self.snap_magnet.setVisible(True) - self.corner_snap_btn.setVisible(True) - self.snap_magnet.setDisabled(True) - self.corner_snap_btn.setDisabled(True) log.debug("FlatCAMGUI.__init__() --> UI layout restored from QSettings. Layout = %s" % str(layout)) else: self.exc_edit_toolbar.setDisabled(True) self.geo_edit_toolbar.setDisabled(True) self.grb_edit_toolbar.setDisabled(True) - self.corner_snap_btn.setVisible(False) - self.snap_magnet.setVisible(False) - flat_settings.setValue('layout', "standard") # This will write the setting to the platform specific storage. del flat_settings @@ -2759,19 +2754,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.aperture_move_btn = self.grb_edit_toolbar.addAction( QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move")) + self.corner_snap_btn.setVisible(False) + self.snap_magnet.setVisible(False) + qsettings = QSettings("Open Source", "FlatCAM") if qsettings.contains("layout"): layout = qsettings.value('layout', type=str) - if layout == 'standard' or layout == 'minimal': - self.corner_snap_btn.setVisible(False) - self.snap_magnet.setVisible(False) - else: - self.corner_snap_btn.setVisible(True) - self.snap_magnet.setVisible(True) - self.corner_snap_btn.setDisabled(True) - self.snap_magnet.setDisabled(True) - # on 'minimal' layout only some toolbars are active if layout != 'minimal': self.exc_edit_toolbar.setVisible(True) diff --git a/flatcamGUI/PlotCanvas.py b/flatcamGUI/PlotCanvas.py index 75cba1da..acd342ca 100644 --- a/flatcamGUI/PlotCanvas.py +++ b/flatcamGUI/PlotCanvas.py @@ -58,7 +58,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): self.text_hud_color = 'black' else: self.line_color = (0.4, 0.4, 0.4, 1.0) - self.rect_hud_color = Color('#0000FF10') + self.rect_hud_color = Color('#80808040') self.text_hud_color = 'white' # workspace lines; I didn't use the rectangle because I didn't want to add another VisPy Node, diff --git a/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py b/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py index 3815bed7..f9e86bf3 100644 --- a/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py +++ b/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py @@ -696,8 +696,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.exc_edit_toolbar.setObjectName('ExcEditor_TB') self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.exc_edit_toolbar) - self.app.ui.corner_snap_btn.setVisible(True) - self.app.ui.snap_magnet.setVisible(True) else: # ## TOOLBAR INSTALLATION # ## self.app.ui.toolbarfile = QtWidgets.QToolBar('File Toolbar') @@ -737,9 +735,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.grb_edit_toolbar.setObjectName('GrbEditor_TB') self.app.ui.addToolBar(self.app.ui.grb_edit_toolbar) - self.app.ui.corner_snap_btn.setVisible(False) - self.app.ui.snap_magnet.setVisible(False) - if current_layout == 'minimal': self.app.ui.toolbarview.setVisible(False) self.app.ui.toolbarshell.setVisible(False) @@ -748,9 +743,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.exc_edit_toolbar.setVisible(False) self.app.ui.lock_toolbar(lock=True) - self.app.ui.corner_snap_btn.setVisible(False) - self.app.ui.snap_magnet.setVisible(False) - # add all the actions to the toolbars self.app.ui.populate_toolbars() @@ -759,6 +751,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.grid_snap_btn.setChecked(True) + self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.snap_magnet.setVisible(False) + self.app.ui.grid_gap_x_entry.setText(str(self.app.defaults["global_gridx"])) self.app.ui.grid_gap_y_entry.setText(str(self.app.defaults["global_gridy"])) self.app.ui.snap_max_dist_entry.setText(str(self.app.defaults["global_snap_max"]))