Marius Stanciu 6 лет назад
Родитель
Сommit
31e111ebb3
2 измененных файлов с 54 добавлено и 0 удалено
  1. 1 0
      README.md
  2. 53 0
      flatcamGUI/FlatCAMGUI.py

+ 1 - 0
README.md

@@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing.
 - added more functionality to the Extension registration with FLatCAM and added to the GUI in Edit -> Preferences -> Utilities
 - added more functionality to the Extension registration with FLatCAM and added to the GUI in Edit -> Preferences -> Utilities
 - fixed the parsing of the Manufacturing files when double clicking them and they are registered with FlatCAM
 - fixed the parsing of the Manufacturing files when double clicking them and they are registered with FlatCAM
 - fixed showing the GUI when some settings (maximized_GUI) are missing from QSettings
 - fixed showing the GUI when some settings (maximized_GUI) are missing from QSettings
+- added sys tray menu
 
 
 17.09.2019
 17.09.2019
 
 

+ 53 - 0
flatcamGUI/FlatCAMGUI.py

@@ -2055,6 +2055,14 @@ 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:
@@ -8073,4 +8081,49 @@ class FlatCAMInfoBar(QtWidgets.QWidget):
 
 
         self.set_text_(text)
         self.set_text_(text)
         self.icon.setPixmap(self.pmap)
         self.icon.setPixmap(self.pmap)
+
+
+class FlatCAMSystemTray(QtWidgets.QSystemTrayIcon):
+
+    def __init__(self, app, icon, parent=None):
+        # QtWidgets.QSystemTrayIcon.__init__(self, icon, parent)
+        super().__init__(icon, parent=parent)
+        self.app = app
+
+        menu = QtWidgets.QMenu(parent)
+
+        menu_open = menu.addMenu(QtGui.QIcon('share/folder32_bis.png'), _('Open'))
+
+        # Open Project ...
+        menu_openproject = QtWidgets.QAction(QtGui.QIcon('share/folder16.png'), _('Open Project ...'), self)
+        menu_open.addAction(menu_openproject)
+        menu_open.addSeparator()
+
+        # Open Gerber ...
+        menu_opengerber = QtWidgets.QAction(QtGui.QIcon('share/flatcam_icon24.png'),
+                                                    _('Open &Gerber ...\tCTRL+G'), self)
+        menu_open.addAction(menu_opengerber)
+
+        # Open Excellon ...
+        menu_openexcellon = QtWidgets.QAction(QtGui.QIcon('share/open_excellon32.png'),
+                                                      _('Open &Excellon ...\tCTRL+E'), self)
+        menu_open.addAction(menu_openexcellon)
+
+        # Open G-Code ...
+        menu_opengcode = QtWidgets.QAction(QtGui.QIcon('share/code.png'), _('Open G-&Code ...'), self)
+        menu_open.addAction(menu_opengcode)
+
+        menu_open.addSeparator()
+
+        exitAction = menu.addAction(_("Exit"))
+        exitAction.setIcon(QtGui.QIcon('share/power16.png'))
+        self.setContextMenu(menu)
+
+        menu_openproject.triggered.connect(self.app.on_file_openproject)
+        menu_opengerber.triggered.connect(self.app.on_fileopengerber)
+        menu_openexcellon.triggered.connect(self.app.on_fileopenexcellon)
+        menu_opengcode.triggered.connect(self.app.on_fileopengcode)
+
+        exitAction.triggered.connect(self.app.final_save)
+
 # end of file
 # end of file