Fixed an issue in the Mercurial status dialog causing the Add button menu to have largefiles entries enabled even when the extension is not active.

Fri, 07 Mar 2014 19:15:46 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 07 Mar 2014 19:15:46 +0100
changeset 3342
f8cd11fa94ed
parent 3341
7c015811fc4d
child 3343
f7a6d271bb40

Fixed an issue in the Mercurial status dialog causing the Add button menu to have largefiles entries enabled even when the extension is not active.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Fri Mar 07 19:13:06 2014 +0100
+++ b/Documentation/Help/source.qhp	Fri Mar 07 19:15:46 2014 +0100
@@ -6615,6 +6615,7 @@
       <keyword name="HgStatusDialog.__restoreMissing" id="HgStatusDialog.__restoreMissing" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html#HgStatusDialog.__restoreMissing" />
       <keyword name="HgStatusDialog.__revert" id="HgStatusDialog.__revert" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html#HgStatusDialog.__revert" />
       <keyword name="HgStatusDialog.__sbsDiff" id="HgStatusDialog.__sbsDiff" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html#HgStatusDialog.__sbsDiff" />
+      <keyword name="HgStatusDialog.__showAddMenu" id="HgStatusDialog.__showAddMenu" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html#HgStatusDialog.__showAddMenu" />
       <keyword name="HgStatusDialog.__showContextMenu" id="HgStatusDialog.__showContextMenu" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html#HgStatusDialog.__showContextMenu" />
       <keyword name="HgStatusDialog.__showError" id="HgStatusDialog.__showError" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html#HgStatusDialog.__showError" />
       <keyword name="HgStatusDialog.__updateButtons" id="HgStatusDialog.__updateButtons" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html#HgStatusDialog.__updateButtons" />
--- a/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html	Fri Mar 07 19:13:06 2014 +0100
+++ b/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html	Fri Mar 07 19:15:46 2014 +0100
@@ -134,6 +134,9 @@
 <td><a href="#HgStatusDialog.__sbsDiff">__sbsDiff</a></td>
 <td>Private slot to handle the Diff context menu entry.</td>
 </tr><tr>
+<td><a href="#HgStatusDialog.__showAddMenu">__showAddMenu</a></td>
+<td>Private slot to prepare the Add button menu before it is shown.</td>
+</tr><tr>
 <td><a href="#HgStatusDialog.__showContextMenu">__showContextMenu</a></td>
 <td>Protected slot to show the context menu of the status list.</td>
 </tr><tr>
@@ -400,6 +403,11 @@
 <b>__sbsDiff</b>(<i></i>)
 <p>
         Private slot to handle the Diff context menu entry.
+</p><a NAME="HgStatusDialog.__showAddMenu" ID="HgStatusDialog.__showAddMenu"></a>
+<h4>HgStatusDialog.__showAddMenu</h4>
+<b>__showAddMenu</b>(<i></i>)
+<p>
+        Private slot to prepare the Add button menu before it is shown.
 </p><a NAME="HgStatusDialog.__showContextMenu" ID="HgStatusDialog.__showContextMenu"></a>
 <h4>HgStatusDialog.__showContextMenu</h4>
 <b>__showContextMenu</b>(<i>coord</i>)
--- a/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py	Fri Mar 07 19:13:06 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py	Fri Mar 07 19:15:46 2014 +0100
@@ -115,13 +115,17 @@
                 self.__showContextMenu)
         
         if not mq and self.vcs.version >= (2, 0):
+            self.__lfAddActions = []
             self.__addButtonMenu = QMenu()
             self.__addButtonMenu.addAction(self.tr("Add"), self.__add)
-            self.__addButtonMenu.addAction(self.tr("Add as Large File"),
-                                           lambda: self.__lfAdd("large"))
-            self.__addButtonMenu.addAction(self.tr("Add as Normal File"),
-                                           lambda: self.__lfAdd("normal"))
+            self.__lfAddActions.append(
+                self.__addButtonMenu.addAction(self.tr("Add as Large File"),
+                                               lambda: self.__lfAdd("large")))
+            self.__lfAddActions.append(
+                self.__addButtonMenu.addAction(self.tr("Add as Normal File"),
+                                               lambda: self.__lfAdd("normal")))
             self.addButton.setMenu(self.__addButtonMenu)
+            self.__addButtonMenu.aboutToShow.connect(self.__showAddMenu)
         
         self.modifiedIndicators = [
             self.tr('added'),
@@ -603,6 +607,14 @@
             act.setEnabled(enable)
         self.menu.popup(self.mapToGlobal(coord))
     
+    def __showAddMenu(self):
+        """
+        Private slot to prepare the Add button menu before it is shown.
+        """
+        enable = self.vcs.isExtensionActive("largefiles")
+        for act in self.__lfAddActions:
+            act.setEnabled(enable)
+    
     def __commit(self):
         """
         Private slot to handle the Commit context menu entry.

eric ide

mercurial