|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2014 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to enter the data for an extended bisect start. |
|
8 """ |
|
9 |
|
10 from PyQt6.QtCore import pyqtSlot |
|
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
|
12 |
|
13 from .Ui_GitBisectStartDialog import Ui_GitBisectStartDialog |
|
14 |
|
15 |
|
16 class GitBisectStartDialog(QDialog, Ui_GitBisectStartDialog): |
|
17 """ |
|
18 Class implementing a dialog to enter the data for an extended bisect start. |
|
19 """ |
|
20 def __init__(self, parent=None): |
|
21 """ |
|
22 Constructor |
|
23 |
|
24 @param parent reference to the parent widget (QWidget) |
|
25 """ |
|
26 super().__init__(parent) |
|
27 self.setupUi(self) |
|
28 |
|
29 self.okButton = self.buttonBox.button( |
|
30 QDialogButtonBox.StandardButton.Ok) |
|
31 self.okButton.setEnabled(False) |
|
32 |
|
33 msh = self.minimumSizeHint() |
|
34 self.resize(max(self.width(), msh.width()), msh.height()) |
|
35 |
|
36 def __updateOK(self): |
|
37 """ |
|
38 Private method used to enable/disable the OK-button. |
|
39 """ |
|
40 enable = self.badEdit.text() != "" |
|
41 self.okButton.setEnabled(enable) |
|
42 |
|
43 @pyqtSlot(str) |
|
44 def on_badEdit_textChanged(self, txt): |
|
45 """ |
|
46 Private slot to handle a change of the bad commit. |
|
47 |
|
48 @param txt bad commit entered (string) |
|
49 """ |
|
50 self.__updateOK() |
|
51 |
|
52 def getData(self): |
|
53 """ |
|
54 Public method to get the entered data. |
|
55 |
|
56 @return tuple containing a bad commit (string), a list of good |
|
57 commits (list of strings) and a flag indicating to not |
|
58 checkout the working tree (boolean) |
|
59 """ |
|
60 return ( |
|
61 self.badEdit.text().strip(), |
|
62 self.goodEdit.text().strip().split(), |
|
63 self.noCheckoutCheckBox.isChecked(), |
|
64 ) |