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