16 class GitSubmodulesDeinitDialog(QDialog, Ui_GitSubmodulesDeinitDialog): |
16 class GitSubmodulesDeinitDialog(QDialog, Ui_GitSubmodulesDeinitDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to get the data for a submodule deinit |
18 Class implementing a dialog to get the data for a submodule deinit |
19 operation. |
19 operation. |
20 """ |
20 """ |
|
21 |
21 def __init__(self, submodulePaths, parent=None): |
22 def __init__(self, submodulePaths, parent=None): |
22 """ |
23 """ |
23 Constructor |
24 Constructor |
24 |
25 |
25 @param submodulePaths list of submodule paths |
26 @param submodulePaths list of submodule paths |
26 @type list of str |
27 @type list of str |
27 @param parent reference to the parent widget |
28 @param parent reference to the parent widget |
28 @type QWidget |
29 @type QWidget |
29 """ |
30 """ |
30 super().__init__(parent) |
31 super().__init__(parent) |
31 self.setupUi(self) |
32 self.setupUi(self) |
32 |
33 |
33 self.submodulesList.addItems(sorted(submodulePaths)) |
34 self.submodulesList.addItems(sorted(submodulePaths)) |
34 |
35 |
35 self.buttonBox.button( |
36 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
36 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
37 |
37 |
|
38 def __updateOK(self): |
38 def __updateOK(self): |
39 """ |
39 """ |
40 Private slot to update the state of the OK button. |
40 Private slot to update the state of the OK button. |
41 """ |
41 """ |
42 enable = ( |
42 enable = ( |
43 self.allCheckBox.isChecked() or |
43 self.allCheckBox.isChecked() or len(self.submodulesList.selectedItems()) > 0 |
44 len(self.submodulesList.selectedItems()) > 0 |
|
45 ) |
44 ) |
46 self.buttonBox.button( |
45 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enable) |
47 QDialogButtonBox.StandardButton.Ok).setEnabled(enable) |
46 |
48 |
|
49 @pyqtSlot(bool) |
47 @pyqtSlot(bool) |
50 def on_allCheckBox_toggled(self, checked): |
48 def on_allCheckBox_toggled(self, checked): |
51 """ |
49 """ |
52 Private slot to react on changes of the all checkbox. |
50 Private slot to react on changes of the all checkbox. |
53 |
51 |
54 @param checked state of the checkbox |
52 @param checked state of the checkbox |
55 @type bool |
53 @type bool |
56 """ |
54 """ |
57 self.__updateOK() |
55 self.__updateOK() |
58 |
56 |
59 @pyqtSlot() |
57 @pyqtSlot() |
60 def on_submodulesList_itemSelectionChanged(self): |
58 def on_submodulesList_itemSelectionChanged(self): |
61 """ |
59 """ |
62 Private slot to react on changes of the submodule selection. |
60 Private slot to react on changes of the submodule selection. |
63 """ |
61 """ |
64 self.__updateOK() |
62 self.__updateOK() |
65 |
63 |
66 def getData(self): |
64 def getData(self): |
67 """ |
65 """ |
68 Public method to get the entered data. |
66 Public method to get the entered data. |
69 |
67 |
70 @return tuple containing a flag to indicate all submodules, a list of |
68 @return tuple containing a flag to indicate all submodules, a list of |
71 selected submodules and a flag indicating an enforced operation |
69 selected submodules and a flag indicating an enforced operation |
72 @rtype tuple of (bool, list of str, bool) |
70 @rtype tuple of (bool, list of str, bool) |
73 """ |
71 """ |
74 submodulePaths = [] |
72 submodulePaths = [] |
75 deinitAll = self.allCheckBox.isChecked() |
73 deinitAll = self.allCheckBox.isChecked() |
76 if not deinitAll: |
74 if not deinitAll: |
77 for itm in self.submodulesList.selectedItems(): |
75 for itm in self.submodulesList.selectedItems(): |
78 submodulePaths.append(itm.text()) |
76 submodulePaths.append(itm.text()) |
79 |
77 |
80 return all, submodulePaths, self.forceCheckBox.isChecked() |
78 return all, submodulePaths, self.forceCheckBox.isChecked() |