15 |
15 |
16 class GitCherryPickDialog(QDialog, Ui_GitCherryPickDialog): |
16 class GitCherryPickDialog(QDialog, Ui_GitCherryPickDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to enter cherry-pick data. |
18 Class implementing a dialog to enter cherry-pick data. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, commits=None, parent=None): |
21 def __init__(self, commits=None, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param commits list of commits to show in the commits pane (list of |
25 @param commits list of commits to show in the commits pane (list of |
25 strings) |
26 strings) |
26 @param parent reference to the parent widget (QWidget) |
27 @param parent reference to the parent widget (QWidget) |
27 """ |
28 """ |
28 super().__init__(parent) |
29 super().__init__(parent) |
29 self.setupUi(self) |
30 self.setupUi(self) |
30 |
31 |
31 if commits: |
32 if commits: |
32 self.commitsEdit.setPlainText("\n".join(commits)) |
33 self.commitsEdit.setPlainText("\n".join(commits)) |
33 |
34 |
34 self.on_commitsEdit_textChanged() |
35 self.on_commitsEdit_textChanged() |
35 |
36 |
36 @pyqtSlot() |
37 @pyqtSlot() |
37 def on_commitsEdit_textChanged(self): |
38 def on_commitsEdit_textChanged(self): |
38 """ |
39 """ |
39 Private slot to react upon changes of commits. |
40 Private slot to react upon changes of commits. |
40 """ |
41 """ |
41 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
42 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
42 self.commitsEdit.toPlainText() != "") |
43 self.commitsEdit.toPlainText() != "" |
43 |
44 ) |
|
45 |
44 def getData(self): |
46 def getData(self): |
45 """ |
47 """ |
46 Public method to retrieve the entered data. |
48 Public method to retrieve the entered data. |
47 |
49 |
48 @return tuple with list of commits, a flag indicating to append |
50 @return tuple with list of commits, a flag indicating to append |
49 cherry-pick info to the commit message, a flag indicating to append |
51 cherry-pick info to the commit message, a flag indicating to append |
50 a signed-off-by line to the commit message and a flag indicating to |
52 a signed-off-by line to the commit message and a flag indicating to |
51 not commit the action (list of strings, boolean, boolean, boolean) |
53 not commit the action (list of strings, boolean, boolean, boolean) |
52 """ |
54 """ |
53 return (self.commitsEdit.toPlainText().strip().splitlines(), |
55 return ( |
54 self.appendCheckBox.isChecked(), |
56 self.commitsEdit.toPlainText().strip().splitlines(), |
55 self.signoffCheckBox.isChecked(), |
57 self.appendCheckBox.isChecked(), |
56 self.nocommitCheckBox.isChecked()) |
58 self.signoffCheckBox.isChecked(), |
|
59 self.nocommitCheckBox.isChecked(), |
|
60 ) |