7 Module implementing a dialog to enter submodule summary options. |
7 Module implementing a dialog to enter submodule summary options. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtWidgets import QDialog |
10 from PyQt6.QtWidgets import QDialog |
11 |
11 |
12 from .Ui_GitSubmodulesSummaryOptionsDialog import ( |
12 from .Ui_GitSubmodulesSummaryOptionsDialog import Ui_GitSubmodulesSummaryOptionsDialog |
13 Ui_GitSubmodulesSummaryOptionsDialog |
|
14 ) |
|
15 |
13 |
16 |
14 |
17 class GitSubmodulesSummaryOptionsDialog(QDialog, |
15 class GitSubmodulesSummaryOptionsDialog(QDialog, Ui_GitSubmodulesSummaryOptionsDialog): |
18 Ui_GitSubmodulesSummaryOptionsDialog): |
|
19 """ |
16 """ |
20 Class implementing a dialog to enter submodule summary options. |
17 Class implementing a dialog to enter submodule summary options. |
21 """ |
18 """ |
|
19 |
22 def __init__(self, submodulePaths, parent=None): |
20 def __init__(self, submodulePaths, parent=None): |
23 """ |
21 """ |
24 Constructor |
22 Constructor |
25 |
23 |
26 @param submodulePaths list of submodule paths |
24 @param submodulePaths list of submodule paths |
27 @type list of str |
25 @type list of str |
28 @param parent reference to the parent widget |
26 @param parent reference to the parent widget |
29 @type QWidget |
27 @type QWidget |
30 """ |
28 """ |
31 super().__init__(parent) |
29 super().__init__(parent) |
32 self.setupUi(self) |
30 self.setupUi(self) |
33 |
31 |
34 self.submodulesList.addItems(sorted(submodulePaths)) |
32 self.submodulesList.addItems(sorted(submodulePaths)) |
35 |
33 |
36 def getData(self): |
34 def getData(self): |
37 """ |
35 """ |
38 Public method to get the entered data. |
36 Public method to get the entered data. |
39 |
37 |
40 @return tuple containing a list of selected submodules, a flag |
38 @return tuple containing a list of selected submodules, a flag |
41 indicating to show summary for the superproject index, a flag |
39 indicating to show summary for the superproject index, a flag |
42 indicating to show summary for the submodules index, an optional |
40 indicating to show summary for the submodules index, an optional |
43 commit ID and a value for the number of entries to be shown |
41 commit ID and a value for the number of entries to be shown |
44 @rtype tuple of (list of str, bool, bool, str, int) |
42 @rtype tuple of (list of str, bool, bool, str, int) |
45 """ |
43 """ |
46 submodulePaths = [] |
44 submodulePaths = [] |
47 for itm in self.submodulesList.selectedItems(): |
45 for itm in self.submodulesList.selectedItems(): |
48 submodulePaths.append(itm.text()) |
46 submodulePaths.append(itm.text()) |
49 |
47 |
50 limit = self.limitSpinBox.value() |
48 limit = self.limitSpinBox.value() |
51 if limit == 0: |
49 if limit == 0: |
52 # adjust for unlimited |
50 # adjust for unlimited |
53 limit = -1 |
51 limit = -1 |
54 |
52 |
55 superProject = self.filesCheckBox.isChecked() |
53 superProject = self.filesCheckBox.isChecked() |
56 if superProject: |
54 if superProject: |
57 index = False |
55 index = False |
58 commit = "" |
56 commit = "" |
59 else: |
57 else: |
60 index = self.indexCheckBox.isChecked() |
58 index = self.indexCheckBox.isChecked() |
61 commit = self.commitEdit.text().strip() |
59 commit = self.commitEdit.text().strip() |
62 |
60 |
63 return submodulePaths, superProject, index, commit, limit |
61 return submodulePaths, superProject, index, commit, limit |