Commits

Steve Borho committed 2a9c0a4

mq: disable toolbar while cmdui.Runner is busy

  • Participants
  • Parent commits c875c46
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/mq.py

 from tortoisehg.hgqt import qtlib, cmdui, rejects, commit, qscilib
 from tortoisehg.hgqt import qqueue, fileview
 
-# TODO: Disable MQ toolbar while cmdui.Runner is busy
-
 class MQWidget(QWidget):
     showMessage = pyqtSignal(unicode)
     output = pyqtSignal(QString, QString)
         layout.setContentsMargins(0, 0, 0, 0)
         self.queueFrame.setLayout(layout)
 
-        qtbarhbox = QHBoxLayout()
+        self.qtbar = qtbarhbox = QHBoxLayout()
         qtbarhbox.setSpacing(5)
         layout.addLayout(qtbarhbox, 0)
         qtbarhbox.setContentsMargins(0, 0, 0, 0)
 
     @pyqtSlot(int)
     def onCommandFinished(self, ret):
+        self.qtbar.setEnabled(True)
         self.repo.decrementBusyCount()
         if ret is not 0:
             pass # TODO: look for reject notifications
         self.repo.incrementBusyCount()
         cmdline = ['qpush', '-R', self.repo.root, '--all']
         cmdline += self.getUserOptions('force', 'exact')
+        self.qtbar.setEnabled(False)
         self.cmd.run(cmdline)
 
     @pyqtSlot()
         self.repo.incrementBusyCount()
         cmdline = ['qpush', '-R', self.repo.root]
         cmdline += self.getUserOptions('force', 'exact')
+        self.qtbar.setEnabled(False)
         self.cmd.run(cmdline)
 
     @pyqtSlot()
         self.repo.incrementBusyCount()
         cmdline = ['qpop', '-R', self.repo.root, '--all']
         cmdline += self.getUserOptions('force')
+        self.qtbar.setEnabled(False)
         self.cmd.run(cmdline)
 
     @pyqtSlot()
         self.repo.incrementBusyCount()
         cmdline = ['qpop', '-R', self.repo.root]
         cmdline += self.getUserOptions('force')
+        self.qtbar.setEnabled(False)
         self.cmd.run(cmdline)
 
     @pyqtSlot()
         cmdline += self.getUserOptions('force')
         cmdline += ['--move', '--', patch]
         self.repo.incrementBusyCount()
+        self.qtbar.setEnabled(False)
         self.cmd.run(cmdline)
 
     @pyqtSlot()
         if self.cmd.running():
             return
         self.repo.incrementBusyCount()
+        self.qtbar.setEnabled(False)
         self.cmd.run(cmdline)
 
     @pyqtSlot()
         cmdline += self.getUserOptions('force')
         cmdline += ['--', item._thgpatch]
         self.repo.incrementBusyCount()
+        self.qtbar.setEnabled(False)
         self.cmd.run(cmdline)
 
     #@pyqtSlot(QListWidgetItem)
         if self.cmd.running():
             return
         self.repo.incrementBusyCount()
+        self.qtbar.setEnabled(False)
         self.cmd.run(['qrename', '-R', self.repo.root, '--',
                       item._thgpatch, hglib.fromunicode(item.text())])
 
         else:
             cmdline += ['--exclude', self.repo.root]
         self.repo.incrementBusyCount()
+        self.qtbar.setEnabled(False)
         self.cmd.run(cmdline)
 
     @pyqtSlot()
             self.reload()
         else:
             self.repo.incrementBusyCount()
+            self.qtbar.setEnabled(False)
             self.cmd.run(['qinit', '-c', '-R', self.repo.root])
 
     @pyqtSlot()
         cmdline = ['qselect', '-R', self.repo.root]
         cmdline += newguards or ['--none']
         self.repo.incrementBusyCount()
+        self.qtbar.setEnabled(False)
         self.cmd.run(cmdline)
 
     # Capture drop events, try to import into current patch queue