Commits

Angel Ezquerra  committed 7919d3a

workbench: add path tooltips to the urlCombo elements

The tooltip of each urlCombo element shows the path or paths that the alias
represents.

  • Participants
  • Parent commits c120e32
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/workbench.py

 
     def _setupUrlCombo(self, repo):
         """repository has been switched, fill urlCombo with URLs"""
-        aliases = [hglib.tounicode(alias)
-                   for alias, path in repo.ui.configitems('paths')]
+        pathdict = dict((hglib.tounicode(alias), hglib.tounicode(path))
+                         for alias, path in repo.ui.configitems('paths'))
+        aliases = pathdict.keys()
 
         # 1. Sort the list if aliases
         aliases.sort()
         aliases = combinedaliases + regularaliases
 
         self.urlCombo.clear()
-        for a in aliases:
+        for n, a in enumerate(aliases):
             # text, (pull-alias, push-alias)
             if isinstance(a, tuple):
-                self.urlCombo.addItem(u'\u2193 %s | %s \u2191' % a, a)
+                itemtext = u'\u2193 %s | %s \u2191' % a
+                itemdata = a
+                tooltip = _('pull: %s\npush: %s') % tuple(pathdict[alias]
+                    for alias in itemdata)
             else:
-                self.urlCombo.addItem(a, (a, a))
+                itemtext = a
+                itemdata = (a, a)
+                tooltip = pathdict[a]
+            self.urlCombo.addItem(itemtext, itemdata)
+            self.urlCombo.setItemData(n, tooltip, Qt.ToolTipRole)
 
     #@pyqtSlot()
     def _setupUrlComboIfCurrent(self):