eric6/Plugins/VcsPlugins/vcsMercurial/HgDialog.py

changeset 7441
f115f4469795
parent 7370
5fb53279f2df
child 7679
5816200f021b
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgDialog.py	Sat Mar 07 13:03:19 2020 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgDialog.py	Sat Mar 07 17:22:14 2020 +0100
@@ -92,6 +92,7 @@
         @return flag indicating a successful start of the process
         """
         self.errorGroup.hide()
+        self.inputGroup.hide()
         self.normal = False
         
         self.__hasAddOrDelete = False
@@ -111,7 +112,11 @@
             self.resultbox.append('')
         
         out, err = self.vcs.getClient().runcommand(
-            args, output=self.__showOutput, error=self.__showError)
+            args,
+            prompt=self.__getInput,
+            output=self.__showOutput,
+            error=self.__showError
+        )
         
         if err:
             self.__showError(err)
@@ -178,3 +183,31 @@
         @return flag indicating the presence of an add or delete (boolean)
         """
         return self.__hasAddOrDelete
+    
+    def __getInput(self, size, message):
+        """
+        Private method to get some input from the user.
+        
+        @param size maximum length of the requested input
+        @type int
+        @param message message sent by the server
+        @type str
+        @return tuple containing data entered by the user and
+            a flag indicating a password input
+        @rtype tuple of (str, bool)
+        """
+        self.inputGroup.show()
+        self.input.setMaxLength(size)
+        self.input.setFocus(Qt.OtherFocusReason)
+        
+        from PyQt5.QtCore import QEventLoop
+        loop = QEventLoop(self)
+        self.sendButton.clicked[bool].connect(loop.quit)
+        loop.exec_()
+        message = self.input.text() + "\n"
+        isPassword = self.passwordCheckBox.isChecked()
+        
+        self.input.clear()
+        self.inputGroup.hide()
+        
+        return message, isPassword

eric ide

mercurial