15 |
15 |
16 class GitBundleDialog(QDialog, Ui_GitBundleDialog): |
16 class GitBundleDialog(QDialog, Ui_GitBundleDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to enter the data for a bundle operation. |
18 Class implementing a dialog to enter the data for a bundle operation. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, tagsList, branchesList, parent=None): |
21 def __init__(self, tagsList, branchesList, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param tagsList list of tags (list of strings) |
25 @param tagsList list of tags (list of strings) |
25 @param branchesList list of branches (list of strings) |
26 @param branchesList list of branches (list of strings) |
26 @param parent parent widget (QWidget) |
27 @param parent parent widget (QWidget) |
27 """ |
28 """ |
28 super().__init__(parent) |
29 super().__init__(parent) |
29 self.setupUi(self) |
30 self.setupUi(self) |
30 |
31 |
31 self.buttonBox.button( |
32 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
32 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
33 |
33 |
|
34 self.tagCombo.addItems(sorted(tagsList)) |
34 self.tagCombo.addItems(sorted(tagsList)) |
35 self.branchCombo.addItems(["master"] + sorted(branchesList)) |
35 self.branchCombo.addItems(["master"] + sorted(branchesList)) |
36 |
36 |
37 def __updateOK(self): |
37 def __updateOK(self): |
38 """ |
38 """ |
39 Private slot to update the OK button. |
39 Private slot to update the OK button. |
40 """ |
40 """ |
41 enabled = True |
41 enabled = True |
43 enabled = self.revisionsEdit.text() != "" |
43 enabled = self.revisionsEdit.text() != "" |
44 elif self.tagButton.isChecked(): |
44 elif self.tagButton.isChecked(): |
45 enabled = self.tagCombo.currentText() != "" |
45 enabled = self.tagCombo.currentText() != "" |
46 elif self.branchButton.isChecked(): |
46 elif self.branchButton.isChecked(): |
47 enabled = self.branchCombo.currentText() != "" |
47 enabled = self.branchCombo.currentText() != "" |
48 |
48 |
49 self.buttonBox.button( |
49 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) |
50 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) |
50 |
51 |
|
52 @pyqtSlot(bool) |
51 @pyqtSlot(bool) |
53 def on_revisionsButton_toggled(self, checked): |
52 def on_revisionsButton_toggled(self, checked): |
54 """ |
53 """ |
55 Private slot to handle changes of the revisions select button. |
54 Private slot to handle changes of the revisions select button. |
56 |
55 |
57 @param checked state of the button (boolean) |
56 @param checked state of the button (boolean) |
58 """ |
57 """ |
59 self.__updateOK() |
58 self.__updateOK() |
60 |
59 |
61 @pyqtSlot(bool) |
60 @pyqtSlot(bool) |
62 def on_tagButton_toggled(self, checked): |
61 def on_tagButton_toggled(self, checked): |
63 """ |
62 """ |
64 Private slot to handle changes of the Tag select button. |
63 Private slot to handle changes of the Tag select button. |
65 |
64 |
66 @param checked state of the button (boolean) |
65 @param checked state of the button (boolean) |
67 """ |
66 """ |
68 self.__updateOK() |
67 self.__updateOK() |
69 |
68 |
70 @pyqtSlot(bool) |
69 @pyqtSlot(bool) |
71 def on_branchButton_toggled(self, checked): |
70 def on_branchButton_toggled(self, checked): |
72 """ |
71 """ |
73 Private slot to handle changes of the Branch select button. |
72 Private slot to handle changes of the Branch select button. |
74 |
73 |
75 @param checked state of the button (boolean) |
74 @param checked state of the button (boolean) |
76 """ |
75 """ |
77 self.__updateOK() |
76 self.__updateOK() |
78 |
77 |
79 @pyqtSlot(str) |
78 @pyqtSlot(str) |
80 def on_revisionsEdit_textChanged(self, txt): |
79 def on_revisionsEdit_textChanged(self, txt): |
81 """ |
80 """ |
82 Private slot to handle changes of the Revisions edit. |
81 Private slot to handle changes of the Revisions edit. |
83 |
82 |
84 @param txt text of the line edit (string) |
83 @param txt text of the line edit (string) |
85 """ |
84 """ |
86 self.__updateOK() |
85 self.__updateOK() |
87 |
86 |
88 @pyqtSlot(str) |
87 @pyqtSlot(str) |
89 def on_tagCombo_editTextChanged(self, txt): |
88 def on_tagCombo_editTextChanged(self, txt): |
90 """ |
89 """ |
91 Private slot to handle changes of the Tag combo. |
90 Private slot to handle changes of the Tag combo. |
92 |
91 |
93 @param txt text of the combo (string) |
92 @param txt text of the combo (string) |
94 """ |
93 """ |
95 self.__updateOK() |
94 self.__updateOK() |
96 |
95 |
97 @pyqtSlot(str) |
96 @pyqtSlot(str) |
98 def on_branchCombo_editTextChanged(self, txt): |
97 def on_branchCombo_editTextChanged(self, txt): |
99 """ |
98 """ |
100 Private slot to handle changes of the Branch combo. |
99 Private slot to handle changes of the Branch combo. |
101 |
100 |
102 @param txt text of the combo (string) |
101 @param txt text of the combo (string) |
103 """ |
102 """ |
104 self.__updateOK() |
103 self.__updateOK() |
105 |
104 |
106 def getData(self): |
105 def getData(self): |
107 """ |
106 """ |
108 Public method to retrieve the bundle data. |
107 Public method to retrieve the bundle data. |
109 |
108 |
110 @return list of revision expressions (list of strings) |
109 @return list of revision expressions (list of strings) |
111 """ |
110 """ |
112 if self.revisionsButton.isChecked(): |
111 if self.revisionsButton.isChecked(): |
113 revs = self.revisionsEdit.text().strip().split() |
112 revs = self.revisionsEdit.text().strip().split() |
114 elif self.tagButton.isChecked(): |
113 elif self.tagButton.isChecked(): |
115 revs = [self.tagCombo.currentText()] |
114 revs = [self.tagCombo.currentText()] |
116 elif self.branchButton.isChecked(): |
115 elif self.branchButton.isChecked(): |
117 revs = [self.branchCombo.currentText()] |
116 revs = [self.branchCombo.currentText()] |
118 else: |
117 else: |
119 revs = [] |
118 revs = [] |
120 |
119 |
121 return revs |
120 return revs |