7 Module implementing a dialog to show the results of the PyLint run. |
7 Module implementing a dialog to show the results of the PyLint run. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt6.QtCore import pyqtSlot, Qt, QTimer, QProcess |
12 from PyQt6.QtCore import QProcess, Qt, QTimer, pyqtSlot |
13 from PyQt6.QtGui import QTextCursor |
13 from PyQt6.QtGui import QTextCursor |
14 from PyQt6.QtWidgets import ( |
14 from PyQt6.QtWidgets import ( |
15 QWidget, |
|
16 QHeaderView, |
|
17 QApplication, |
15 QApplication, |
18 QDialogButtonBox, |
16 QDialogButtonBox, |
|
17 QHeaderView, |
19 QTreeWidgetItem, |
18 QTreeWidgetItem, |
|
19 QWidget, |
20 ) |
20 ) |
21 |
21 |
22 from eric7 import Preferences, Utilities |
22 from eric7 import Preferences |
23 from eric7.EricGui.EricOverrideCursor import EricOverrideCursorProcess |
23 from eric7.EricGui.EricOverrideCursor import EricOverrideCursorProcess |
24 from eric7.EricWidgets import EricMessageBox, EricFileDialog |
24 from eric7.EricWidgets import EricFileDialog, EricMessageBox |
25 from eric7.EricWidgets.EricApplication import ericApp |
25 from eric7.EricWidgets.EricApplication import ericApp |
|
26 |
|
27 try: |
|
28 from eric7.SystemUtilities.OSUtilities import isWindowsPlatform |
|
29 except ImportError: |
|
30 # imports for eric < 23.1 |
|
31 from eric7.Utilities import isWindowsPlatform |
26 |
32 |
27 from .Ui_PyLintExecDialog import Ui_PyLintExecDialog |
33 from .Ui_PyLintExecDialog import Ui_PyLintExecDialog |
28 |
34 |
29 |
35 |
30 class PyLintExecDialog(QWidget, Ui_PyLintExecDialog): |
36 class PyLintExecDialog(QWidget, Ui_PyLintExecDialog): |
263 @param message message text |
269 @param message message text |
264 @type str |
270 @type str |
265 """ |
271 """ |
266 if self.__lastFileItem is None or self.__lastFileItem.text(0) != file: |
272 if self.__lastFileItem is None or self.__lastFileItem.text(0) != file: |
267 matchFlags = Qt.MatchFlag.MatchFixedString |
273 matchFlags = Qt.MatchFlag.MatchFixedString |
268 if not Utilities.isWindowsPlatform(): |
274 if not isWindowsPlatform(): |
269 matchFlags |= Qt.MatchFlag.MatchCaseSensitive |
275 matchFlags |= Qt.MatchFlag.MatchCaseSensitive |
270 |
276 |
271 itmList = self.messageList.findItems(file, matchFlags) |
277 itmList = self.messageList.findItems(file, matchFlags) |
272 if itmList: |
278 if itmList: |
273 self.__lastFileItem = itmList[0] |
279 self.__lastFileItem = itmList[0] |
295 |
301 |
296 while self.process.canReadLine(): |
302 while self.process.canReadLine(): |
297 s = str(self.process.readLine(), self.__ioEncoding, "replace") |
303 s = str(self.process.readLine(), self.__ioEncoding, "replace") |
298 if s: |
304 if s: |
299 try: |
305 try: |
300 if Utilities.isWindowsPlatform(): |
306 if isWindowsPlatform(): |
301 drive, s = os.path.splitdrive(s) |
307 drive, s = os.path.splitdrive(s) |
302 fname, lineno, fullmessage = s.split(":") |
308 fname, lineno, fullmessage = s.split(":") |
303 fname = drive + fname |
309 fname = drive + fname |
304 else: |
310 else: |
305 fname, lineno, fullmessage = s.split(":") |
311 fname, lineno, fullmessage = s.split(":") |