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 |
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: |