Prechádzať zdrojové kódy

- added confirmation messages for toggle of HUD, Grid, Grid Snap, Axis

Marius Stanciu 5 rokov pred
rodič
commit
49eb883cb1
4 zmenil súbory, kde vykonal 38 pridanie a 26 odobranie
  1. 2 0
      AppEditors/FlatCAMGeoEditor.py
  2. 23 0
      AppGUI/MainGUI.py
  3. 12 26
      App_Main.py
  4. 1 0
      CHANGELOG.md

+ 2 - 0
AppEditors/FlatCAMGeoEditor.py

@@ -4135,9 +4135,11 @@ class FlatCAMGeoEditor(QtCore.QObject):
 
         # make sure that the cursor shape is enabled/disabled, too
         if self.options['grid_snap'] is True:
+            self.app.inform.emit(_("Grid snap enabled."))
             self.app.app_cursor.enabled = True
         else:
             self.app.app_cursor.enabled = False
+            self.app.inform.emit(_("Grid snap disabled."))
 
     def on_canvas_click(self, event):
         """

+ 23 - 0
AppGUI/MainGUI.py

@@ -1664,6 +1664,29 @@ class MainGUI(QtWidgets.QMainWindow):
         self.width = None
         self.height = None
 
+        self.geom_update[int, int, int, int, int].connect(self.save_geometry)
+        self.final_save.connect(self.app.final_save)
+
+    def save_geometry(self, x, y, width, height, notebook_width):
+        """
+        Will save the application geometry and positions in the defaults dicitionary to be restored at the next
+        launch of the application.
+
+        :param x:               X position of the main window
+        :param y:               Y position of the main window
+        :param width:           width of the main window
+        :param height:          height of the main window
+        :param notebook_width:  the notebook width is adjustable so it get saved here, too.
+
+        :return: None
+        """
+        self.app.defaults["global_def_win_x"] = x
+        self.app.defaults["global_def_win_y"] = y
+        self.app.defaults["global_def_win_w"] = width
+        self.app.defaults["global_def_win_h"] = height
+        self.app.defaults["global_def_notebook_width"] = notebook_width
+        self.app.preferencesUiManager.save_defaults()
+
     def restore_main_win_geom(self):
         try:
             self.setGeometry(self.app.defaults["global_def_win_x"],

+ 12 - 26
App_Main.py

@@ -490,8 +490,6 @@ class App(QtCore.QObject):
         self.FC_light_blue = '#a5a5ffbf'
         self.FC_dark_blue = '#0000ffbf'
 
-        self.ui = MainGUI(self)
-
         theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
         if theme_settings.contains("theme"):
             theme = theme_settings.value('theme', type=str)
@@ -509,8 +507,7 @@ class App(QtCore.QObject):
         # update the defaults dict with the setting in QSetting
         self.defaults['global_theme'] = theme
 
-        self.ui.geom_update[int, int, int, int, int].connect(self.save_geometry)
-        self.ui.final_save.connect(self.final_save)
+        self.ui = MainGUI(self)
 
         # set FlatCAM units in the Status bar
         self.set_screen_units(self.defaults['units'])
@@ -2549,26 +2546,6 @@ class App(QtCore.QObject):
 
         self.inform.emit('[success] %s: %s' % (_("Exported file to"), filename))
 
-    def save_geometry(self, x, y, width, height, notebook_width):
-        """
-        Will save the application geometry and positions in the defaults discitionary to be restored at the next
-        launch of the application.
-
-        :param x: X position of the main window
-        :param y: Y position of the main window
-        :param width: width of the main window
-        :param height: height of the main window
-        :param notebook_width: the notebook width is adjustable so it get saved here, too.
-
-        :return: None
-        """
-        self.defaults["global_def_win_x"] = x
-        self.defaults["global_def_win_y"] = y
-        self.defaults["global_def_win_w"] = width
-        self.defaults["global_def_win_h"] = height
-        self.defaults["global_def_notebook_width"] = notebook_width
-        self.preferencesUiManager.save_defaults()
-
     def register_recent(self, kind, filename):
         """
         Will register the files opened into record dictionaries. The FlatCAM projects has it's own
@@ -4039,7 +4016,7 @@ class App(QtCore.QObject):
                     self.plotcanvas.h_line = self.plotcanvas.axes.axhline(color=(0.70, 0.3, 0.3), linewidth=2)
                     self.plotcanvas.v_line = self.plotcanvas.axes.axvline(color=(0.70, 0.3, 0.3), linewidth=2)
                     self.plotcanvas.canvas.draw()
-
+            self.inform.emit(_("Axis enabled."))
             self.toggle_axis = True
         else:
             if self.is_legacy is False:
@@ -4051,10 +4028,17 @@ class App(QtCore.QObject):
                     self.plotcanvas.axes.lines.remove(self.plotcanvas.h_line)
                     self.plotcanvas.axes.lines.remove(self.plotcanvas.v_line)
                     self.plotcanvas.canvas.draw()
+            self.inform.emit(_("Axis disabled."))
             self.toggle_axis = False
 
     def on_toggle_hud(self):
-        self.plotcanvas.on_toggle_hud(state=False if self.plotcanvas.hud_enabled else True)
+        new_state = False if self.plotcanvas.hud_enabled else True
+
+        self.plotcanvas.on_toggle_hud(state=new_state)
+        if new_state is False:
+            self.inform.emit(_("HUD disabled."))
+        else:
+            self.inform.emit(_("HUD enabled."))
 
     def on_toggle_grid_lines(self):
         self.defaults.report_usage("on_toggle_grd_lines()")
@@ -4078,6 +4062,7 @@ class App(QtCore.QObject):
                 except IndexError:
                     pass
                 pass
+            self.inform.emit(_("Grid enabled."))
             self.toggle_grid_lines = True
         else:
             if self.is_legacy is False:
@@ -4092,6 +4077,7 @@ class App(QtCore.QObject):
                 except IndexError:
                     pass
             self.toggle_grid_lines = False
+            self.inform.emit(_("Grid disabled."))
 
         if self.is_legacy is False:
             # HACK: enabling/disabling the cursor seams to somehow update the shapes on screen

+ 1 - 0
CHANGELOG.md

@@ -26,6 +26,7 @@ CHANGELOG for FlatCAM beta
 - updated the language translation files to the latest changes (no translation)
 - working on a new Tool: Etch Compensation Tool -> installed the tool and created the GUI and class template
 - moved more methods out of App_Main class
+- added confirmation messages for toggle of HUD, Grid, Grid Snap, Axis
 
 17.05.2020