Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.

Sat, 23 Feb 2013 11:29:01 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 23 Feb 2013 11:29:01 +0100
changeset 2427
46481fe988d2
parent 2426
da76c71624de
child 2428
11e6e63a89d0

Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Project.Project.html file | annotate | diff | comparison | revisions
Project/Project.py file | annotate | diff | comparison | revisions
diff -r da76c71624de -r 46481fe988d2 Documentation/Help/source.qch
Binary file Documentation/Help/source.qch has changed
diff -r da76c71624de -r 46481fe988d2 Documentation/Help/source.qhp
--- a/Documentation/Help/source.qhp	Sun Feb 17 19:07:15 2013 +0100
+++ b/Documentation/Help/source.qhp	Sat Feb 23 11:29:01 2013 +0100
@@ -8236,9 +8236,11 @@
       <keyword name="Project.__showCodeMetrics" id="Project.__showCodeMetrics" ref="eric5.Project.Project.html#Project.__showCodeMetrics" />
       <keyword name="Project.__showContextMenuApiDoc" id="Project.__showContextMenuApiDoc" ref="eric5.Project.Project.html#Project.__showContextMenuApiDoc" />
       <keyword name="Project.__showContextMenuChecks" id="Project.__showContextMenuChecks" ref="eric5.Project.Project.html#Project.__showContextMenuChecks" />
+      <keyword name="Project.__showContextMenuDebugger" id="Project.__showContextMenuDebugger" ref="eric5.Project.Project.html#Project.__showContextMenuDebugger" />
       <keyword name="Project.__showContextMenuGraphics" id="Project.__showContextMenuGraphics" ref="eric5.Project.Project.html#Project.__showContextMenuGraphics" />
       <keyword name="Project.__showContextMenuPackagers" id="Project.__showContextMenuPackagers" ref="eric5.Project.Project.html#Project.__showContextMenuPackagers" />
       <keyword name="Project.__showContextMenuRecent" id="Project.__showContextMenuRecent" ref="eric5.Project.Project.html#Project.__showContextMenuRecent" />
+      <keyword name="Project.__showContextMenuSession" id="Project.__showContextMenuSession" ref="eric5.Project.Project.html#Project.__showContextMenuSession" />
       <keyword name="Project.__showContextMenuShow" id="Project.__showContextMenuShow" ref="eric5.Project.Project.html#Project.__showContextMenuShow" />
       <keyword name="Project.__showContextMenuVCS" id="Project.__showContextMenuVCS" ref="eric5.Project.Project.html#Project.__showContextMenuVCS" />
       <keyword name="Project.__showDebugProperties" id="Project.__showDebugProperties" ref="eric5.Project.Project.html#Project.__showDebugProperties" />
diff -r da76c71624de -r 46481fe988d2 Documentation/Source/eric5.Project.Project.html
--- a/Documentation/Source/eric5.Project.Project.html	Sun Feb 17 19:07:15 2013 +0100
+++ b/Documentation/Source/eric5.Project.Project.html	Sat Feb 23 11:29:01 2013 +0100
@@ -275,6 +275,9 @@
 <td><a href="#Project.__showContextMenuChecks">__showContextMenuChecks</a></td>
 <td>Private slot called before the checks menu is shown.</td>
 </tr><tr>
+<td><a href="#Project.__showContextMenuDebugger">__showContextMenuDebugger</a></td>
+<td>Private slot called before the Debugger menu is shown.</td>
+</tr><tr>
 <td><a href="#Project.__showContextMenuGraphics">__showContextMenuGraphics</a></td>
 <td>Private slot called before the graphics menu is shown.</td>
 </tr><tr>
@@ -284,6 +287,9 @@
 <td><a href="#Project.__showContextMenuRecent">__showContextMenuRecent</a></td>
 <td>Private method to set up the recent projects menu.</td>
 </tr><tr>
+<td><a href="#Project.__showContextMenuSession">__showContextMenuSession</a></td>
+<td>Private slot called before the Session menu is shown.</td>
+</tr><tr>
 <td><a href="#Project.__showContextMenuShow">__showContextMenuShow</a></td>
 <td>Private slot called before the show menu is shown.</td>
 </tr><tr>
@@ -984,6 +990,11 @@
 <b>__showContextMenuChecks</b>(<i></i>)
 <p>
         Private slot called before the checks menu is shown.
