src/eric7/Plugins/VcsPlugins/vcsGit/GitDialog.py

branch
eric7
changeset 10438
4cd7e5a8b3cf
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10437:2f70ca07f0af 10438:4cd7e5a8b3cf
37 37
38 def __init__(self, text, git=None, parent=None): 38 def __init__(self, text, git=None, parent=None):
39 """ 39 """
40 Constructor 40 Constructor
41 41
42 @param text text to be shown by the label (string) 42 @param text text to be shown by the label
43 @param git reference to the Git interface object (Git) 43 @type str
44 @param parent parent widget (QWidget) 44 @param git reference to the Git interface object
45 @type Git
46 @param parent parent widget
47 @type QWidget
45 """ 48 """
46 super().__init__(parent) 49 super().__init__(parent)
47 self.setupUi(self) 50 self.setupUi(self)
48 51
49 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) 52 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False)
96 99
97 def on_buttonBox_clicked(self, button): 100 def on_buttonBox_clicked(self, button):
98 """ 101 """
99 Private slot called by a button of the button box clicked. 102 Private slot called by a button of the button box clicked.
100 103
101 @param button button that was clicked (QAbstractButton) 104 @param button button that was clicked
105 @type QAbstractButton
102 """ 106 """
103 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): 107 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close):
104 self.close() 108 self.close()
105 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): 109 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel):
106 self.statusLabel.setText(self.tr("Process canceled.")) 110 self.statusLabel.setText(self.tr("Process canceled."))
108 112
109 def __procFinished(self, exitCode, exitStatus): 113 def __procFinished(self, exitCode, exitStatus):
110 """ 114 """
111 Private slot connected to the finished signal. 115 Private slot connected to the finished signal.
112 116
113 @param exitCode exit code of the process (integer) 117 @param exitCode exit code of the process
114 @param exitStatus exit status of the process (QProcess.ExitStatus) 118 @type int
119 @param exitStatus exit status of the process
120 @type QProcess.ExitStatus
115 """ 121 """
116 self.normal = (exitStatus == QProcess.ExitStatus.NormalExit) and (exitCode == 0) 122 self.normal = (exitStatus == QProcess.ExitStatus.NormalExit) and (exitCode == 0)
117 if self.normal: 123 if self.normal:
118 self.statusLabel.setText(self.tr("Process finished successfully.")) 124 self.statusLabel.setText(self.tr("Process finished successfully."))
119 elif exitStatus == QProcess.ExitStatus.CrashExit: 125 elif exitStatus == QProcess.ExitStatus.CrashExit:
126 132
127 def startProcess(self, args, workingDir=None, showArgs=True, environment=None): 133 def startProcess(self, args, workingDir=None, showArgs=True, environment=None):
128 """ 134 """
129 Public slot used to start the process. 135 Public slot used to start the process.
130 136
131 @param args list of arguments for the process (list of strings) 137 @param args list of arguments for the process
132 @param workingDir working directory for the process (string) 138 @type list of str
133 @param showArgs flag indicating to show the arguments (boolean) 139 @param workingDir working directory for the process
140 @type str
141 @param showArgs flag indicating to show the arguments
142 @type bool
134 @param environment dictionary of environment settings to add 143 @param environment dictionary of environment settings to add
135 or change for the git process (dict of string and string) 144 or change for the git process
136 @return flag indicating a successful start of the process (boolean) 145 @type dict
146 @return flag indicating a successful start of the process
147 @rtype bool
137 """ 148 """
138 self.errorGroup.hide() 149 self.errorGroup.hide()
139 self.normal = False 150 self.normal = False
140 self.intercept = False 151 self.intercept = False
141 152
194 205
195 def normalExit(self): 206 def normalExit(self):
196 """ 207 """
197 Public method to check for a normal process termination. 208 Public method to check for a normal process termination.
198 209
199 @return flag indicating normal process termination (boolean) 210 @return flag indicating normal process termination
211 @rtype bool
200 """ 212 """
201 return self.normal 213 return self.normal
202 214
203 def normalExitWithoutErrors(self): 215 def normalExitWithoutErrors(self):
204 """ 216 """
205 Public method to check for a normal process termination without 217 Public method to check for a normal process termination without
206 error messages. 218 error messages.
207 219
208 @return flag indicating normal process termination (boolean) 220 @return flag indicating normal process termination
221 @rtype bool
209 """ 222 """
210 return self.normal and self.errors.toPlainText() == "" 223 return self.normal and self.errors.toPlainText() == ""
211 224
212 def __readStdout(self): 225 def __readStdout(self):
213 """ 226 """
226 239
227 def __showOutput(self, out): 240 def __showOutput(self, out):
228 """ 241 """
229 Private slot to show some output. 242 Private slot to show some output.
230 243
231 @param out output to be shown (string) 244 @param out output to be shown
245 @type str
232 """ 246 """
233 self.resultbox.insertPlainText(out) 247 self.resultbox.insertPlainText(out)
234 self.resultbox.ensureCursorVisible() 248 self.resultbox.ensureCursorVisible()
235 249
236 # check for a changed project file 250 # check for a changed project file
259 273
260 def __showError(self, out): 274 def __showError(self, out):
261 """ 275 """
262 Private slot to show some error. 276 Private slot to show some error.
263 277
264 @param out error to be shown (string) 278 @param out error to be shown
279 @type str
265 """ 280 """
266 self.errorGroup.show() 281 self.errorGroup.show()
267 self.errors.insertPlainText(out) 282 self.errors.insertPlainText(out)
268 self.errors.ensureCursorVisible() 283 self.errors.ensureCursorVisible()
269 284
271 286
272 def on_passwordCheckBox_toggled(self, isOn): 287 def on_passwordCheckBox_toggled(self, isOn):
273 """ 288 """
274 Private slot to handle the password checkbox toggled. 289 Private slot to handle the password checkbox toggled.
275 290
276 @param isOn flag indicating the status of the check box (boolean) 291 @param isOn flag indicating the status of the check box
292 @type bool
277 """ 293 """
278 if isOn: 294 if isOn:
279 self.input.setEchoMode(QLineEdit.EchoMode.Password) 295 self.input.setEchoMode(QLineEdit.EchoMode.Password)
280 else: 296 else:
281 self.input.setEchoMode(QLineEdit.EchoMode.Normal) 297 self.input.setEchoMode(QLineEdit.EchoMode.Normal)
309 325
310 def keyPressEvent(self, evt): 326 def keyPressEvent(self, evt):
311 """ 327 """
312 Protected slot to handle a key press event. 328 Protected slot to handle a key press event.
313 329
314 @param evt the key press event (QKeyEvent) 330 @param evt the key press event
331 @type QKeyEvent
315 """ 332 """
316 if self.intercept: 333 if self.intercept:
317 self.intercept = False 334 self.intercept = False
318 evt.accept() 335 evt.accept()
319 return 336 return
321 338
322 def hasAddOrDelete(self): 339 def hasAddOrDelete(self):
323 """ 340 """
324 Public method to check, if the last action contained an add or delete. 341 Public method to check, if the last action contained an add or delete.
325 342
326 @return flag indicating the presence of an add or delete (boolean) 343 @return flag indicating the presence of an add or delete
344 @rtype bool
327 """ 345 """
328 return self.__hasAddOrDelete 346 return self.__hasAddOrDelete

eric ide

mercurial