Plugins/VcsPlugins/vcsGit/GitBisectStartDialog.py

changeset 6020
baf6da1ae288
child 6048
82ad8ec9548c
diff -r 58ecdaf0b789 -r baf6da1ae288 Plugins/VcsPlugins/vcsGit/GitBisectStartDialog.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/VcsPlugins/vcsGit/GitBisectStartDialog.py	Sun Dec 10 17:42:11 2017 +0100
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2014 - 2017 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to enter the data for an extended bisect start.
+"""
+
+from __future__ import unicode_literals
+
+from PyQt5.QtCore import pyqtSlot
+from PyQt5.QtWidgets import QDialog, QDialogButtonBox
+
+from .Ui_GitBisectStartDialog import Ui_GitBisectStartDialog
+
+
+class GitBisectStartDialog(QDialog, Ui_GitBisectStartDialog):
+    """
+    Class implementing a dialog to enter the data for an extended bisect start.
+    """
+    def __init__(self, parent=None):
+        """
+        Constructor
+        
+        @param parent reference to the parent widget (QWidget)
+        """
+        super(GitBisectStartDialog, self).__init__(parent)
+        self.setupUi(self)
+       
+        self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
+        self.okButton.setEnabled(False)
+        
+        msh = self.minimumSizeHint()
+        self.resize(max(self.width(), msh.width()), msh.height())
+    
+    def __updateOK(self):
+        """
+        Private method used to enable/disable the OK-button.
+        """
+        enable = self.badEdit.text() != ""
+        self.okButton.setEnabled(enable)
+    
+    @pyqtSlot(str)
+    def on_badEdit_textChanged(self, txt):
+        """
+        Private slot to handle a change of the bad commit.
+        
+        @param txt bad commit entered (string)
+        """
+        self.__updateOK()
+    
+    def getData(self):
+        """
+        Public method to get the entered data.
+        
+        @return tuple containing a bad commit (string), a list of good
+            commits (list of strings) and a flag indicating to not
+            checkout the working tree (boolean)
+        """
+        return (
+            self.badEdit.text().strip(),
+            self.goodEdit.text().strip().split(),
+            self.noCheckoutCheckBox.isChecked(),
+        )

eric ide

mercurial