From 8ab91b7f4f4a5ca8f0c7261912ffb5abd121a35e Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Fri, 20 Dec 2019 03:32:09 +0200 Subject: [PATCH] - added an icon in the infobar that will show more clearly the status of the grid snapping --- FlatCAMApp.py | 12 ++++++++++++ README.md | 1 + flatcamEditors/FlatCAMExcEditor.py | 1 + flatcamEditors/FlatCAMGeoEditor.py | 1 + flatcamEditors/FlatCAMGrbEditor.py | 1 + flatcamGUI/FlatCAMGUI.py | 4 ++++ share/snap_16.png | Bin 0 -> 426 bytes share/snap_filled_16.png | Bin 0 -> 176 bytes 8 files changed, 20 insertions(+) create mode 100644 share/snap_16.png create mode 100644 share/snap_filled_16.png diff --git a/FlatCAMApp.py b/FlatCAMApp.py index d4d0e16e..c4b70b40 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -1038,6 +1038,7 @@ class App(QtCore.QObject): QtCore.QObject.__init__(self) self.ui = FlatCAMGUI(self) + self.on_grid_snap_triggered(state=True) theme_settings = QtCore.QSettings("Open Source", "FlatCAM") if theme_settings.contains("theme"): @@ -2153,6 +2154,8 @@ class App(QtCore.QObject): # signal emitted when a tab is closed in the Plot Area self.ui.plot_tab_area.tab_closed_signal.connect(self.on_plot_area_tab_closed) + self.ui.grid_snap_btn.triggered.connect(self.on_grid_snap_triggered) + # ##################################################################################### # ########### FINISHED CONNECTING SIGNALS ############################################# # ##################################################################################### @@ -6079,6 +6082,7 @@ class App(QtCore.QObject): self.report_usage("on_toggle_grid()") self.ui.grid_snap_btn.trigger() + self.on_grid_snap_triggered(state=True) def on_toggle_grid_lines(self): self.report_usage("on_toggle_grd_lines()") @@ -7019,6 +7023,8 @@ class App(QtCore.QObject): self.connect_toolbar_signals() self.ui.grid_snap_btn.setChecked(True) + self.on_grid_snap_triggered(state=True) + self.ui.grid_gap_x_entry.setText(str(self.defaults["global_gridx"])) self.ui.grid_gap_y_entry.setText(str(self.defaults["global_gridy"])) self.ui.snap_max_dist_entry.setText(str(self.defaults["global_snap_max"])) @@ -12350,6 +12356,12 @@ class App(QtCore.QObject): # Clear pool to free memory self.clear_pool() + def on_grid_snap_triggered(self, state): + if state: + self.ui.snap_infobar_label.setPixmap(QtGui.QPixmap(self.resource_location + '/snap_filled_16.png')) + else: + self.ui.snap_infobar_label.setPixmap(QtGui.QPixmap(self.resource_location + '/snap_16.png')) + def generate_cnc_job(self, objects): self.report_usage("generate_cnc_job()") diff --git a/README.md b/README.md index d0e5efe1..c9c5da8f 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing. - fixed a rare issue in the generation of non-copper-region geometry started from the Gerber Object UI (selected tab) - Print function is now printing a PDF file for a selection of objects in the colors from canvas +- added an icon in the infobar that will show more clearly the status of the grid snapping 19.12.2019 diff --git a/flatcamEditors/FlatCAMExcEditor.py b/flatcamEditors/FlatCAMExcEditor.py index e62275a7..dfd14965 100644 --- a/flatcamEditors/FlatCAMExcEditor.py +++ b/flatcamEditors/FlatCAMExcEditor.py @@ -2744,6 +2744,7 @@ class FlatCAMExcEditor(QtCore.QObject): # start with GRID toolbar activated if self.app.ui.grid_snap_btn.isChecked() is False: self.app.ui.grid_snap_btn.trigger() + self.app.on_grid_snap_triggered(state=True) self.app.ui.popmenu_disable.setVisible(False) self.app.ui.cmenu_newmenu.menuAction().setVisible(False) diff --git a/flatcamEditors/FlatCAMGeoEditor.py b/flatcamEditors/FlatCAMGeoEditor.py index d70828f8..0f14de33 100644 --- a/flatcamEditors/FlatCAMGeoEditor.py +++ b/flatcamEditors/FlatCAMGeoEditor.py @@ -3679,6 +3679,7 @@ class FlatCAMGeoEditor(QtCore.QObject): # start with GRID toolbar activated if self.app.ui.grid_snap_btn.isChecked() is False: self.app.ui.grid_snap_btn.trigger() + self.app.on_grid_snap_triggered(state=True) def on_buffer_tool(self): buff_tool = BufferSelectionTool(self.app, self) diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py index d05ae8fe..86c28795 100644 --- a/flatcamEditors/FlatCAMGrbEditor.py +++ b/flatcamEditors/FlatCAMGrbEditor.py @@ -3530,6 +3530,7 @@ class FlatCAMGrbEditor(QtCore.QObject): # start with GRID toolbar activated if self.app.ui.grid_snap_btn.isChecked() is False: self.app.ui.grid_snap_btn.trigger() + self.app.on_grid_snap_triggered(state=True) # adjust the visibility of some of the canvas context menu self.app.ui.popmenu_edit.setVisible(False) diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index fc75f8a5..fbf61145 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2149,6 +2149,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.fcinfo = FlatCAMInfoBar(app=self.app) self.infobar.addWidget(self.fcinfo, stretch=1) + self.snap_infobar_label = QtWidgets.QLabel() + self.snap_infobar_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/snap_16.png')) + self.infobar.addWidget(self.snap_infobar_label) + self.rel_position_label = QtWidgets.QLabel( "Dx: 0.0000   Dy: 0.0000    ") self.rel_position_label.setMinimumWidth(110) diff --git a/share/snap_16.png b/share/snap_16.png new file mode 100644 index 0000000000000000000000000000000000000000..25bf01ddd00d86c5d76f847166a9dcf80ad5ce97 GIT binary patch literal 426 zcmV;b0agBqP)^)DO@gT7rcygZVOC=b_t+`{}^Nea>~>{?|GGyH0KC zigN`&uz{02sG%hB3Fgp--#9}L#?X#+oY(3)j%hT7eGRPz|1&HW6B-NpLv&yQotVL4 zoZI+<&w*kHD|z>2Ttzd!;b!KaM{mS@&k?j>4@dEg_xP0+c#8!b2dXB8p$_0h=u4>2 z;nk8Vf>!K=UN23)Dr0z5k~@#p#u7&*vmanEyX(ijVu7Ey75aG~`y2Lwv;o-0YuWor z6aNtUs6?hR`4r#hc$_;|B-&P_HMV8`mlzKHBW`e+NDG+4Bwk?_r}!h0XH8;Zx3tRr zGKg>R&Oa(wTqe|ge8u(ZMO{gerx?K&Hl-o9qYt~$;NX7+s&WT+1I4!VJ0Isk7u6g= U?Ab|VE&u=k07*qoM6N<$g5O!XoB#j- literal 0 HcmV?d00001 diff --git a/share/snap_filled_16.png b/share/snap_filled_16.png new file mode 100644 index 0000000000000000000000000000000000000000..0db6956a91ebea1319b88038a44ac571863630aa GIT binary patch literal 176 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`<(@8%Ar}5eC&%&~P~d2OxKA$q z``t||B==uZRr}TPX<=^ascWv=Z)Y9Z_KZu!^p+muC59!HhuEGl|H-UVR6VfoI$r=o zfWdNq<#+xbFIGAyEoNJ@r7^F7O(7@9iY4l)<%%2`XEQd