Plugins/VcsPlugins/vcsMercurial/FetchExtension/ProjectHelper.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3345
071afe8be2a1
child 3656
441956d8fce5
--- a/Plugins/VcsPlugins/vcsMercurial/FetchExtension/ProjectHelper.py	Sun Mar 30 22:00:14 2014 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/FetchExtension/ProjectHelper.py	Thu Apr 03 23:05:31 2014 +0200
@@ -34,14 +34,14 @@
         Public method to generate the action objects.
         """
         self.hgFetchAct = E5Action(
-            self.trUtf8('Fetch changes'),
+            self.tr('Fetch changes'),
             UI.PixmapCache.getIcon("vcsUpdate.png"),
-            self.trUtf8('Fetch changes'),
+            self.tr('Fetch changes'),
             0, 0, self, 'mercurial_fetch')
-        self.hgFetchAct.setStatusTip(self.trUtf8(
+        self.hgFetchAct.setStatusTip(self.tr(
             'Fetch changes from a remote repository'
         ))
-        self.hgFetchAct.setWhatsThis(self.trUtf8(
+        self.hgFetchAct.setWhatsThis(self.tr(
             """<b>Fetch changes</b>"""
             """<p>This pulls changes from a remote repository into the """
             """local repository. If the pulled changes add a new branch"""
@@ -49,7 +49,7 @@
             """ the merge is committed. Otherwise, the working directory"""
             """ is updated to include the new changes.</p>"""
         ))
-        self.hgFetchAct.triggered[()].connect(self.__hgFetch)
+        self.hgFetchAct.triggered.connect(self.__hgFetch)
         self.actions.append(self.hgFetchAct)
     
     def initMenu(self, mainMenu):
@@ -65,15 +65,23 @@
         
         menu.addAction(self.hgFetchAct)
         
+        menu.aboutToShow.connect(self.__aboutToShowMenu)
+        
         return menu
     
+    def __aboutToShowMenu(self):
+        """
+        Private slot to handle the aboutToShow signal of the background menu.
+        """
+        self.hgFetchAct.setEnabled(self.vcs.canPull())
+    
     def menuTitle(self):
         """
         Public method to get the menu title.
         
         @return title of the menu (string)
         """
-        return self.trUtf8("Fetch")
+        return self.tr("Fetch")
     
     def __hgFetch(self):
         """
@@ -84,8 +92,8 @@
         if shouldReopen:
             res = E5MessageBox.yesNo(
                 None,
-                self.trUtf8("Fetch"),
-                self.trUtf8("""The project should be reread. Do this now?"""),
+                self.tr("Fetch"),
+                self.tr("""The project should be reread. Do this now?"""),
                 yesDefault=True)
             if res:
                 self.project.reopenProject()

eric ide

mercurial