src/eric7/QScintilla/Editor.py

branch
eric7-maintenance
changeset 10222
1146cc8fbf5d
parent 10148
31ba20629af4
parent 10188
0f873791d67e
child 10272
7ae72d1df070
--- a/src/eric7/QScintilla/Editor.py	Fri Sep 01 10:26:51 2023 +0200
+++ b/src/eric7/QScintilla/Editor.py	Thu Oct 05 09:59:53 2023 +0200
@@ -147,7 +147,8 @@
     mouseDoubleClick = pyqtSignal(QPoint, Qt.MouseButton)
 
     WarningCode = 1
-    WarningStyle = 2
+    WarningPython = 2
+    WarningStyle = 3
 
     # Autocompletion icon definitions
     ClassID = 1
@@ -2010,17 +2011,15 @@
         """
         if self.apiLanguage == "Guessed" or self.apiLanguage.startswith("Pygments|"):
             lang = self.lexer_.name()
-            if normalized:  # __IGNORE_WARNING_Y102__
+            if normalized and lang in ("Python 2.x", "Python"):
                 # adjust some Pygments lexer names
-                if lang in ("Python 2.x", "Python"):
-                    lang = "Python3"
+                lang = "Python3"
 
         else:
             lang = self.apiLanguage
-            if forPygments:  # __IGNORE_WARNING_Y102__
+            if forPygments and lang == "Python3":
                 # adjust some names to Pygments lexer names
-                if lang == "Python3":
-                    lang = "Python"
+                lang = "Python"
         return lang
 
     def getApiLanguage(self):
@@ -6233,9 +6232,13 @@
             _fn, lineno, col, code, msg = error
             self.toggleSyntaxError(lineno, col, True, msg)
 
+        warnings = problems.get("py_warnings", [])
+        for _fn, lineno, col, _code, msg in warnings:
+            self.toggleWarning(lineno, col, True, msg, warningType=Editor.WarningPython)
+
         warnings = problems.get("warnings", [])
         for _fn, lineno, col, _code, msg in warnings:
-            self.toggleWarning(lineno, col, True, msg)
+            self.toggleWarning(lineno, col, True, msg, warningType=Editor.WarningCode)
 
         self.updateVerticalScrollBar()
 
@@ -6803,6 +6806,7 @@
         Public slot to clear all pyflakes warnings.
         """
         self.__clearTypedWarning(Editor.WarningCode)
+        self.__clearTypedWarning(Editor.WarningPython)
 
     def clearStyleWarnings(self):
         """
@@ -6815,7 +6819,7 @@
         Private method to clear warnings of a specific kind.
 
         @param warningKind kind of warning to clear (Editor.WarningCode,
-            Editor.WarningStyle)
+            Editor.WarningPython, Editor.WarningStyle)
         """
         for handle in list(self.warnings.keys()):
             warnings = []
@@ -6929,8 +6933,10 @@
             for handle in self.warnings:
                 if self.markerLine(handle) == line:
                     for msg, warningType in self.warnings[handle]:
-                        if warningType == self.WarningStyle:
+                        if warningType == Editor.WarningStyle:
                             styleAnnotations.append(self.tr("Style: {0}").format(msg))
+                        elif warningType == Editor.WarningPython:
+                            warningAnnotations.append(msg)
                         else:
                             warningAnnotations.append(
                                 self.tr("Warning: {0}").format(msg)

eric ide

mercurial