Browse Source

- fixed issue with the old SysTray icon not hidden when the application is restarted programmatically

Marius Stanciu 6 years ago
parent
commit
ca7863a371
2 changed files with 13 additions and 3 deletions
  1. 12 3
      FlatCAMApp.py
  2. 1 0
      README.md

+ 12 - 3
FlatCAMApp.py

@@ -1880,9 +1880,7 @@ class App(QtCore.QObject):
         # ### GUI PREFERENCES SIGNALS ##
         # ### GUI PREFERENCES SIGNALS ##
         # ##############################
         # ##############################
 
 
-        self.ui.general_defaults_form.general_app_group.ge_radio.activated_custom.connect(
-            lambda: fcTranslate.restart_program(app=self)
-        )
+        self.ui.general_defaults_form.general_app_group.ge_radio.activated_custom.connect(self.on_app_restart)
 
 
         self.ui.general_options_form.general_app_group.units_radio.group_toggle_fn = self.on_toggle_units
         self.ui.general_options_form.general_app_group.units_radio.group_toggle_fn = self.on_toggle_units
         self.ui.general_defaults_form.general_app_group.language_apply_btn.clicked.connect(
         self.ui.general_defaults_form.general_app_group.language_apply_btn.clicked.connect(
@@ -2799,6 +2797,17 @@ class App(QtCore.QObject):
                                 name)
                                 name)
                                )
                                )
 
 
+    def on_app_restart(self):
+
+        # make sure that the Sys Tray icon is hidden before restart otherwise it will
+        # be left in the SySTray
+        try:
+            self.trayIcon.hide()
+        except Exception as e:
+            log.debug("App.on_app_restart() --> %s" % str(e))
+
+        fcTranslate.restart_program(app=self)
+
     def defaults_read_form(self):
     def defaults_read_form(self):
         """
         """
         Will read all the values in the Preferences GUI and update the defaults dictionary.
         Will read all the values in the Preferences GUI and update the defaults dictionary.

+ 1 - 0
README.md

@@ -15,6 +15,7 @@ CAD program, and create G-Code for Isolation routing.
 - added posibility of using a big mouse cursor or a small mouse cursor. The big mouse cursor is made from 2 infinite lines. This was implemented for both graphic engines
 - added posibility of using a big mouse cursor or a small mouse cursor. The big mouse cursor is made from 2 infinite lines. This was implemented for both graphic engines
 - added ability to change the cursor size when the small mouse cursor is selected in Preferences -> General
 - added ability to change the cursor size when the small mouse cursor is selected in Preferences -> General
 - removed the line that remove the spaces from the path parameter in the Tcl commands that open something (Gerber, Gcode, Excellon)
 - removed the line that remove the spaces from the path parameter in the Tcl commands that open something (Gerber, Gcode, Excellon)
+- fixed issue with the old SysTray icon not hidden when the application is restarted programmatically
 
 
 27.09.2019
 27.09.2019