Plugins/VcsPlugins/vcsGit/GitSubmodulesSummaryOptionsDialog.py

changeset 6020
baf6da1ae288
child 6048
82ad8ec9548c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/VcsPlugins/vcsGit/GitSubmodulesSummaryOptionsDialog.py	Sun Dec 10 17:42:11 2017 +0100
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2017 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to enter submodule summary options.
+"""
+
+from __future__ import unicode_literals
+
+from PyQt5.QtWidgets import QDialog
+
+from .Ui_GitSubmodulesSummaryOptionsDialog import \
+    Ui_GitSubmodulesSummaryOptionsDialog
+
+
+class GitSubmodulesSummaryOptionsDialog(QDialog,
+                                        Ui_GitSubmodulesSummaryOptionsDialog):
+    """
+    Class implementing a dialog to enter submodule summary options.
+    """
+    def __init__(self, submodulePaths, parent=None):
+        """
+        Constructor
+        
+        @param submodulePaths list of submodule paths
+        @type list of str
+        @param parent reference to the parent widget
+        @type QWidget
+        """
+        super(GitSubmodulesSummaryOptionsDialog, self).__init__(parent)
+        self.setupUi(self)
+        
+        self.submodulesList.addItems(sorted(submodulePaths))
+    
+    def getData(self):
+        """
+        Public method to get the entered data.
+        
+        @return tuple containing a list of selected submodules, a flag
+            indicating to show summary for the superproject index, a flag
+            indicating to show summary for the submodules index, an optional
+            commit ID and a value for the number of entries to be shown
+        @rtype tuple of (list of str, bool, bool, str, int)
+        """
+        submodulePaths = []
+        for itm in self.submodulesList.selectedItems():
+            submodulePaths.append(itm.text())
+        
+        limit = self.limitSpinBox.value()
+        if limit == 0:
+            # adjust for unlimited
+            limit = -1
+        
+        superProject = self.filesCheckBox.isChecked()
+        if superProject:
+            index = False
+            commit = ""
+        else:
+            index = self.indexCheckBox.isChecked()
+            commit = self.commitEdit.text().strip()
+        
+        return submodulePaths, superProject, index, commit, limit

eric ide

mercurial