Implemented the make project sub-menu and related actions. make_support

Sun, 15 Apr 2018 12:04:17 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 15 Apr 2018 12:04:17 +0200
branch
make_support
changeset 6252
5e5e57bf09ed
parent 6251
02afc7d22c41
child 6254
88cb0838c90d

Implemented the make project sub-menu and related actions.

Project/Project.py file | annotate | diff | comparison | revisions
--- a/Project/Project.py	Sun Apr 15 11:36:43 2018 +0200
+++ b/Project/Project.py	Sun Apr 15 12:04:17 2018 +0200
@@ -2241,6 +2241,10 @@
                 self.pdata["PROJECTTYPE"] in ["E6Plugin"])
             self.addLanguageAct.setEnabled(
                 bool(self.pdata["TRANSLATIONPATTERN"]))
+            self.makeGrp.setEnabled(
+                self.pdata["MAKEPARAMS"]["MakeEnabled"])
+            self.menuMakeAct.setEnabled(
+                self.pdata["MAKEPARAMS"]["MakeEnabled"])
             
             self.projectAboutToBeCreated.emit()
             
@@ -2890,6 +2894,10 @@
                         self.pdata["PROJECTTYPE"] in ["E6Plugin"])
                     self.addLanguageAct.setEnabled(
                         bool(self.pdata["TRANSLATIONPATTERN"]))
+                    self.makeGrp.setEnabled(
+                        self.pdata["MAKEPARAMS"]["MakeEnabled"])
+                    self.menuMakeAct.setEnabled(
+                        self.pdata["MAKEPARAMS"]["MakeEnabled"])
                     
                     self.__model.projectOpened()
                     self.projectOpenedHooks.emit()
@@ -3144,6 +3152,8 @@
         self.menuApidocAct.setEnabled(False)
         self.menuPackagersAct.setEnabled(False)
         self.pluginGrp.setEnabled(False)
+        self.makeGrp.setEnabled(False)
+        self.menuMakeAct.setEnabled(False)
         
         self.__model.projectClosed()
         self.projectClosedHooks.emit()
@@ -3670,7 +3680,6 @@
         """
         Public slot to initialize the project related actions.
         """
-        # TODO: add 'make' support
         self.actions = []
         
         self.actGrp1 = createActionGroup(self)
@@ -4119,6 +4128,36 @@
             self.__pluginCreateSnapshotArchives)
         self.actions.append(self.pluginSArchiveAct)
 
+        self.makeGrp = createActionGroup(self)
+
+        self.makeExecuteAct = E5Action(
+            self.tr('Execute Make'),
+            self.tr('&Execute Make'), 0, 0,
+            self.makeGrp, 'project_make_execute')
+        self.makeExecuteAct.setStatusTip(
+            self.tr("Perform a 'make' run."))
+        self.makeExecuteAct.setWhatsThis(self.tr(
+            """<b>Execute Make</b>"""
+            """<p>This performs a 'make' run to rebuild the configured"""
+            """ target.</p>"""
+        ))
+        self.makeExecuteAct.triggered.connect(self.__executeMake)
+        self.actions.append(self.makeExecuteAct)
+
+        self.makeTestAct = E5Action(
+            self.tr('Test for Changes'),
+            self.tr('&Test for Changes'), 0, 0,
+            self.makeGrp, 'project_make_test')
+        self.makeTestAct.setStatusTip(
+            self.tr("Question 'make', if a rebuild is needed."))
+        self.makeTestAct.setWhatsThis(self.tr(
+            """<b>Test for Changes</b>"""
+            """<p>This questions 'make', if a rebuild of the configured"""
+            """ target is necessary.</p>"""
+        ))
+        self.makeTestAct.triggered.connect(self.__questionMake)
+        self.actions.append(self.makeTestAct)
+
         self.closeAct.setEnabled(False)
         self.saveAct.setEnabled(False)
         self.saveasAct.setEnabled(False)
