eric6/CondaInterface/CondaExecDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
34 @type QWidget 34 @type QWidget
35 """ 35 """
36 super(CondaExecDialog, self).__init__(parent) 36 super(CondaExecDialog, self).__init__(parent)
37 self.setupUi(self) 37 self.setupUi(self)
38 38
39 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 39 self.buttonBox.button(
40 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 40 QDialogButtonBox.StandardButton.Close).setEnabled(False)
41 self.buttonBox.button(
42 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
41 43
42 self.__condaCommand = command 44 self.__condaCommand = command
43 45
44 self.__process = None 46 self.__process = None
45 self.__condaExe = Preferences.getConda("CondaExecutable") 47 self.__condaExe = Preferences.getConda("CondaExecutable")
52 Private slot called by a button of the button box clicked. 54 Private slot called by a button of the button box clicked.
53 55
54 @param button button that was clicked 56 @param button button that was clicked
55 @type QAbstractButton 57 @type QAbstractButton
56 """ 58 """
57 if button == self.buttonBox.button(QDialogButtonBox.Close): 59 if button == self.buttonBox.button(
60 QDialogButtonBox.StandardButton.Close
61 ):
58 self.accept() 62 self.accept()
59 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 63 elif button == self.buttonBox.button(
64 QDialogButtonBox.StandardButton.Cancel
65 ):
60 self.__finish(1, 0) 66 self.__finish(1, 0)
61 67
62 def start(self, arguments): 68 def start(self, arguments):
63 """ 69 """
64 Public slot to start the conda command. 70 Public slot to start the conda command.
115 @type QProcess.ExitStatus 121 @type QProcess.ExitStatus
116 @param giveUp flag indicating to not start another attempt 122 @param giveUp flag indicating to not start another attempt
117 @type bool 123 @type bool
118 """ 124 """
119 if (self.__process is not None and 125 if (self.__process is not None and
120 self.__process.state() != QProcess.NotRunning): 126 self.__process.state() != QProcess.ProcessState.NotRunning):
121 self.__process.terminate() 127 self.__process.terminate()
122 QTimer.singleShot(2000, self.__process.kill) 128 QTimer.singleShot(2000, self.__process.kill)
123 self.__process.waitForFinished(3000) 129 self.__process.waitForFinished(3000)
124 130
125 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 131 self.buttonBox.button(
126 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 132 QDialogButtonBox.StandardButton.Close).setEnabled(True)
127 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 133 self.buttonBox.button(
134 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
135 self.buttonBox.button(
136 QDialogButtonBox.StandardButton.Close).setDefault(True)
128 137
129 self.progressLabel.hide() 138 self.progressLabel.hide()
130 self.progressBar.hide() 139 self.progressBar.hide()
131 140
132 self.__statusOk = exitCode == 0 141 self.__statusOk = exitCode == 0
256 Private slot to handle the readyReadStandardError signal. 265 Private slot to handle the readyReadStandardError signal.
257 266
258 It reads the error output of the process and inserts it into the 267 It reads the error output of the process and inserts it into the
259 error pane. 268 error pane.
260 """ 269 """
261 self.__process.setReadChannel(QProcess.StandardError) 270 self.__process.setReadChannel(QProcess.ProcessChannel.StandardError)
262 271
263 while self.__process.canReadLine(): 272 while self.__process.canReadLine():
264 stderr = str(self.__process.readLine(), 273 stderr = str(self.__process.readLine(),
265 Preferences.getSystem("IOEncoding"), 274 Preferences.getSystem("IOEncoding"),
266 'replace') 275 'replace')

eric ide

mercurial