Commits

Yuya Nishihara  committed 6c2da58 Merge

Merge with stable

  • Participants
  • Parent commits 888c8ac, 91d44dc

Comments (0)

Files changed (1)

File tortoisehg/hgqt/workbench.py

                   enabled='repoopen', toolbar='sync')
         self.urlCombo = QComboBox(self)
         self.urlCombo.setSizeAdjustPolicy(QComboBox.AdjustToContents)
+        self.urlCombo.currentIndexChanged.connect(self._updateUrlComboToolTip)
         self.urlComboAction = self.synctbar.addWidget(self.urlCombo)
         # hide it because workbench could be started without open repo
         self.urlComboAction.setVisible(False)
             aliases.remove('default')
             aliases.insert(0, 'default')
 
+        self.urlCombo.blockSignals(True)
         self.urlCombo.clear()
         for n, a in enumerate(aliases):
             # text, (pull-alias, push-alias)
                 tooltip = pathdict[a]
             self.urlCombo.addItem(itemtext, itemdata)
             self.urlCombo.setItemData(n, tooltip, Qt.ToolTipRole)
+        self.urlCombo.blockSignals(False)
+        self._updateUrlComboToolTip(self.urlCombo.currentIndex())
 
     #@pyqtSlot()
     def _setupUrlComboIfCurrent(self):
         opindex = {'incoming': 0, 'pull': 0, 'outgoing': 1, 'push': 1}[op]
         return self.urlCombo.itemData(urlindex).toPyObject()[opindex]
 
+    @pyqtSlot(int)
+    def _updateUrlComboToolTip(self, index):
+        if not self.urlCombo.count():
+            tooltip = _('There are no configured sync paths.\n'
+                        'Open the Synchronize tab to configure them.')
+        else:
+            tooltip = self.urlCombo.itemData(index, Qt.ToolTipRole).toString()
+        self.urlCombo.setToolTip(tooltip)
+
     def _setupCustomTools(self, ui):
         tools, toollist = hglib.tortoisehgtools(ui,
             selectedlocation='workbench.custom-toolbar')