@@ -4137,7 +4176,6 @@
         
         @return the menu generated (QMenu)
         """
-        # TODO: add 'make' support
         menu = QMenu(self.tr('&Project'), self.parent())
         self.recentMenu = QMenu(self.tr('Open &Recent Projects'), menu)
         self.vcsMenu = QMenu(self.tr('&Version Control'), menu)
@@ -4153,7 +4191,7 @@
         self.apidocMenu.setTearOffEnabled(True)
         self.debuggerMenu = QMenu(self.tr('Debugger'), menu)
         self.packagersMenu = QMenu(self.tr('Pac&kagers'), menu)
-        self.packagersMenu.setTearOffEnabled(True)
+        self.makeMenu = QMenu(self.tr('Make'), menu)
         
         self.__menus = {
             "Main": menu,
@@ -4166,6 +4204,7 @@
             "Apidoc": self.apidocMenu,
             "Debugger": self.debuggerMenu,
             "Packagers": self.packagersMenu,
+            "Make": self.makeMenu,
         }
         
         # connect the aboutToShow signals
@@ -4179,6 +4218,7 @@
         self.packagersMenu.aboutToShow.connect(self.__showContextMenuPackagers)
         self.sessionMenu.aboutToShow.connect(self.__showContextMenuSession)
         self.debuggerMenu.aboutToShow.connect(self.__showContextMenuDebugger)
+        self.makeMenu.aboutToShow.connect(self.__showContextMenuMake)
         menu.aboutToShow.connect(self.__showMenu)
         
         # build the show menu
@@ -4202,9 +4242,15 @@
         self.debuggerMenu.addActions(self.dbgActGrp.actions())
         
         # build the packagers menu
+        self.packagersMenu.setTearOffEnabled(True)
         self.packagersMenu.addActions(self.pluginGrp.actions())
         self.packagersMenu.addSeparator()
         
+        # build the make menu
+        self.makeMenu.setTearOffEnabled(True)
+        self.makeMenu.addActions(self.makeGrp.actions())
+        self.makeMenu.addSeparator()
+        
         # build the main menu
         menu.setTearOffEnabled(True)
         menu.addActions(self.actGrp1.actions())
@@ -4220,6 +4266,8 @@
         menu.addSeparator()
         menu.addActions(self.actGrp2.actions())
         menu.addSeparator()
+        self.menuMakeAct = menu.addMenu(self.makeMenu)
+        menu.addSeparator()
         self.menuDiagramAct = menu.addMenu(self.graphicsMenu)
         menu.addSeparator()
         self.menuCheckAct = menu.addMenu(self.checksMenu)
@@ -4244,6 +4292,7 @@
         self.menuDebuggerAct.setEnabled(False)
         self.menuApidocAct.setEnabled(False)
         self.menuPackagersAct.setEnabled(False)
+        self.menuMakeAct.setEnabled(False)
         
         self.menu = menu
         return menu
@@ -4257,7 +4306,6 @@
             (E5ToolBarManager)
         @return tuple of the generated toolbars (tuple of two QToolBar)
         """
-        # TODO: add 'make' support
         tb = QToolBar(self.tr("Project"), self.ui)
         tb.setIconSize(UI.Config.ToolBarIconSize)
         tb.setObjectName("ProjectToolbar")
@@ -5353,7 +5401,12 @@
     ## Below are methods implementing the 'make' support
     #########################################################################
     
-    # TODO: add 'make' support
+    def __showContextMenuMake(self):
+        """
+        Private slot called before the make menu is shown.
+        """
+        self.showMenu.emit("Make", self.makeMenu)
+    
     @pyqtSlot()
     def executeMake(self):
         """
@@ -5361,6 +5414,7 @@
         """
         self.__executeMake(automatic=True)
     
+    @pyqtSlot()
     def __executeMake(self, automatic=False):
         """
         Private method to execute a project specific make run.
@@ -5371,6 +5425,7 @@
         # TODO: implement this
         pass
     
+    @pyqtSlot()
     def __questionMake(self):
         """
         Private method to question make for changes.

eric ide

mercurial