Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.2, 1.9.3, and 2.0

cmdui: simplify Dialog class

Changeset e691cb1202f9

Parent 6f34e4bb60f1

by Steve Borho

Changes to one file · Browse files at e691cb1202f9 Showing diff from parent 6f34e4bb60f1 Diff from another changeset...

 
704
705
706
707
708
709
710
711
 
712
713
714
715
716
717
718
719
720
 
721
722
723
 
735
736
737
738
 
 
 
739
740
741
 
775
776
777
778
 
779
780
781
 
786
787
788
789
790
791
792
793
 
 
794
795
796
 
797
798
799
800
801
802
803
804
805
806
807
808
 
704
705
706
 
 
 
 
 
707
708
709
710
 
 
711
 
 
 
712
713
714
715
 
727
728
729
 
730
731
732
733
734
735
 
769
770
771
 
772
773
774
775
 
780
781
782
 
 
783
 
 
784
785
786
787
 
788
789
790
791
 
 
 
 
 
 
792
793
794
@@ -704,20 +704,12 @@
 class Dialog(QDialog):   """A dialog for running random Mercurial command"""   - commandStarted = pyqtSignal() - commandFinished = pyqtSignal(int) - commandCanceling = pyqtSignal() - - def __init__(self, cmdline, parent=None, finishfunc=None): + def __init__(self, cmdline, parent=None):   super(Dialog, self).__init__(parent)   self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)   - self.finishfunc = finishfunc -   self.core = Core(True, self) - self.core.commandStarted.connect(self.commandStarted) - self.core.commandFinished.connect(self.command_finished) - self.core.commandCanceling.connect(self.commandCanceling) + self.core.commandFinished.connect(self.commandFinished)     vbox = QVBoxLayout()   vbox.setSpacing(4) @@ -735,7 +727,9 @@
  # bottom buttons   buttons = QDialogButtonBox()   self.cancel_btn = buttons.addButton(QDialogButtonBox.Cancel) - self.cancel_btn.clicked.connect(self.cancel_clicked) + self.cancel_btn.clicked.connect(self.core.cancel) + self.core.commandCanceling.connect(self.commandCanceling) +   self.close_btn = buttons.addButton(QDialogButtonBox.Close)   self.close_btn.clicked.connect(self.reject)   self.detail_btn = buttons.addButton(_('Detail'), @@ -775,7 +769,7 @@
  ' to terminate?'), QMessageBox.Yes | QMessageBox.No,   QMessageBox.No)   if ret == QMessageBox.Yes: - self.cancel_clicked() + self.core.cancel()     # don't close dialog   return @@ -786,23 +780,15 @@
  else:   super(Dialog, self).reject()   - ### Signal Handlers ### -   @pyqtSlot() - def cancel_clicked(self): - self.core.cancel() + def commandCanceling(self): + self.cancel_btn.setDisabled(True)     @pyqtSlot(int) - def command_finished(self, ret): + def commandFinished(self, ret):   self.cancel_btn.setHidden(True)   self.close_btn.setShown(True)   self.close_btn.setFocus() - if self.finishfunc: - self.finishfunc() - - @pyqtSlot() - def command_canceling(self): - self.cancel_btn.setDisabled(True)    class Runner(QWidget):   """A component for running Mercurial command without UI