Просмотр исходного кода

- added an icon in the infobar that will show more clearly the status of the grid snapping

Marius Stanciu 6 лет назад
Родитель
Сommit
8ab91b7f4f

+ 12 - 0
FlatCAMApp.py

@@ -1038,6 +1038,7 @@ class App(QtCore.QObject):
         QtCore.QObject.__init__(self)
         QtCore.QObject.__init__(self)
 
 
         self.ui = FlatCAMGUI(self)
         self.ui = FlatCAMGUI(self)
+        self.on_grid_snap_triggered(state=True)
 
 
         theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
         theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
         if theme_settings.contains("theme"):
         if theme_settings.contains("theme"):
@@ -2153,6 +2154,8 @@ class App(QtCore.QObject):
         # signal emitted when a tab is closed in the Plot Area
         # 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.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 #############################################
         # ########### FINISHED CONNECTING SIGNALS #############################################
         # #####################################################################################
         # #####################################################################################
@@ -6079,6 +6082,7 @@ class App(QtCore.QObject):
         self.report_usage("on_toggle_grid()")
         self.report_usage("on_toggle_grid()")
 
 
         self.ui.grid_snap_btn.trigger()
         self.ui.grid_snap_btn.trigger()
+        self.on_grid_snap_triggered(state=True)
 
 
     def on_toggle_grid_lines(self):
     def on_toggle_grid_lines(self):
         self.report_usage("on_toggle_grd_lines()")
         self.report_usage("on_toggle_grd_lines()")
@@ -7019,6 +7023,8 @@ class App(QtCore.QObject):
         self.connect_toolbar_signals()
         self.connect_toolbar_signals()
 
 
         self.ui.grid_snap_btn.setChecked(True)
         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_x_entry.setText(str(self.defaults["global_gridx"]))
         self.ui.grid_gap_y_entry.setText(str(self.defaults["global_gridy"]))
         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"]))
         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
         # Clear pool to free memory
         self.clear_pool()
         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):
     def generate_cnc_job(self, objects):
         self.report_usage("generate_cnc_job()")
         self.report_usage("generate_cnc_job()")
 
 

+ 1 - 0
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)
 - 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 
 - 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
 19.12.2019
 
 

+ 1 - 0
flatcamEditors/FlatCAMExcEditor.py

@@ -2744,6 +2744,7 @@ class FlatCAMExcEditor(QtCore.QObject):
         # start with GRID toolbar activated
         # start with GRID toolbar activated
         if self.app.ui.grid_snap_btn.isChecked() is False:
         if self.app.ui.grid_snap_btn.isChecked() is False:
             self.app.ui.grid_snap_btn.trigger()
             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.popmenu_disable.setVisible(False)
         self.app.ui.cmenu_newmenu.menuAction().setVisible(False)
         self.app.ui.cmenu_newmenu.menuAction().setVisible(False)

+ 1 - 0
flatcamEditors/FlatCAMGeoEditor.py

@@ -3679,6 +3679,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
         # start with GRID toolbar activated
         # start with GRID toolbar activated
         if self.app.ui.grid_snap_btn.isChecked() is False:
         if self.app.ui.grid_snap_btn.isChecked() is False:
             self.app.ui.grid_snap_btn.trigger()
             self.app.ui.grid_snap_btn.trigger()
+            self.app.on_grid_snap_triggered(state=True)
 
 
     def on_buffer_tool(self):
     def on_buffer_tool(self):
         buff_tool = BufferSelectionTool(self.app, self)
         buff_tool = BufferSelectionTool(self.app, self)

+ 1 - 0
flatcamEditors/FlatCAMGrbEditor.py

@@ -3530,6 +3530,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
         # start with GRID toolbar activated
         # start with GRID toolbar activated
         if self.app.ui.grid_snap_btn.isChecked() is False:
         if self.app.ui.grid_snap_btn.isChecked() is False:
             self.app.ui.grid_snap_btn.trigger()
             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
         # adjust the visibility of some of the canvas context menu
         self.app.ui.popmenu_edit.setVisible(False)
         self.app.ui.popmenu_edit.setVisible(False)

+ 4 - 0
flatcamGUI/FlatCAMGUI.py

@@ -2149,6 +2149,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
         self.fcinfo = FlatCAMInfoBar(app=self.app)
         self.fcinfo = FlatCAMInfoBar(app=self.app)
         self.infobar.addWidget(self.fcinfo, stretch=1)
         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(
         self.rel_position_label = QtWidgets.QLabel(
             "<b>Dx</b>: 0.0000&nbsp;&nbsp;   <b>Dy</b>: 0.0000&nbsp;&nbsp;&nbsp;&nbsp;")
             "<b>Dx</b>: 0.0000&nbsp;&nbsp;   <b>Dy</b>: 0.0000&nbsp;&nbsp;&nbsp;&nbsp;")
         self.rel_position_label.setMinimumWidth(110)
         self.rel_position_label.setMinimumWidth(110)

BIN
share/snap_16.png


BIN
share/snap_filled_16.png