5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to show the results of the code style check. |
7 Module implementing a dialog to show the results of the code style check. |
8 """ |
8 """ |
9 |
9 |
|
10 import collections |
|
11 import copy |
|
12 import fnmatch |
|
13 import json |
10 import os |
14 import os |
11 import fnmatch |
15 import time |
12 import copy |
|
13 import collections |
|
14 import json |
|
15 |
16 |
16 from PyQt6.QtCore import pyqtSlot, Qt, QTimer, QCoreApplication |
17 from PyQt6.QtCore import pyqtSlot, Qt, QTimer, QCoreApplication |
17 from PyQt6.QtGui import QIcon |
18 from PyQt6.QtGui import QIcon |
18 from PyQt6.QtWidgets import ( |
19 from PyQt6.QtWidgets import ( |
19 QDialog, QTreeWidgetItem, QAbstractButton, QDialogButtonBox, QApplication, |
20 QDialog, QTreeWidgetItem, QAbstractButton, QDialogButtonBox, QApplication, |
192 self.cancelled = False |
193 self.cancelled = False |
193 self.__lastFileItem = None |
194 self.__lastFileItem = None |
194 self.__batch = False |
195 self.__batch = False |
195 self.__finished = True |
196 self.__finished = True |
196 self.__errorItem = None |
197 self.__errorItem = None |
|
198 self.__timenow = time.monotonic() |
197 |
199 |
198 self.__fileOrFileList = "" |
200 self.__fileOrFileList = "" |
199 self.__forProject = False |
201 self.__forProject = False |
200 self.__data = {} |
202 self.__data = {} |
201 self.__statistics = collections.defaultdict(self.__defaultStatistics) |
203 self.__statistics = collections.defaultdict(self.__defaultStatistics) |
858 annotationArgs, securityArgs, importsArgs] |
860 annotationArgs, securityArgs, importsArgs] |
859 |
861 |
860 # now go through all the files |
862 # now go through all the files |
861 self.progress = 0 |
863 self.progress = 0 |
862 self.files.sort() |
864 self.files.sort() |
|
865 self.__timenow = time.monotonic() |
|
866 |
863 if len(self.files) == 1: |
867 if len(self.files) == 1: |
864 self.__batch = False |
868 self.__batch = False |
865 self.mainWidget.setCurrentWidget(self.resultsTab) |
869 self.mainWidget.setCurrentWidget(self.resultsTab) |
866 self.check() |
870 self.check() |
867 else: |
871 else: |
1001 argumentsList.append((filename, source, args)) |
1005 argumentsList.append((filename, source, args)) |
1002 |
1006 |
1003 # reset the progress bar to the checked files |
1007 # reset the progress bar to the checked files |
1004 self.checkProgress.setValue(self.progress) |
1008 self.checkProgress.setValue(self.progress) |
1005 self.checkProgressLabel.setPath(self.tr("Transferring data...")) |
1009 self.checkProgressLabel.setPath(self.tr("Transferring data...")) |
1006 QApplication.processEvents() |
1010 if time.monotonic() - self.__timenow > 0.01: |
|
1011 QApplication.processEvents() |
|
1012 self.__timenow = time.monotonic() |
1007 |
1013 |
1008 self.__finished = False |
1014 self.__finished = False |
1009 self.styleCheckService.styleBatchCheck(argumentsList) |
1015 self.styleCheckService.styleBatchCheck(argumentsList) |
1010 |
1016 |
1011 def __batchFinished(self): |
1017 def __batchFinished(self): |
1122 fileItems = self.progressList.findItems(fn, Qt.MatchFlag.MatchExactly) |
1128 fileItems = self.progressList.findItems(fn, Qt.MatchFlag.MatchExactly) |
1123 if fileItems: |
1129 if fileItems: |
1124 row = self.progressList.row(fileItems[0]) |
1130 row = self.progressList.row(fileItems[0]) |
1125 self.progressList.takeItem(row) |
1131 self.progressList.takeItem(row) |
1126 |
1132 |
1127 QApplication.processEvents() |
1133 if time.monotonic() - self.__timenow > 0.01: |
|
1134 QApplication.processEvents() |
|
1135 self.__timenow = time.monotonic() |
1128 |
1136 |
1129 def __finish(self): |
1137 def __finish(self): |
1130 """ |
1138 """ |
1131 Private slot called when the code style check finished or the user |
1139 Private slot called when the code style check finished or the user |
1132 pressed the cancel button. |
1140 pressed the cancel button. |