eric6/Plugins/VcsPlugins/vcsMercurial/HgDialog.py

changeset 7441
f115f4469795
parent 7370
5fb53279f2df
child 7679
5816200f021b
equal deleted inserted replaced
7440:ea9c904def73 7441:f115f4469795
90 @keyparam environment dictionary of environment settings to add 90 @keyparam environment dictionary of environment settings to add
91 or change for the git process (dict of string and string) 91 or change for the git process (dict of string and string)
92 @return flag indicating a successful start of the process 92 @return flag indicating a successful start of the process
93 """ 93 """
94 self.errorGroup.hide() 94 self.errorGroup.hide()
95 self.inputGroup.hide()
95 self.normal = False 96 self.normal = False
96 97
97 self.__hasAddOrDelete = False 98 self.__hasAddOrDelete = False
98 if ( 99 if (
99 args[0] in ["fetch", "qpush", "qpop", "qgoto", "rebase", 100 args[0] in ["fetch", "qpush", "qpop", "qgoto", "rebase",
109 if showArgs: 110 if showArgs:
110 self.resultbox.append(' '.join(args)) 111 self.resultbox.append(' '.join(args))
111 self.resultbox.append('') 112 self.resultbox.append('')
112 113
113 out, err = self.vcs.getClient().runcommand( 114 out, err = self.vcs.getClient().runcommand(
114 args, output=self.__showOutput, error=self.__showError) 115 args,
116 prompt=self.__getInput,
117 output=self.__showOutput,
118 error=self.__showError
119 )
115 120
116 if err: 121 if err:
117 self.__showError(err) 122 self.__showError(err)
118 if out: 123 if out:
119 self.__showOutput(out) 124 self.__showOutput(out)
176 Public method to check, if the last action contained an add or delete. 181 Public method to check, if the last action contained an add or delete.
177 182
178 @return flag indicating the presence of an add or delete (boolean) 183 @return flag indicating the presence of an add or delete (boolean)
179 """ 184 """
180 return self.__hasAddOrDelete 185 return self.__hasAddOrDelete
186
187 def __getInput(self, size, message):
188 """
189 Private method to get some input from the user.
190
191 @param size maximum length of the requested input
192 @type int
193 @param message message sent by the server
194 @type str
195 @return tuple containing data entered by the user and
196 a flag indicating a password input
197 @rtype tuple of (str, bool)
198 """
199 self.inputGroup.show()
200 self.input.setMaxLength(size)
201 self.input.setFocus(Qt.OtherFocusReason)
202
203 from PyQt5.QtCore import QEventLoop
204 loop = QEventLoop(self)
205 self.sendButton.clicked[bool].connect(loop.quit)
206 loop.exec_()
207 message = self.input.text() + "\n"
208 isPassword = self.passwordCheckBox.isChecked()
209
210 self.input.clear()
211 self.inputGroup.hide()
212
213 return message, isPassword

eric ide

mercurial