Yuya Nishihara avatar Yuya Nishihara committed 1f96811

workbench: include push/pull URL in tooltip of sync buttons (refs #2601)

Comments (0)

Files changed (1)

tortoisehg/hgqt/workbench.py

         self.menuView.addMenu(menu)
 
         newaction(_('Incoming'), data='incoming', icon='hg-incoming',
-                  tooltip=_('Check for incoming changes from selected URL'),
                   enabled='repoopen', toolbar='sync')
         newaction(_('Pull'), data='pull', icon='hg-pull',
-                  tooltip=_('Pull incoming changes from selected URL'),
                   enabled='repoopen', toolbar='sync')
         newaction(_('Outgoing'), data='outgoing', icon='hg-outgoing',
-                  tooltip=_('Detect outgoing changes to selected URL'),
                   enabled='repoopen', toolbar='sync')
         newaction(_('Push'), data='push', icon='hg-push',
-                  tooltip=_('Push outgoing changes to selected URL'),
                   enabled='repoopen', toolbar='sync')
         self.urlCombo = QComboBox(self)
         self.urlCombo.setSizeAdjustPolicy(QComboBox.AdjustToContents)
 
     @pyqtSlot(int)
     def _updateSyncUrlToolTip(self, index):
+        self._updateUrlComboToolTip(index)
+        self._updateSyncActionToolTip(index)
+
+    def _updateUrlComboToolTip(self, index):
         if not self.urlCombo.count():
             tooltip = _('There are no configured sync paths.\n'
                         'Open the Synchronize tab to configure them.')
             tooltip = self.urlCombo.itemData(index, Qt.ToolTipRole).toString()
         self.urlCombo.setToolTip(tooltip)
 
+    def _updateSyncActionToolTip(self, index):
+        if index < 0:
+            tooltips = {
+                'incoming': _('Check for incoming changes'),
+                'pull':     _('Pull incoming changes'),
+                'outgoing': _('Detect outgoing changes'),
+                'push':     _('Push outgoing changes'),
+                }
+        else:
+            pullurl, pushurl = self.urlCombo.itemData(index).toPyObject()
+            tooltips = {
+                'incoming': _('Check for incoming changes from\n%s') % pullurl,
+                'pull':     _('Pull incoming changes from\n%s') % pullurl,
+                'outgoing': _('Detect outgoing changes to\n%s') % pushurl,
+                'push':     _('Push outgoing changes to\n%s') % pushurl,
+                }
+
+        for a in self.synctbar.actions():
+            op = str(a.data().toString())
+            if op in tooltips:
+                a.setToolTip(tooltips[op])
+
     def _setupCustomTools(self, ui):
         tools, toollist = hglib.tortoisehgtools(ui,
             selectedlocation='workbench.custom-toolbar')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.