+</p><a NAME="Project.__showContextMenuDebugger" ID="Project.__showContextMenuDebugger"></a>
+<h4>Project.__showContextMenuDebugger</h4>
+<b>__showContextMenuDebugger</b>(<i></i>)
+<p>
+        Private slot called before the Debugger menu is shown.
 </p><a NAME="Project.__showContextMenuGraphics" ID="Project.__showContextMenuGraphics"></a>
 <h4>Project.__showContextMenuGraphics</h4>
 <b>__showContextMenuGraphics</b>(<i></i>)
@@ -999,6 +1010,11 @@
 <b>__showContextMenuRecent</b>(<i></i>)
 <p>
         Private method to set up the recent projects menu.
+</p><a NAME="Project.__showContextMenuSession" ID="Project.__showContextMenuSession"></a>
+<h4>Project.__showContextMenuSession</h4>
+<b>__showContextMenuSession</b>(<i></i>)
+<p>
+        Private slot called before the Session menu is shown.
 </p><a NAME="Project.__showContextMenuShow" ID="Project.__showContextMenuShow"></a>
 <h4>Project.__showContextMenuShow</h4>
 <b>__showContextMenuShow</b>(<i></i>)
diff -r da76c71624de -r 46481fe988d2 Project/Project.py
--- a/Project/Project.py	Sun Feb 17 19:07:15 2013 +0100
+++ b/Project/Project.py	Sat Feb 23 11:29:01 2013 +0100
@@ -19,7 +19,7 @@
 from PyQt4.QtCore import QFile, QFileInfo, pyqtSignal, QCryptographicHash, QIODevice, \
     QByteArray, QObject, Qt
 from PyQt4.QtGui import QCursor, QLineEdit, QToolBar, QDialog, QInputDialog, \
-    QApplication, QMenu
+    QApplication, QMenu, QAction
 
 from E5Gui.E5Application import e5App
 from E5Gui import E5FileDialog, E5MessageBox
@@ -805,6 +805,22 @@
                 self.trUtf8("<p>The user specific project properties file <b>{0}</b>"
                     " could not be written.</p>").format(fn))
         
+    def __showContextMenuSession(self):
+        """
+        Private slot called before the Session menu is shown.
+        """
+        enable = True
+        if self.pfile is None:
+            enable = False
+        else:
+            fn, ext = os.path.splitext(os.path.basename(self.pfile))
+            fn = os.path.join(self.getProjectManagementDir(),
+                              '{0}.e4s'.format(fn))
+            enable = os.path.exists(fn)
+        self.sessActGrp.findChild(QAction, "project_load_session").setEnabled(enable)
+        self.sessActGrp.findChild(QAction, "project_delete_session").setEnabled(enable)
+        
+        
     def __readSession(self, quiet=False, indicator=""):
         """
         Private method to read in the project session file (.e4s)
@@ -939,6 +955,23 @@
         TasksWriter(f, True, os.path.splitext(os.path.basename(fn))[0]).writeXML()
         f.close()
         
+    def __showContextMenuDebugger(self):
+        """
+        Private slot called before the Debugger menu is shown.
+        """
+        enable = True
+        if self.pfile is None:
+            enable = False
+        else:
+            fn, ext = os.path.splitext(os.path.basename(self.pfile))
+            fn = os.path.join(self.getProjectManagementDir(),
+                              '{0}.e4d'.format(fn))
+            enable = os.path.exists(fn)
+        self.dbgActGrp.findChild(QAction, "project_debugger_properties_load")\
+            .setEnabled(enable)
+        self.dbgActGrp.findChild(QAction, "project_debugger_properties_delete")\
+            .setEnabled(enable)
+        
     def __readDebugProperties(self, quiet=False):
         """
         Private method to read in the project debugger properties file (.e4d)
@@ -3483,6 +3516,8 @@
         self.graphicsMenu.aboutToShow.connect(self.__showContextMenuGraphics)
         self.apidocMenu.aboutToShow.connect(self.__showContextMenuApiDoc)
         self.packagersMenu.aboutToShow.connect(self.__showContextMenuPackagers)
+        self.sessionMenu.aboutToShow.connect(self.__showContextMenuSession)
+        self.debuggerMenu.aboutToShow.connect(self.__showContextMenuDebugger)
         menu.aboutToShow.connect(self.__showMenu)
         
         # build the show menu

eric ide

mercurial