Commits

Yuya Nishihara committed ec5e4f0

repowidget: clear infobar at start of sync operation (fixes #965)

When we start new sync operation, the previous notification should be canceled.
This patch adds syncStarted signal in order to know the start of sync, which
is triggered by both repo widget (main toolbar) and sync widget.

  • Participants
  • Parent commits 46957e6
  • Branches stable

Comments (0)

Files changed (2)

File tortoisehg/hgqt/repowidget.py

         w.setFocus()  # to handle key press by InfoBar
         return w
 
+    @pyqtSlot()
     def clearInfoBar(self, priority=None):
         """Close current infobar if available; return True if got empty"""
         it = self._infobarlayout.itemAt(0)
         if not it:
             return True
         if priority is None or it.widget().infobartype <= priority:
+            # removes current infobar explicitly, because close() seems to
+            # delay deletion until next eventloop.
+            self._infobarlayout.removeItem(it)
             it.widget().close()
             return True
         else:
         sw.output.connect(self._showOutputOnInfoBar)
         sw.progress.connect(self.progress)
         sw.makeLogVisible.connect(self.makeLogVisible)
+        sw.syncStarted.connect(self.clearInfoBar)
         sw.outgoingNodes.connect(self.setOutgoingNodes)
         sw.showMessage.connect(self.showMessage)
         sw.showMessage.connect(self._showMessageOnInfoBar)

File tortoisehg/hgqt/sync.py

     return user, host, port, folder, passwd, scheme
 
 class SyncWidget(QWidget, qtlib.TaskWidget):
+    syncStarted = pyqtSignal()  # incoming/outgoing/pull/push started
     outgoingNodes = pyqtSignal(object)
     incomingBundle = pyqtSignal(QString)
     showMessage = pyqtSignal(unicode)
     ##
 
     def inclicked(self):
+        self.syncStarted.emit()
         url = self.currentUrl(True)
         urlu = hglib.tounicode(url)
         self.showMessage.emit(_('Getting incoming changesets from %s...') % urlu)
             self.run(cmdline, ('force', 'branch', 'rev', 'subrepos'))
 
     def pullclicked(self):
+        self.syncStarted.emit()
         url = self.currentUrl(True)
         urlu = hglib.tounicode(url)
         def finished(ret, output):
         self.run(cmdline, ('force', 'branch', 'rev', 'bookmark'))
 
     def outclicked(self):
+        self.syncStarted.emit()
         url = self.currentUrl(True)
         urlu = hglib.tounicode(url)
         self.showMessage.emit(_('Finding outgoing changesets to %s...') % urlu)
         self.run(['--repository', self.repo.root, 'p4pending', '--verbose'], ())
 
     def pushclicked(self, confirm, rev=None, branch=None):
+        self.syncStarted.emit()
         url = self.currentUrl(True)
         urlu = hglib.tounicode(url)
         if (not hg.islocal(self.currentUrl(False)) and confirm