--- a/eric6/Plugins/VcsPlugins/vcsGit/GitStashBrowserDialog.py Fri Oct 09 17:19:29 2020 +0200 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitStashBrowserDialog.py Sat Oct 10 12:20:51 2020 +0200 @@ -11,13 +11,13 @@ import os from PyQt5.QtCore import pyqtSlot, Qt, QPoint, QProcess, QTimer -from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import ( QWidget, QDialogButtonBox, QTreeWidgetItem, QAbstractButton, QMenu, QHeaderView, QApplication, QLineEdit ) from E5Gui import E5MessageBox +from E5Gui.E5OverrideCursor import E5OverrideCursorProcess from .Ui_GitStashBrowserDialog import Ui_GitStashBrowserDialog @@ -69,10 +69,10 @@ self.__ioEncoding = Preferences.getSystem("IOEncoding") - self.process = QProcess() - self.process.finished.connect(self.__procFinished) - self.process.readyReadStandardOutput.connect(self.__readStdout) - self.process.readyReadStandardError.connect(self.__readStderr) + self.__process = E5OverrideCursorProcess() + self.__process.finished.connect(self.__procFinished) + self.__process.readyReadStandardOutput.connect(self.__readStdout) + self.__process.readyReadStandardError.connect(self.__readStderr) self.__contextMenu = QMenu() self.__differencesAct = self.__contextMenu.addAction( @@ -98,12 +98,12 @@ @param e close event (QCloseEvent) """ if ( - self.process is not None and - self.process.state() != QProcess.NotRunning + self.__process is not None and + self.__process.state() != QProcess.NotRunning ): - self.process.terminate() - QTimer.singleShot(2000, self.process.kill) - self.process.waitForFinished(3000) + self.__process.terminate() + QTimer.singleShot(2000, self.__process.kill) + self.__process.waitForFinished(3000) self.__position = self.pos() @@ -154,9 +154,6 @@ self.inputGroup.show() self.refreshButton.setEnabled(False) - QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) - QApplication.processEvents() - self.buf = [] self.errors.clear() self.intercept = False @@ -165,15 +162,15 @@ args.append("list") args.append("--format=format:%gd{0}%ai{0}%gs%n".format(self.Separator)) - self.process.kill() + self.__process.kill() - self.process.setWorkingDirectory(self.repodir) + self.__process.setWorkingDirectory(self.repodir) self.inputGroup.setEnabled(True) self.inputGroup.show() - self.process.start('git', args) - procStarted = self.process.waitForStarted(5000) + self.__process.start('git', args) + procStarted = self.__process.waitForStarted(5000) if not procStarted: self.inputGroup.setEnabled(False) self.inputGroup.hide() @@ -226,14 +223,12 @@ the button. """ if ( - self.process is not None and - self.process.state() != QProcess.NotRunning + self.__process is not None and + self.__process.state() != QProcess.NotRunning ): - self.process.terminate() - QTimer.singleShot(2000, self.process.kill) - self.process.waitForFinished(3000) - - QApplication.restoreOverrideCursor() + self.__process.terminate() + QTimer.singleShot(2000, self.__process.kill) + self.__process.waitForFinished(3000) self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) @@ -264,10 +259,10 @@ It reads the output of the process and inserts it into a buffer. """ - self.process.setReadChannel(QProcess.StandardOutput) + self.__process.setReadChannel(QProcess.StandardOutput) - while self.process.canReadLine(): - line = str(self.process.readLine(), self.__ioEncoding, + while self.__process.canReadLine(): + line = str(self.__process.readLine(), self.__ioEncoding, 'replace').strip() if line: self.buf.append(line) @@ -279,8 +274,8 @@ It reads the error output of the process and inserts it into the error pane. """ - if self.process is not None: - s = str(self.process.readAllStandardError(), + if self.__process is not None: + s = str(self.__process.readAllStandardError(), self.__ioEncoding, 'replace') self.errorGroup.show() self.errors.insertPlainText(s) @@ -413,7 +408,7 @@ self.errors.ensureCursorVisible() self.errorGroup.show() - self.process.write(strToQByteArray(inputTxt)) + self.__process.write(strToQByteArray(inputTxt)) self.passwordCheckBox.setChecked(False) self.input.clear()