Tue, 08 Feb 2022 16:21:09 +0100
Implemented some performance improvements.
--- a/eric7/DataViews/PyCoverageDialog.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/DataViews/PyCoverageDialog.py Tue Feb 08 16:21:09 2022 +0100 @@ -7,8 +7,9 @@ Module implementing a Python code coverage dialog. """ +import contextlib import os -import contextlib +import time from PyQt6.QtCore import pyqtSlot, Qt from PyQt6.QtWidgets import ( @@ -194,6 +195,7 @@ self.resultList.setSortingEnabled(False) # now go through all the files + now = time.monotonic() for progress, file in enumerate(files, start=1): if self.cancelled: return @@ -215,7 +217,9 @@ total_exceptions += 1 self.checkProgress.setValue(progress) - QApplication.processEvents() + if time.monotonic() - now > 0.01: + QApplication.processEvents() + now = time.monotonic() finally: # reenable updates of the list self.resultList.setSortingEnabled(True)
--- a/eric7/DataViews/PyProfileDialog.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/DataViews/PyProfileDialog.py Tue Feb 08 16:21:09 2022 +0100 @@ -9,6 +9,7 @@ import os import pickle # secok +import time from PyQt6.QtCore import Qt from PyQt6.QtWidgets import ( @@ -173,6 +174,7 @@ self.resultList.setSortingEnabled(False) # now go through all the files + now = time.monotonic() for progress, (func, (cc, nc, tt, ct, _callers)) in enumerate( list(self.stats.items()), start=1 ): @@ -212,7 +214,9 @@ func[1], func[2]) self.checkProgress.setValue(progress) - QApplication.processEvents() + if time.monotonic() - now > 0.01: + QApplication.processEvents() + now = time.monotonic() finally: # reenable updates of the list self.resultList.setSortingEnabled(True)
--- a/eric7/EricNetwork/EricJsonServer.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/EricNetwork/EricJsonServer.py Tue Feb 08 16:21:09 2022 +0100 @@ -274,6 +274,7 @@ # check if client exited prematurely QCoreApplication.processEvents( QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) + QThread.msleep(100) if proc.state() == QProcess.ProcessState.NotRunning: exitCode = proc.exitCode() proc = None
--- a/eric7/Graphics/ApplicationDiagramBuilder.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Graphics/ApplicationDiagramBuilder.py Tue Feb 08 16:21:09 2022 +0100 @@ -7,8 +7,9 @@ Module implementing a dialog showing an imports diagram of the application. """ +import glob import os -import glob +import time from PyQt6.QtWidgets import QApplication, QInputDialog @@ -76,9 +77,12 @@ progress.show() QApplication.processEvents() + now = time.monotonic() for prog, module in enumerate(modules): progress.setValue(prog) - QApplication.processEvents() + if time.monotonic() - now > 0.01: + QApplication.processEvents() + now = time.monotonic() if module.endswith("__init__.py"): continue try:
--- a/eric7/Graphics/ImportsDiagramBuilder.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Graphics/ImportsDiagramBuilder.py Tue Feb 08 16:21:09 2022 +0100 @@ -9,6 +9,7 @@ import glob import os +import time from PyQt6.QtWidgets import QApplication, QGraphicsTextItem @@ -108,9 +109,13 @@ try: progress.show() QApplication.processEvents() + + now = time.monotonic() for prog, module in enumerate(modules): progress.setValue(prog) - QApplication.processEvents() + if time.monotonic() - now > 0.01: + QApplication.processEvents() + now = time.monotonic() try: mod = Utilities.ModuleParser.readModule( module, extensions=extensions, caching=False)
--- a/eric7/Graphics/PackageDiagramBuilder.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Graphics/PackageDiagramBuilder.py Tue Feb 08 16:21:09 2022 +0100 @@ -8,7 +8,8 @@ """ import glob -import os.path +import os +import time from itertools import zip_longest from PyQt6.QtWidgets import QApplication, QGraphicsTextItem @@ -110,9 +111,12 @@ progress.show() QApplication.processEvents() + now = time.monotonic() for prog, module in enumerate(modules): progress.setValue(prog) - QApplication.processEvents() + if time.monotonic() - now > 0.01: + QApplication.processEvents() + now = time.monotonic() try: mod = Utilities.ModuleParser.readModule( module, extensions=extensions, caching=False) @@ -174,6 +178,7 @@ progress.show() QApplication.processEvents() + now = time.monotonic() for subpackage in subpackagesList: packageName = os.path.basename(subpackage) subpackagesDict[packageName] = [] @@ -183,7 +188,9 @@ Utilities.normjoinpath(subpackage, ext))) for prog, module in enumerate(modules): progress.setValue(prog) - QApplication.processEvents() + if time.monotonic() - now > 0.01: + QApplication.processEvents() + now = time.monotonic() try: mod = Utilities.ModuleParser.readModule( module, extensions=extensions, caching=False)
--- a/eric7/JediInterface/JediServer.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/JediInterface/JediServer.py Tue Feb 08 16:21:09 2022 +0100 @@ -11,7 +11,7 @@ import os import uuid -from PyQt6.QtCore import pyqtSlot, QCoreApplication, QTimer +from PyQt6.QtCore import pyqtSlot, QCoreApplication, QTimer, QThread from PyQt6.QtWidgets import QInputDialog, QLineEdit, QDialog from EricWidgets.EricApplication import ericApp @@ -264,6 +264,7 @@ timer.start(5000) # 5s timeout while self.__calltips is None and timer.isActive(): QCoreApplication.processEvents() + QThread.msleep(100) return [] if self.__calltips is None else self.__calltips
--- a/eric7/MultiProject/MultiProject.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/MultiProject/MultiProject.py Tue Feb 08 16:21:09 2022 +0100 @@ -14,7 +14,7 @@ from PyQt6.QtCore import ( pyqtSignal, pyqtSlot, QFileInfo, QFile, QIODevice, QObject, QUuid ) -from PyQt6.QtWidgets import QMenu, QApplication, QDialog, QToolBar +from PyQt6.QtWidgets import QMenu, QDialog, QToolBar from Globals import recentNameMultiProject @@ -547,8 +547,6 @@ if fn == "": fn = None - QApplication.processEvents() - if fn is not None: self.closeMultiProject() ok = self.__readMultiProject(fn)
--- a/eric7/PipInterface/Pip.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/PipInterface/Pip.py Tue Feb 08 16:21:09 2022 +0100 @@ -12,7 +12,9 @@ import json import contextlib -from PyQt6.QtCore import pyqtSlot, QObject, QProcess, QUrl, QCoreApplication +from PyQt6.QtCore import ( + pyqtSlot, QObject, QProcess, QUrl, QCoreApplication, QThread +) from PyQt6.QtWidgets import QDialog, QInputDialog, QLineEdit from PyQt6.QtNetwork import ( QNetworkAccessManager, QNetworkRequest, QNetworkReply @@ -689,6 +691,7 @@ reply = self.__networkManager.get(request) while not reply.isFinished(): QCoreApplication.processEvents() + QThread.msleep(100) reply.deleteLater() if reply.error() == QNetworkReply.NetworkError.NoError:
--- a/eric7/PluginManager/PluginInstallDialog.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/PluginManager/PluginInstallDialog.py Tue Feb 08 16:21:09 2022 +0100 @@ -7,14 +7,15 @@ Module implementing the Plugin installation dialog. """ +import compileall +import contextlib +import glob import os +import shutil import sys -import shutil +import time +import urllib.parse import zipfile -import compileall -import glob -import contextlib -import urllib.parse from PyQt6.QtCore import pyqtSlot, Qt, QDir, QFileInfo from PyQt6.QtWidgets import ( @@ -440,9 +441,13 @@ tot = len(namelist) self.progress.setMaximum(tot) QApplication.processEvents() + + now = time.monotonic() for prog, name in enumerate(namelist): self.progress.setValue(prog) - QApplication.processEvents() + if time.monotonic() - now > 0.01: + QApplication.processEvents() + now = time.monotonic() if ( name == pluginFileName or name.startswith("{0}/".format(packageName)) or
--- a/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Tue Feb 08 16:21:09 2022 +0100 @@ -974,7 +974,9 @@ argumentsList = [] for progress, filename in enumerate(self.files, start=1): self.checkProgress.setValue(progress) - QApplication.processEvents() + if time.monotonic() - self.__timenow > 0.01: + QApplication.processEvents() + self.__timenow = time.monotonic() try: source, encoding = Utilities.readEncodedFile( @@ -1007,9 +1009,7 @@ # reset the progress bar to the checked files self.checkProgress.setValue(self.progress) self.checkProgressLabel.setPath(self.tr("Transferring data...")) - if time.monotonic() - self.__timenow > 0.01: - QApplication.processEvents() - self.__timenow = time.monotonic() + QApplication.processEvents() self.__finished = False self.styleCheckService.styleBatchCheck(argumentsList)
--- a/eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Tue Feb 08 16:21:09 2022 +0100 @@ -7,8 +7,9 @@ Module implementing a simple Python syntax checker. """ +import fnmatch import os -import fnmatch +import time from PyQt6.QtCore import pyqtSlot, Qt, QTimer from PyQt6.QtWidgets import ( @@ -62,6 +63,7 @@ self.__batch = False self.__finished = True self.__errorItem = None + self.__timenow = time.monotonic() self.__fileList = [] self.__project = None @@ -219,6 +221,7 @@ # now go through all the files self.progress = 0 self.files.sort() + self.__timenow = time.monotonic() if codestring or len(self.files) == 1: self.__batch = False self.check(codestring) @@ -285,7 +288,9 @@ argumentsList = [] for progress, filename in enumerate(self.files, start=1): self.checkProgress.setValue(progress) - QApplication.processEvents() + if time.monotonic() - self.__timenow > 0.01: + QApplication.processEvents() + self.__timenow = time.monotonic() try: source = Utilities.readEncodedFile(filename)[0] @@ -381,7 +386,9 @@ self.progress += 1 self.checkProgress.setValue(self.progress) self.checkProgressLabel.setPath(fn) - QApplication.processEvents() + if time.monotonic() - self.__timenow > 0.01: + QApplication.processEvents() + self.__timenow = time.monotonic() self.__resort() if not self.__batch:
--- a/eric7/Preferences/ConfigurationDialog.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Preferences/ConfigurationDialog.py Tue Feb 08 16:21:09 2022 +0100 @@ -10,6 +10,7 @@ import contextlib import enum import os +import time import types from PyQt6.QtCore import pyqtSignal, pyqtSlot, Qt, QMetaObject, QRect @@ -918,11 +919,14 @@ Public method called to store the selected values into the preferences storage. """ + now = time.monotonic() for pageData in self.configItems.values(): if pageData[-1]: pageData[-1].save() # page was loaded (and possibly modified) - QApplication.processEvents() # ensure HMI is responsive + if time.monotonic() - now > 0.01: + QApplication.processEvents() # ensure HMI is responsive + now = time.monotonic() def on_buttonBox_clicked(self, button): """
--- a/eric7/Project/Project.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Project/Project.py Tue Feb 08 16:21:09 2022 +0100 @@ -22,7 +22,7 @@ ) from PyQt6.QtGui import QKeySequence, QAction from PyQt6.QtWidgets import ( - QLineEdit, QToolBar, QDialog, QInputDialog, QApplication, QMenu + QLineEdit, QToolBar, QDialog, QInputDialog, QMenu ) from PyQt6.Qsci import QsciScintilla @@ -2932,8 +2932,6 @@ Utilities.getHomeDir(), self.tr("Project Files (*.epj);;XML Project Files (*.e4p)")) - QApplication.processEvents() - if fn and self.closeProject(): with EricOverrideCursor(): ok = self.__readProject(fn)
--- a/eric7/Project/ProjectFormsBrowser.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Project/ProjectFormsBrowser.py Tue Feb 08 16:21:09 2022 +0100 @@ -933,8 +933,7 @@ proc = self.__compileUI(fn, True, progress) if proc is not None: while proc.state() == QProcess.ProcessState.Running: - QApplication.processEvents() - QThread.msleep(300) + QThread.msleep(100) QApplication.processEvents() else: break @@ -968,8 +967,7 @@ proc = self.__compileUI(fn, True, progress) if proc is not None: while proc.state() == QProcess.ProcessState.Running: - QApplication.processEvents() - QThread.msleep(300) + QThread.msleep(100) QApplication.processEvents() else: break
--- a/eric7/Project/ProjectInterfacesBrowser.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Project/ProjectInterfacesBrowser.py Tue Feb 08 16:21:09 2022 +0100 @@ -623,8 +623,7 @@ proc = self.__compileIDL(fn, True, progress) if proc is not None: while proc.state() == QProcess.ProcessState.Running: - QApplication.processEvents() - QThread.msleep(300) + QThread.msleep(100) QApplication.processEvents() else: break @@ -655,8 +654,7 @@ proc = self.__compileIDL(fn, True, progress) if proc is not None: while proc.state() == QProcess.ProcessState.Running: - QApplication.processEvents() - QThread.msleep(300) + QThread.msleep(100) QApplication.processEvents() else: break
--- a/eric7/Project/ProjectProtocolsBrowser.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Project/ProjectProtocolsBrowser.py Tue Feb 08 16:21:09 2022 +0100 @@ -668,8 +668,7 @@ proc = self.__compileProto(fn, True, progress, grpc=grpc) if proc is not None: while proc.state() == QProcess.ProcessState.Running: - QApplication.processEvents() - QThread.msleep(300) + QThread.msleep(100) QApplication.processEvents() else: break @@ -703,8 +702,7 @@ proc = self.__compileProto(fn, True, progress, grpc=grpc) if proc is not None: while proc.state() == QProcess.ProcessState.Running: - QApplication.processEvents() - QThread.msleep(300) + QThread.msleep(100) QApplication.processEvents() else: break
--- a/eric7/Project/ProjectResourcesBrowser.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Project/ProjectResourcesBrowser.py Tue Feb 08 16:21:09 2022 +0100 @@ -751,8 +751,7 @@ proc = self.__compileQRC(fn, True, progress) if proc is not None: while proc.state() == QProcess.ProcessState.Running: - QApplication.processEvents() - QThread.msleep(300) + QThread.msleep(100) QApplication.processEvents() else: break @@ -786,8 +785,7 @@ proc = self.__compileQRC(fn, True, progress) if proc is not None: while proc.state() == QProcess.ProcessState.Running: - QApplication.processEvents() - QThread.msleep(300) + QThread.msleep(100) QApplication.processEvents() else: break @@ -886,8 +884,7 @@ proc = self.__compileQRC(fn, True, progress) if proc is not None: while proc.state() == QProcess.ProcessState.Running: - QApplication.processEvents() - QThread.msleep(300) + QThread.msleep(100) QApplication.processEvents() else: break
--- a/eric7/Tasks/TaskViewer.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Tasks/TaskViewer.py Tue Feb 08 16:21:09 2022 +0100 @@ -14,6 +14,7 @@ import os import fnmatch import threading +import time from PyQt6.QtCore import pyqtSignal, Qt, QThread from PyQt6.QtWidgets import ( @@ -774,11 +775,15 @@ progress.setWindowTitle(self.tr("Tasks")) ppath = self.project.getProjectPath() + + now = time.monotonic() for count, file in enumerate(files): progress.setLabelText( self.tr("Extracting project tasks...\n{0}").format(file)) progress.setValue(count) - QApplication.processEvents() + if time.monotonic() - now > 0.01: + QApplication.processEvents() + now = time.monotonic() if progress.wasCanceled(): break
--- a/eric7/UI/FindFileWidget.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/UI/FindFileWidget.py Tue Feb 08 16:21:09 2022 +0100 @@ -526,7 +526,6 @@ self.findList.clear() QApplication.processEvents() - QApplication.processEvents() self.findProgress.setMaximum(len(files)) # retrieve the values
--- a/eric7/Utilities/BackgroundService.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/Utilities/BackgroundService.py Tue Feb 08 16:21:09 2022 +0100 @@ -8,14 +8,14 @@ Python interpreter dependent functions. """ +import contextlib import json import os import struct import sys from zlib import adler32 -import contextlib -from PyQt6.QtCore import QProcess, pyqtSignal, QTimer +from PyQt6.QtCore import QProcess, pyqtSignal, QTimer, QThread from PyQt6.QtWidgets import QApplication from PyQt6.QtNetwork import QTcpServer, QHostAddress @@ -297,6 +297,7 @@ # Don't kill a process if it's still working if not forceKill: while self.isWorking is not None: + QThread.msleep(100) QApplication.processEvents() conn = self.connections.pop(language, None)
--- a/eric7/VCS/VersionControl.py Mon Feb 07 22:02:35 2022 +0100 +++ b/eric7/VCS/VersionControl.py Tue Feb 08 16:21:09 2022 +0100 @@ -781,7 +781,6 @@ return False else: while proc.state() == QProcess.ProcessState.Running: - QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() return (