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