eric6/Plugins/VcsPlugins/vcsGit/GitDialog.py

changeset 8143
2c730d5fd177
parent 8047
b5594178c7fa
child 8176
31965986ecd1
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
39 @param parent parent widget (QWidget) 39 @param parent parent widget (QWidget)
40 """ 40 """
41 super(GitDialog, self).__init__(parent) 41 super(GitDialog, self).__init__(parent)
42 self.setupUi(self) 42 self.setupUi(self)
43 43
44 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 44 self.buttonBox.button(
45 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 45 QDialogButtonBox.StandardButton.Close).setEnabled(False)
46 self.buttonBox.button(
47 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
46 48
47 self.process = None 49 self.process = None
48 self.username = '' 50 self.username = ''
49 self.password = '' 51 self.password = ''
50 self.vcs = git 52 self.vcs = git
59 Private slot called when the process finished or the user pressed 61 Private slot called when the process finished or the user pressed
60 the button. 62 the button.
61 """ 63 """
62 if ( 64 if (
63 self.process is not None and 65 self.process is not None and
64 self.process.state() != QProcess.NotRunning 66 self.process.state() != QProcess.ProcessState.NotRunning
65 ): 67 ):
66 self.process.terminate() 68 self.process.terminate()
67 QTimer.singleShot(2000, self.process.kill) 69 QTimer.singleShot(2000, self.process.kill)
68 self.process.waitForFinished(3000) 70 self.process.waitForFinished(3000)
69 71
70 self.inputGroup.setEnabled(False) 72 self.inputGroup.setEnabled(False)
71 self.inputGroup.hide() 73 self.inputGroup.hide()
72 74
73 self.process = None 75 self.process = None
74 76
75 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 77 self.buttonBox.button(
76 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 78 QDialogButtonBox.StandardButton.Close).setEnabled(True)
77 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 79 self.buttonBox.button(
78 self.buttonBox.button(QDialogButtonBox.Close).setFocus( 80 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
79 Qt.OtherFocusReason) 81 self.buttonBox.button(
82 QDialogButtonBox.StandardButton.Close).setDefault(True)
83 self.buttonBox.button(
84 QDialogButtonBox.StandardButton.Close).setFocus(
85 Qt.FocusReason.OtherFocusReason)
80 86
81 if self.normal and self.errors.toPlainText(): 87 if self.normal and self.errors.toPlainText():
82 self.errorGroup.setTitle(self.tr("Additional Output")) 88 self.errorGroup.setTitle(self.tr("Additional Output"))
83 89
84 if ( 90 if (
92 """ 98 """
93 Private slot called by a button of the button box clicked. 99 Private slot called by a button of the button box clicked.
94 100
95 @param button button that was clicked (QAbstractButton) 101 @param button button that was clicked (QAbstractButton)
96 """ 102 """
97 if button == self.buttonBox.button(QDialogButtonBox.Close): 103 if button == self.buttonBox.button(
104 QDialogButtonBox.StandardButton.Close
105 ):
98 self.close() 106 self.close()
99 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 107 elif button == self.buttonBox.button(
108 QDialogButtonBox.StandardButton.Cancel
109 ):
100 self.statusLabel.setText(self.tr("Process canceled.")) 110 self.statusLabel.setText(self.tr("Process canceled."))
101 self.__finish() 111 self.__finish()
102 112
103 def __procFinished(self, exitCode, exitStatus): 113 def __procFinished(self, exitCode, exitStatus):
104 """ 114 """
105 Private slot connected to the finished signal. 115 Private slot connected to the finished signal.
106 116
107 @param exitCode exit code of the process (integer) 117 @param exitCode exit code of the process (integer)
108 @param exitStatus exit status of the process (QProcess.ExitStatus) 118 @param exitStatus exit status of the process (QProcess.ExitStatus)
109 """ 119 """
110 self.normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0) 120 self.normal = (
121 (exitStatus == QProcess.ExitStatus.NormalExit) and
122 (exitCode == 0)
123 )
111 if self.normal: 124 if self.normal:
112 self.statusLabel.setText(self.tr("Process finished successfully.")) 125 self.statusLabel.setText(self.tr("Process finished successfully."))
113 elif exitStatus == QProcess.CrashExit: 126 elif exitStatus == QProcess.ExitStatus.CrashExit:
114 self.statusLabel.setText(self.tr("Process crashed.")) 127 self.statusLabel.setText(self.tr("Process crashed."))
115 else: 128 else:
116 self.statusLabel.setText( 129 self.statusLabel.setText(
117 self.tr("Process finished with exit code {0}") 130 self.tr("Process finished with exit code {0}")
118 .format(exitCode)) 131 .format(exitCode))
259 Private slot to handle the password checkbox toggled. 272 Private slot to handle the password checkbox toggled.
260 273
261 @param isOn flag indicating the status of the check box (boolean) 274 @param isOn flag indicating the status of the check box (boolean)
262 """ 275 """
263 if isOn: 276 if isOn:
264 self.input.setEchoMode(QLineEdit.Password) 277 self.input.setEchoMode(QLineEdit.EchoMode.Password)
265 else: 278 else:
266 self.input.setEchoMode(QLineEdit.Normal) 279 self.input.setEchoMode(QLineEdit.EchoMode.Normal)
267 280
268 @pyqtSlot() 281 @pyqtSlot()
269 def on_sendButton_clicked(self): 282 def on_sendButton_clicked(self):
270 """ 283 """
271 Private slot to send the input to the git process. 284 Private slot to send the input to the git process.

eric ide

mercurial