diff -r b165effc3c62 -r 548df4df8256 eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py --- a/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Wed Nov 24 20:08:25 2021 +0100 +++ b/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Thu Nov 25 17:48:51 2021 +0100 @@ -29,6 +29,7 @@ import Utilities from . import pycodestyle +from . import CodeStyleCheckerUtilities from .Miscellaneous.MiscellaneousDefaults import ( MiscellaneousCheckerDefaultArgs @@ -76,6 +77,9 @@ "E": QCoreApplication.translate( "CheckerCategories", "Errors"), + "I": QCoreApplication.translate( + "CheckerCategories", + "Imports"), "M": QCoreApplication.translate( "CheckerCategories", "Miscellaneous"), @@ -300,30 +304,37 @@ result["display"] ] ) - if msgCode.startswith(("W", "-", "C", "M")): - itm.setIcon(1, UI.PixmapCache.getIcon("warning")) - elif msgCode.startswith(("A", "N")): - itm.setIcon(1, UI.PixmapCache.getIcon("namingError")) - elif msgCode.startswith("D"): - itm.setIcon(1, UI.PixmapCache.getIcon("docstringError")) - elif msgCode.startswith("P"): - itm.setIcon(1, UI.PixmapCache.getIcon("dirClosed")) - elif msgCode.startswith("Y"): - itm.setIcon(1, UI.PixmapCache.getIcon("filePython")) - elif msgCode.startswith("S"): - if "severity" in result: - if result["severity"] == "H": - itm.setIcon(1, UI.PixmapCache.getIcon("securityLow")) - elif result["severity"] == "M": - itm.setIcon(1, UI.PixmapCache.getIcon("securityMedium")) - elif result["severity"] == "L": - itm.setIcon(1, UI.PixmapCache.getIcon("securityHigh")) - else: - itm.setIcon(1, UI.PixmapCache.getIcon("securityLow")) - else: - itm.setIcon(1, UI.PixmapCache.getIcon("securityLow")) - else: - itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError")) + + CodeStyleCheckerUtilities.setItemIcon( + itm, 1, msgCode, result.get("severity")) +# # TODO: extract this as a method +# if msgCode.startswith(("W", "-", "C", "M")): +# itm.setIcon(1, UI.PixmapCache.getIcon("warning")) +# elif msgCode.startswith(("A", "N")): +# itm.setIcon(1, UI.PixmapCache.getIcon("namingError")) +# elif msgCode.startswith("D"): +# itm.setIcon(1, UI.PixmapCache.getIcon("docstringError")) +# elif msgCode.startswith("I"): +# itm.setIcon(1, UI.PixmapCache.getIcon("imports")) +# elif msgCode.startswith("P"): +# itm.setIcon(1, UI.PixmapCache.getIcon("dirClosed")) +# elif msgCode.startswith("Y"): +# itm.setIcon(1, UI.PixmapCache.getIcon("filePython")) +# elif msgCode.startswith("S"): +# if "severity" in result: +# if result["severity"] == "H": +# itm.setIcon(1, UI.PixmapCache.getIcon("securityLow")) +# elif result["severity"] == "M": +# itm.setIcon(1, UI.PixmapCache.getIcon("securityMedium")) +# elif result["severity"] == "L": +# itm.setIcon(1, UI.PixmapCache.getIcon("securityHigh")) +# else: +# itm.setIcon(1, UI.PixmapCache.getIcon("securityLow")) +# else: +# itm.setIcon(1, UI.PixmapCache.getIcon("securityLow")) +# else: +# itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError")) + if result["fixed"]: itm.setIcon(0, UI.PixmapCache.getIcon("issueFixed")) elif (