--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Fri Oct 09 17:19:29 2020 +0200 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Sat Oct 10 12:20:51 2020 +0200 @@ -13,8 +13,7 @@ from PyQt5.QtCore import pyqtSlot, Qt, QDate, QRegExp, QSize, QPoint, QFileInfo from PyQt5.QtGui import ( - QCursor, QColor, QPixmap, QPainter, QPen, QBrush, QIcon, QTextCursor, - QPalette + QColor, QPixmap, QPainter, QPen, QBrush, QIcon, QTextCursor, QPalette ) from PyQt5.QtWidgets import ( QWidget, QDialogButtonBox, QHeaderView, QTreeWidgetItem, QApplication, @@ -23,6 +22,7 @@ from E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog +from E5Gui.E5OverrideCursor import E5OverrideCursor from .Ui_HgLogBrowserDialog import Ui_HgLogBrowserDialog @@ -968,89 +968,87 @@ self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) QApplication.processEvents() - QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) - QApplication.processEvents() - - self.buf = [] - self.cancelled = False - self.errors.clear() - self.intercept = False - - if noEntries == 0: - noEntries = self.limitSpinBox.value() - - preargs = [] - args = self.vcs.initCommand(self.commandMode) - args.append('--verbose') - if self.commandMode not in ("incoming", "outgoing"): - args.append('--limit') - args.append(str(noEntries)) - if self.commandMode in ("incoming", "outgoing"): - args.append("--newest-first") - if self.vcs.hasSubrepositories(): - args.append("--subrepos") - if startRev is not None: - args.append('--rev') - args.append('{0}:0'.format(startRev)) - if ( - not self.projectMode and - not self.fname == "." and - not self.stopCheckBox.isChecked() - ): - args.append('--follow') - if self.commandMode == "log": - args.append('--copies') - args.append('--template') - args.append(os.path.join(os.path.dirname(__file__), - "templates", - "logBrowserBookmarkPhase.tmpl")) - if self.commandMode == "incoming": - if self.__bundle: - args.append(self.__bundle) - elif not self.vcs.hasSubrepositories(): - project = e5App().getObject("Project") - self.vcs.bundleFile = os.path.join( - project.getProjectManagementDir(), "hg-bundle.hg") - if os.path.exists(self.vcs.bundleFile): - os.remove(self.vcs.bundleFile) - preargs = args[:] - preargs.append("--quiet") - preargs.append('--bundle') - preargs.append(self.vcs.bundleFile) - args.append(self.vcs.bundleFile) - if not self.projectMode: - args.append(self.__filename) - - if preargs: - out, err = self.__hgClient.runcommand(preargs) - else: - err = "" - if err: + with E5OverrideCursor(): + self.buf = [] + self.cancelled = False + self.errors.clear() + self.intercept = False + + if noEntries == 0: + noEntries = self.limitSpinBox.value() + + preargs = [] + args = self.vcs.initCommand(self.commandMode) + args.append('--verbose') + if self.commandMode not in ("incoming", "outgoing"): + args.append('--limit') + args.append(str(noEntries)) + if self.commandMode in ("incoming", "outgoing"): + args.append("--newest-first") + if self.vcs.hasSubrepositories(): + args.append("--subrepos") + if startRev is not None: + args.append('--rev') + args.append('{0}:0'.format(startRev)) if ( + not self.projectMode and + not self.fname == "." and + not self.stopCheckBox.isChecked() + ): + args.append('--follow') + if self.commandMode == "log": + args.append('--copies') + args.append('--template') + args.append(os.path.join(os.path.dirname(__file__), + "templates", + "logBrowserBookmarkPhase.tmpl")) + if self.commandMode == "incoming": + if self.__bundle: + args.append(self.__bundle) + elif not self.vcs.hasSubrepositories(): + project = e5App().getObject("Project") + self.vcs.bundleFile = os.path.join( + project.getProjectManagementDir(), "hg-bundle.hg") + if os.path.exists(self.vcs.bundleFile): + os.remove(self.vcs.bundleFile) + preargs = args[:] + preargs.append("--quiet") + preargs.append('--bundle') + preargs.append(self.vcs.bundleFile) + args.append(self.vcs.bundleFile) + if not self.projectMode: + args.append(self.__filename) + + if preargs: + out, err = self.__hgClient.runcommand(preargs) + else: + err = "" + if err: + if ( + self.commandMode == "incoming" and + self.initialCommandMode == "full_log" + ): + # ignore the error + self.commandMode = "log" + else: + self.__showError(err) + elif ( + self.commandMode != "incoming" or + (self.vcs.bundleFile and + os.path.exists(self.vcs.bundleFile)) or + self.__bundle + ): + out, err = self.__hgClient.runcommand(args) + self.buf = out.splitlines(True) + if err: + self.__showError(err) + self.__processBuffer() + elif ( self.commandMode == "incoming" and self.initialCommandMode == "full_log" ): - # ignore the error + # no incoming changesets, just switch to log mode self.commandMode = "log" - else: - self.__showError(err) - elif ( - self.commandMode != "incoming" or - (self.vcs.bundleFile and - os.path.exists(self.vcs.bundleFile)) or - self.__bundle - ): - out, err = self.__hgClient.runcommand(args) - self.buf = out.splitlines(True) - if err: - self.__showError(err) - self.__processBuffer() - elif ( - self.commandMode == "incoming" and - self.initialCommandMode == "full_log" - ): - # no incoming changesets, just switch to log mode - self.commandMode = "log" self.__finish() def start(self, fn, bundle=None, isFile=False, noEntries=0): @@ -1109,8 +1107,6 @@ Private slot called when the process finished or the user pressed the button. """ - QApplication.restoreOverrideCursor() - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)