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