Added click functions to the project browser VCS status LED.

Fri, 14 Mar 2014 17:50:29 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 14 Mar 2014 17:50:29 +0100
changeset 3369
6580dc0fe205
parent 3367
1da8faa43f99
child 3370
c8c6e31b9d41

Added click functions to the project browser VCS status LED.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Project.ProjectBrowser.html file | annotate | diff | comparison | revisions
Project/ProjectBrowser.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Thu Mar 13 19:21:59 2014 +0100
+++ b/Documentation/Help/source.qhp	Fri Mar 14 17:50:29 2014 +0100
@@ -9024,6 +9024,7 @@
       <keyword name="ProjectBrowser.__setBrowsersAvailable" id="ProjectBrowser.__setBrowsersAvailable" ref="eric5.Project.ProjectBrowser.html#ProjectBrowser.__setBrowsersAvailable" />
       <keyword name="ProjectBrowser.__setSourcesIcon" id="ProjectBrowser.__setSourcesIcon" ref="eric5.Project.ProjectBrowser.html#ProjectBrowser.__setSourcesIcon" />
       <keyword name="ProjectBrowser.__vcsStateChanged" id="ProjectBrowser.__vcsStateChanged" ref="eric5.Project.ProjectBrowser.html#ProjectBrowser.__vcsStateChanged" />
+      <keyword name="ProjectBrowser.__vcsStatusIndicatorClicked" id="ProjectBrowser.__vcsStatusIndicatorClicked" ref="eric5.Project.ProjectBrowser.html#ProjectBrowser.__vcsStatusIndicatorClicked" />
       <keyword name="ProjectBrowser.getProjectBrowser" id="ProjectBrowser.getProjectBrowser" ref="eric5.Project.ProjectBrowser.html#ProjectBrowser.getProjectBrowser" />
       <keyword name="ProjectBrowser.getProjectBrowsers" id="ProjectBrowser.getProjectBrowsers" ref="eric5.Project.ProjectBrowser.html#ProjectBrowser.getProjectBrowsers" />
       <keyword name="ProjectBrowser.handleEditorChanged" id="ProjectBrowser.handleEditorChanged" ref="eric5.Project.ProjectBrowser.html#ProjectBrowser.handleEditorChanged" />
--- a/Documentation/Source/eric5.Project.ProjectBrowser.html	Thu Mar 13 19:21:59 2014 +0100
+++ b/Documentation/Source/eric5.Project.ProjectBrowser.html	Fri Mar 14 17:50:29 2014 +0100
@@ -91,6 +91,9 @@
 <td><a href="#ProjectBrowser.__vcsStateChanged">__vcsStateChanged</a></td>
 <td>Private slot to handle a change in the vcs state.</td>
 </tr><tr>
+<td><a href="#ProjectBrowser.__vcsStatusIndicatorClicked">__vcsStatusIndicatorClicked</a></td>
+<td>Private slot to react upon clicks on the VCS indicator LED.</td>
+</tr><tr>
 <td><a href="#ProjectBrowser.getProjectBrowser">getProjectBrowser</a></td>
 <td>Public method to get a reference to the named project browser.</td>
 </tr><tr>
@@ -188,6 +191,16 @@
 <dd>
 new vcs state (string)
 </dd>
+</dl><a NAME="ProjectBrowser.__vcsStatusIndicatorClicked" ID="ProjectBrowser.__vcsStatusIndicatorClicked"></a>
+<h4>ProjectBrowser.__vcsStatusIndicatorClicked</h4>
+<b>__vcsStatusIndicatorClicked</b>(<i>pos</i>)
+<p>
+        Private slot to react upon clicks on the VCS indicator LED.
+</p><dl>
+<dt><i>pos</i></dt>
+<dd>
+position of the click (QPoint)
+</dd>
 </dl><a NAME="ProjectBrowser.getProjectBrowser" ID="ProjectBrowser.getProjectBrowser"></a>
 <h4>ProjectBrowser.getProjectBrowser</h4>
 <b>getProjectBrowser</b>(<i>name</i>)
--- a/Project/ProjectBrowser.py	Thu Mar 13 19:21:59 2014 +0100
+++ b/Project/ProjectBrowser.py	Fri Mar 14 17:50:29 2014 +0100
@@ -13,7 +13,7 @@
 from UI.Browser import Browser
 
 from E5Gui.E5TabWidget import E5TabWidget
-from E5Gui.E5Led import E5Led
+from E5Gui.E5Led import E5ClickableLed
 
 import UI.PixmapCache
 import Preferences
@@ -52,8 +52,10 @@
         
         self.setUsesScrollButtons(True)
         
-        self.vcsStatusIndicator = E5Led(self)
+        self.vcsStatusIndicator = E5ClickableLed(self)
         self.setCornerWidget(self.vcsStatusIndicator, Qt.TopLeftCorner)
+        self.vcsStatusIndicator.clicked.connect(
+            self.__vcsStatusIndicatorClicked)
         self.vcsStatusColorNames = {
             "A": "VcsAdded",
             "M": "VcsModified",
@@ -382,3 +384,18 @@
             self.vcsStatusIndicator.setToolTip(self.tr("unknown status"))
         else:
             self.vcsStatusIndicator.setToolTip(self.vcsStatusText[state])
+    
+    def __vcsStatusIndicatorClicked(self, pos):
+        """
+        Private slot to react upon clicks on the VCS indicator LED.
+        
+        @param pos position of the click (QPoint)
+        """
+        vcs = self.project.getVcs()
+        if vcs:
+            if self.currentVcsStatus == " ":
+                # call log browser dialog
+                vcs.vcsLogBrowser(self.project.getProjectPath())
+            else:
+                # call status dialog
+                vcs.vcsStatus(self.project.getProjectPath())

eric ide

mercurial