eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py

branch
eric7
changeset 8943
23f9c7b9e18e
parent 8881
54e42bc2437a
equal deleted inserted replaced
8940:e91951ff3bbd 8943:23f9c7b9e18e
5 5
6 """ 6 """
7 Module implementing a simple Python syntax checker. 7 Module implementing a simple Python syntax checker.
8 """ 8 """
9 9
10 import fnmatch
10 import os 11 import os
11 import fnmatch 12 import time
12 13
13 from PyQt6.QtCore import pyqtSlot, Qt, QTimer 14 from PyQt6.QtCore import pyqtSlot, Qt, QTimer
14 from PyQt6.QtWidgets import ( 15 from PyQt6.QtWidgets import (
15 QDialog, QDialogButtonBox, QTreeWidgetItem, QApplication, QHeaderView 16 QDialog, QDialogButtonBox, QTreeWidgetItem, QApplication, QHeaderView
16 ) 17 )
60 self.cancelled = False 61 self.cancelled = False
61 self.__lastFileItem = None 62 self.__lastFileItem = None
62 self.__batch = False 63 self.__batch = False
63 self.__finished = True 64 self.__finished = True
64 self.__errorItem = None 65 self.__errorItem = None
66 self.__timenow = time.monotonic()
65 67
66 self.__fileList = [] 68 self.__fileList = []
67 self.__project = None 69 self.__project = None
68 self.filterFrame.setVisible(False) 70 self.filterFrame.setVisible(False)
69 71
217 QApplication.processEvents() 219 QApplication.processEvents()
218 220
219 # now go through all the files 221 # now go through all the files
220 self.progress = 0 222 self.progress = 0
221 self.files.sort() 223 self.files.sort()
224 self.__timenow = time.monotonic()
222 if codestring or len(self.files) == 1: 225 if codestring or len(self.files) == 1:
223 self.__batch = False 226 self.__batch = False
224 self.check(codestring) 227 self.check(codestring)
225 else: 228 else:
226 self.__batch = True 229 self.__batch = True
283 self.checkProgressLabel.setPath(self.tr("Preparing files...")) 286 self.checkProgressLabel.setPath(self.tr("Preparing files..."))
284 287
285 argumentsList = [] 288 argumentsList = []
286 for progress, filename in enumerate(self.files, start=1): 289 for progress, filename in enumerate(self.files, start=1):
287 self.checkProgress.setValue(progress) 290 self.checkProgress.setValue(progress)
288 QApplication.processEvents() 291 if time.monotonic() - self.__timenow > 0.01:
292 QApplication.processEvents()
293 self.__timenow = time.monotonic()
289 294
290 try: 295 try:
291 source = Utilities.readEncodedFile(filename)[0] 296 source = Utilities.readEncodedFile(filename)[0]
292 source = Utilities.normalizeCode(source) 297 source = Utilities.normalizeCode(source)
293 except (UnicodeError, OSError) as msg: 298 except (UnicodeError, OSError) as msg:
379 True) 384 True)
380 385
381 self.progress += 1 386 self.progress += 1
382 self.checkProgress.setValue(self.progress) 387 self.checkProgress.setValue(self.progress)
383 self.checkProgressLabel.setPath(fn) 388 self.checkProgressLabel.setPath(fn)
384 QApplication.processEvents() 389 if time.monotonic() - self.__timenow > 0.01:
390 QApplication.processEvents()
391 self.__timenow = time.monotonic()
385 self.__resort() 392 self.__resort()
386 393
387 if not self.__batch: 394 if not self.__batch:
388 self.check() 395 self.check()
389 396

eric ide

mercurial