10 import os |
10 import os |
11 import contextlib |
11 import contextlib |
12 |
12 |
13 from PyQt6.QtCore import QObject |
13 from PyQt6.QtCore import QObject |
14 |
14 |
15 from EricGui.EricAction import EricAction |
15 from eric7.EricGui.EricAction import EricAction |
16 from EricWidgets.EricApplication import ericApp |
16 from eric7.EricWidgets.EricApplication import ericApp |
17 from eric7config import getConfig |
17 from eric7config import getConfig |
18 |
18 |
19 from Project.ProjectBrowserModel import ProjectBrowserFileItem |
19 from eric7.Project.ProjectBrowserModel import ProjectBrowserFileItem |
20 |
20 |
21 import Preferences |
21 from eric7 import Preferences |
22 import UI.Info |
22 from eric7.UI import Info |
23 |
23 |
24 # Start-Of-Header |
24 # Start-Of-Header |
25 name = "Syntax Checker Plugin" |
25 name = "Syntax Checker Plugin" |
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
27 autoactivate = True |
27 autoactivate = True |
28 deactivateable = True |
28 deactivateable = True |
29 version = UI.Info.VersionOnly |
29 version = Info.VersionOnly |
30 className = "SyntaxCheckerPlugin" |
30 className = "SyntaxCheckerPlugin" |
31 packageName = "__core__" |
31 packageName = "__core__" |
32 shortDescription = "Show the Syntax Checker dialog." |
32 shortDescription = "Show the Syntax Checker dialog." |
33 longDescription = ( |
33 longDescription = ( |
34 """This plugin implements the Syntax Checker dialog.""" |
34 """This plugin implements the Syntax Checker dialog.""" |
169 @param problems dictionary with the keys 'error' and 'warnings' which |
169 @param problems dictionary with the keys 'error' and 'warnings' which |
170 hold a list containing details about the error/ warnings |
170 hold a list containing details about the error/ warnings |
171 (file name, line number, column, codestring (only at syntax |
171 (file name, line number, column, codestring (only at syntax |
172 errors), the message, a list with arguments for the message) |
172 errors), the message, a list with arguments for the message) |
173 """ |
173 """ |
174 from CheckerPlugins.SyntaxChecker.pyflakes.translations import ( |
174 from eric7.Plugins.CheckerPlugins.SyntaxChecker.pyflakes.translations import ( |
175 getTranslatedFlakesMessage, |
175 getTranslatedFlakesMessage, |
176 ) |
176 ) |
177 |
177 |
178 warnings = problems.get("warnings", []) |
178 warnings = problems.get("warnings", []) |
179 for warning in warnings: |
179 for warning in warnings: |
320 os.path.join(ppath, file) |
320 os.path.join(ppath, file) |
321 for file in project.pdata["SOURCES"] |
321 for file in project.pdata["SOURCES"] |
322 if file.endswith(extensions) |
322 if file.endswith(extensions) |
323 ] |
323 ] |
324 |
324 |
325 from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import SyntaxCheckerDialog |
325 from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( |
|
326 SyntaxCheckerDialog, |
|
327 ) |
326 |
328 |
327 self.__projectSyntaxCheckerDialog = SyntaxCheckerDialog() |
329 self.__projectSyntaxCheckerDialog = SyntaxCheckerDialog() |
328 self.__projectSyntaxCheckerDialog.show() |
330 self.__projectSyntaxCheckerDialog.show() |
329 self.__projectSyntaxCheckerDialog.prepare(files, project) |
331 self.__projectSyntaxCheckerDialog.prepare(files, project) |
330 |
332 |
343 try: |
345 try: |
344 fn = itm.fileName() |
346 fn = itm.fileName() |
345 except AttributeError: |
347 except AttributeError: |
346 fn = itm.dirName() |
348 fn = itm.dirName() |
347 |
349 |
348 from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import SyntaxCheckerDialog |
350 from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( |
|
351 SyntaxCheckerDialog, |
|
352 ) |
349 |
353 |
350 self.__projectBrowserSyntaxCheckerDialog = SyntaxCheckerDialog() |
354 self.__projectBrowserSyntaxCheckerDialog = SyntaxCheckerDialog() |
351 self.__projectBrowserSyntaxCheckerDialog.show() |
355 self.__projectBrowserSyntaxCheckerDialog.show() |
352 self.__projectBrowserSyntaxCheckerDialog.start(fn) |
356 self.__projectBrowserSyntaxCheckerDialog.start(fn) |
353 |
357 |
393 Private slot to handle the syntax check context menu action of the |
397 Private slot to handle the syntax check context menu action of the |
394 editors. |
398 editors. |
395 """ |
399 """ |
396 editor = ericApp().getObject("ViewManager").activeWindow() |
400 editor = ericApp().getObject("ViewManager").activeWindow() |
397 if editor is not None: |
401 if editor is not None: |
398 from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( |
402 from eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( |
399 SyntaxCheckerDialog, |
403 SyntaxCheckerDialog, |
400 ) |
404 ) |
401 |
405 |
402 self.__editorSyntaxCheckerDialog = SyntaxCheckerDialog() |
406 self.__editorSyntaxCheckerDialog = SyntaxCheckerDialog() |
403 self.__editorSyntaxCheckerDialog.show() |
407 self.__editorSyntaxCheckerDialog.show() |