10 |
10 |
11 import os |
11 import os |
12 import fnmatch |
12 import fnmatch |
13 |
13 |
14 from PyQt5.QtCore import pyqtSlot, Qt, QTimer |
14 from PyQt5.QtCore import pyqtSlot, Qt, QTimer |
15 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem, \ |
15 from PyQt5.QtWidgets import ( |
16 QApplication, QHeaderView |
16 QDialog, QDialogButtonBox, QTreeWidgetItem, QApplication, QHeaderView |
|
17 ) |
17 |
18 |
18 from E5Gui.E5Application import e5App |
19 from E5Gui.E5Application import e5App |
19 |
20 |
20 from .Ui_SyntaxCheckerDialog import Ui_SyntaxCheckerDialog |
21 from .Ui_SyntaxCheckerDialog import Ui_SyntaxCheckerDialog |
21 |
22 |
117 @param index index number of fault (integer) |
118 @param index index number of fault (integer) |
118 @param error error text (string) |
119 @param error error text (string) |
119 @param sourcecode faulty line of code (string) |
120 @param sourcecode faulty line of code (string) |
120 @param isWarning flag indicating a warning message (boolean) |
121 @param isWarning flag indicating a warning message (boolean) |
121 """ |
122 """ |
122 if self.__lastFileItem is None or \ |
123 if ( |
123 self.__lastFileItem.data(0, self.filenameRole) != filename: |
124 self.__lastFileItem is None or |
|
125 self.__lastFileItem.data(0, self.filenameRole) != filename |
|
126 ): |
124 # It's a new file |
127 # It's a new file |
125 self.__lastFileItem = QTreeWidgetItem(self.resultList, [ |
128 self.__lastFileItem = QTreeWidgetItem(self.resultList, [ |
126 self.__project.getRelativePath(filename)]) |
129 self.__project.getRelativePath(filename)]) |
127 self.__lastFileItem.setFirstColumnSpanned(True) |
130 self.__lastFileItem.setFirstColumnSpanned(True) |
128 self.__lastFileItem.setExpanded(True) |
131 self.__lastFileItem.setExpanded(True) |
426 Private slot to start a syntax check run. |
429 Private slot to start a syntax check run. |
427 """ |
430 """ |
428 fileList = self.__fileList[:] |
431 fileList = self.__fileList[:] |
429 |
432 |
430 filterString = self.excludeFilesEdit.text() |
433 filterString = self.excludeFilesEdit.text() |
431 if "ExcludeFiles" not in self.__data or \ |
434 if ( |
432 filterString != self.__data["ExcludeFiles"]: |
435 "ExcludeFiles" not in self.__data or |
|
436 filterString != self.__data["ExcludeFiles"] |
|
437 ): |
433 self.__data["ExcludeFiles"] = filterString |
438 self.__data["ExcludeFiles"] = filterString |
434 self.__project.setData("CHECKERSPARMS", "SyntaxChecker", |
439 self.__project.setData("CHECKERSPARMS", "SyntaxChecker", |
435 self.__data) |
440 self.__data) |
436 filterList = [f.strip() for f in filterString.split(",") |
441 filterList = [f.strip() for f in filterString.split(",") |
437 if f.strip()] |
442 if f.strip()] |
438 if filterList: |
443 if filterList: |
439 for fileFilter in filterList: |
444 for fileFilter in filterList: |
440 fileList = \ |
445 fileList = [ |
441 [f for f in fileList if not fnmatch.fnmatch(f, fileFilter)] |
446 f for f in fileList if not fnmatch.fnmatch(f, fileFilter) |
|
447 ] |
442 |
448 |
443 self.resultList.clear() |
449 self.resultList.clear() |
444 self.noResults = True |
450 self.noResults = True |
445 self.cancelled = False |
451 self.cancelled = False |
446 self.start(fileList) |
452 self.start(fileList) |