eric6/Plugins/VcsPlugins/vcsGit/GitSubmodulesUpdateOptionsDialog.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7229
53054eb5b15a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitSubmodulesUpdateOptionsDialog.py	Sun Apr 14 15:09:21 2019 +0200
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2017 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to enter options for a submodule update command.
+"""
+
+from __future__ import unicode_literals
+
+from PyQt5.QtWidgets import QDialog
+
+from .Ui_GitSubmodulesUpdateOptionsDialog import \
+    Ui_GitSubmodulesUpdateOptionsDialog
+
+
+class GitSubmodulesUpdateOptionsDialog(QDialog,
+                                       Ui_GitSubmodulesUpdateOptionsDialog):
+    """
+    Class implementing a dialog to enter options for a submodule update
+    command.
+    """
+    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(GitSubmodulesUpdateOptionsDialog, self).__init__(parent)
+        self.setupUi(self)
+        
+        self.submodulesList.addItems(sorted(submodulePaths))
+    
+    def getData(self):
+        """
+        Public method to get the entered data.
+        
+        @return tuple containing the update procedure, a flag indicating an
+            init, a flag indicating an update with remote, a flag indicating
+            not to fetch the remote, a flag indicating an enforced operation
+            and a list of selected submodules.
+        @rtype tuple of (int, bool, bool, bool, bool, list of str)
+        """
+        submodulePaths = []
+        for itm in self.submodulesList.selectedItems():
+            submodulePaths.append(itm.text())
+        
+        if self.checkoutButton.isChecked():
+            procedure = "--checkout"
+        elif self.rebaseButton.isChecked():
+            procedure = "--rebase"
+        else:
+            procedure = "--merge"
+        
+        if self.remoteCheckBox.isChecked():
+            nofetch = self.nofetchCheckBox.isChecked()
+        else:
+            nofetch = False
+        
+        return (
+            procedure,
+            self.initCheckBox.isChecked(),
+            self.remoteCheckBox.isChecked(),
+            nofetch,
+            self.forceCheckBox.isChecked(),
+            submodulePaths,
+        )

eric ide

mercurial