19 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem |
19 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem |
20 |
20 |
21 from eric7 import Preferences |
21 from eric7 import Preferences |
22 from eric7.EricWidgets import EricMessageBox |
22 from eric7.EricWidgets import EricMessageBox |
23 from eric7.EricWidgets.EricApplication import ericApp |
23 from eric7.EricWidgets.EricApplication import ericApp |
24 from eric7.QScintilla.Editor import Editor |
|
25 from eric7.SystemUtilities import PythonUtilities |
24 from eric7.SystemUtilities import PythonUtilities |
26 |
25 |
27 from .Ui_PyrightCheckerDialog import Ui_PyrightCheckerDialog |
26 from .Ui_PyrightCheckerDialog import Ui_PyrightCheckerDialog |
28 |
27 |
|
28 try: |
|
29 from eric7.QScintilla.Editor import EditorWarningKind |
|
30 |
|
31 SeverityForEditor = { |
|
32 "error": EditorWarningKind.Error, |
|
33 "information": EditorWarningKind.Info, |
|
34 "warning": EditorWarningKind.Code, |
|
35 } |
|
36 except ImportError: |
|
37 # backward compatibility for eric < 24.2 |
|
38 from eric7.QScintilla.Editor import Editor |
|
39 |
|
40 SeverityForEditor = {"warning": Editor.WarningCode} |
|
41 try: |
|
42 SeverityForEditor["error"] = Editor.WarningError |
|
43 except AttributeError: |
|
44 SeverityForEditor["error"] = Editor.WarningCode |
|
45 try: |
|
46 SeverityForEditor["information"] = Editor.WarningInfo |
|
47 except AttributeError: |
|
48 SeverityForEditor["information"] = Editor.WarningCode |
29 |
49 |
30 class PyrightCheckerDialog(QDialog, Ui_PyrightCheckerDialog): |
50 class PyrightCheckerDialog(QDialog, Ui_PyrightCheckerDialog): |
31 """ |
51 """ |
32 Class documentation goes here. |
52 Class documentation goes here. |
33 """ |
53 """ |
56 "error": self.tr("Error"), |
76 "error": self.tr("Error"), |
57 "warning": self.tr("Warning"), |
77 "warning": self.tr("Warning"), |
58 "information": self.tr("Information"), |
78 "information": self.tr("Information"), |
59 } |
79 } |
60 |
80 |
61 self.__severityForEditor = {"warning": Editor.WarningCode} |
81 ##self.__severityForEditor = {"warning": Editor.WarningCode} |
62 try: |
82 ##try: |
63 self.__severityForEditor["error"] = Editor.WarningError |
83 ##self.__severityForEditor["error"] = Editor.WarningError |
64 except AttributeError: |
84 ##except AttributeError: |
65 self.__severityForEditor["error"] = Editor.WarningCode |
85 ##self.__severityForEditor["error"] = Editor.WarningCode |
66 try: |
86 ##try: |
67 self.__severityForEditor["information"] = Editor.WarningInfo |
87 ##self.__severityForEditor["information"] = Editor.WarningInfo |
68 except AttributeError: |
88 ##except AttributeError: |
69 self.__severityForEditor["information"] = Editor.WarningCode |
89 ##self.__severityForEditor["information"] = Editor.WarningCode |
70 |
90 ## |
71 self.__exitCodeMapping = { |
91 self.__exitCodeMapping = { |
72 0: self.tr("No issues detected"), |
92 0: self.tr("No issues detected"), |
73 1: self.tr("Issues detected"), |
93 1: self.tr("Issues detected"), |
74 2: self.tr("Fatal error occurred with no errors or warnings reported"), |
94 2: self.tr("Fatal error occurred with no errors or warnings reported"), |
75 3: self.tr("Config file could not be read or parsed"), |
95 3: self.tr("Config file could not be read or parsed"), |