Browse Source

- fixed issue with the sys tray icon not hiding after application close

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

+ 12 - 0
FlatCAMApp.py

@@ -395,6 +395,13 @@ class App(QtCore.QObject):
         self.ui.geom_update[int, int, int, int, int].connect(self.save_geometry)
         self.ui.geom_update[int, int, int, int, int].connect(self.save_geometry)
         self.ui.final_save.connect(self.final_save)
         self.ui.final_save.connect(self.final_save)
 
 
+        # #################################################################
+        # ####################### SYS TRAY ################################
+        # #################################################################
+
+        self.parent_w = QtWidgets.QWidget()
+        self.trayIcon = FlatCAMSystemTray(app=self, icon=QtGui.QIcon('share/flatcam_icon32.png'), parent=self.parent_w)
+
         # #############################################################################
         # #############################################################################
         # ############################## Data #########################################
         # ############################## Data #########################################
         # #############################################################################
         # #############################################################################
@@ -2468,6 +2475,8 @@ class App(QtCore.QObject):
         else:
         else:
             self.ui.show()
             self.ui.show()
 
 
+        self.trayIcon.show()
+
         # #####################################################################################
         # #####################################################################################
         # ########################## START-UP ARGUMENTS #######################################
         # ########################## START-UP ARGUMENTS #######################################
         # #####################################################################################
         # #####################################################################################
@@ -4460,12 +4469,15 @@ class App(QtCore.QObject):
             response = msgbox.clickedButton()
             response = msgbox.clickedButton()
 
 
             if response == bt_yes:
             if response == bt_yes:
+                self.trayIcon.hide()
                 self.on_file_saveprojectas(use_thread=True, quit_action=True)
                 self.on_file_saveprojectas(use_thread=True, quit_action=True)
             elif response == bt_no:
             elif response == bt_no:
+                self.trayIcon.hide()
                 self.quit_application()
                 self.quit_application()
             elif response == bt_cancel:
             elif response == bt_cancel:
                 return
                 return
         else:
         else:
+            self.trayIcon.hide()
             self.quit_application()
             self.quit_application()
 
 
     def quit_application(self):
     def quit_application(self):

+ 1 - 0
README.md

@@ -17,6 +17,7 @@ CAD program, and create G-Code for Isolation routing.
 - added sys tray menu
 - added sys tray menu
 - added possibility to edit the custom keywords used by the autocompleter (in Tcl Shell and in the Code Editor). It is done in the Edit -> Preferences -> Utilities
 - added possibility to edit the custom keywords used by the autocompleter (in Tcl Shell and in the Code Editor). It is done in the Edit -> Preferences -> Utilities
 - added a new setting in Edit -> Preferences -> General -> GUI Settings -> Textbox Font which control the font on the texbox GUI elements
 - added a new setting in Edit -> Preferences -> General -> GUI Settings -> Textbox Font which control the font on the texbox GUI elements
+- fixed issue with the sys tray icon not hiding after application close
 
 
 17.09.2019
 17.09.2019
 
 

+ 0 - 8
flatcamGUI/FlatCAMGUI.py

@@ -2055,14 +2055,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
         self.lock_toolbar(lock=lock_state)
         self.lock_toolbar(lock=lock_state)
         self.lock_action.triggered[bool].connect(self.lock_toolbar)
         self.lock_action.triggered[bool].connect(self.lock_toolbar)
 
 
-        # #################################################################
-        # ####################### SYS TRAY ################################
-        # #################################################################
-
-        self.w = QtWidgets.QWidget()
-        self.trayIcon = FlatCAMSystemTray(self.app, QtGui.QIcon('share/flatcam_icon32.png'), self.w)
-
-
     def eventFilter(self, obj, event):
     def eventFilter(self, obj, event):
         # filter the ToolTips display based on a Preferences setting
         # filter the ToolTips display based on a Preferences setting
         if self.general_defaults_form.general_gui_set_group.toggle_tooltips_cb.get_value() is False:
         if self.general_defaults_form.general_gui_set_group.toggle_tooltips_cb.get_value() is False: