src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerUtilities.py

branch
eric7
changeset 9413
80c06d472826
parent 9221
bf71ee032bb4
child 9653
e67609152c5e
equal deleted inserted replaced
9412:45e7bb09c120 9413:80c06d472826
5 5
6 """ 6 """
7 Module implementing utility functions for the code style checker dialogs. 7 Module implementing utility functions for the code style checker dialogs.
8 """ 8 """
9 9
10 import UI.PixmapCache 10 from eric7.EricGui import EricPixmapCache
11 11
12 12
13 def setItemIcon(itm, column, msgCode, severity=None): 13 def setItemIcon(itm, column, msgCode, severity=None):
14 """ 14 """
15 Function to set the icon of the passed message item. 15 Function to set the icon of the passed message item.
22 @type str 22 @type str
23 @param severity severity for message code 'S' (defaults to None) 23 @param severity severity for message code 'S' (defaults to None)
24 @type str (optional) 24 @type str (optional)
25 """ 25 """
26 if msgCode.startswith(("W", "-", "C", "M")): 26 if msgCode.startswith(("W", "-", "C", "M")):
27 itm.setIcon(column, UI.PixmapCache.getIcon("warning")) 27 itm.setIcon(column, EricPixmapCache.getIcon("warning"))
28 elif msgCode.startswith("E"): 28 elif msgCode.startswith("E"):
29 itm.setIcon(column, UI.PixmapCache.getIcon("syntaxError")) 29 itm.setIcon(column, EricPixmapCache.getIcon("syntaxError"))
30 elif msgCode.startswith(("A", "N")): 30 elif msgCode.startswith(("A", "N")):
31 itm.setIcon(column, UI.PixmapCache.getIcon("namingError")) 31 itm.setIcon(column, EricPixmapCache.getIcon("namingError"))
32 elif msgCode.startswith("D"): 32 elif msgCode.startswith("D"):
33 itm.setIcon(column, UI.PixmapCache.getIcon("docstringError")) 33 itm.setIcon(column, EricPixmapCache.getIcon("docstringError"))
34 elif msgCode.startswith("I"): 34 elif msgCode.startswith("I"):
35 itm.setIcon(column, UI.PixmapCache.getIcon("imports")) 35 itm.setIcon(column, EricPixmapCache.getIcon("imports"))
36 elif msgCode.startswith("P"): 36 elif msgCode.startswith("P"):
37 itm.setIcon(column, UI.PixmapCache.getIcon("dirClosed")) 37 itm.setIcon(column, EricPixmapCache.getIcon("dirClosed"))
38 elif msgCode.startswith("Y"): 38 elif msgCode.startswith("Y"):
39 itm.setIcon(column, UI.PixmapCache.getIcon("filePython")) 39 itm.setIcon(column, EricPixmapCache.getIcon("filePython"))
40 elif msgCode.startswith("S"): 40 elif msgCode.startswith("S"):
41 if severity is None: 41 if severity is None:
42 itm.setIcon(column, UI.PixmapCache.getIcon("securityLow")) 42 itm.setIcon(column, EricPixmapCache.getIcon("securityLow"))
43 else: 43 else:
44 if severity == "H": 44 if severity == "H":
45 itm.setIcon(column, UI.PixmapCache.getIcon("securityLow")) 45 itm.setIcon(column, EricPixmapCache.getIcon("securityLow"))
46 elif severity == "M": 46 elif severity == "M":
47 itm.setIcon(column, UI.PixmapCache.getIcon("securityMedium")) 47 itm.setIcon(column, EricPixmapCache.getIcon("securityMedium"))
48 elif severity == "L": 48 elif severity == "L":
49 itm.setIcon(column, UI.PixmapCache.getIcon("securityHigh")) 49 itm.setIcon(column, EricPixmapCache.getIcon("securityHigh"))
50 else: 50 else:
51 itm.setIcon(column, UI.PixmapCache.getIcon("securityLow")) 51 itm.setIcon(column, EricPixmapCache.getIcon("securityLow"))
52 else: 52 else:
53 # unknown category prefix => warning 53 # unknown category prefix => warning
54 itm.setIcon(column, UI.PixmapCache.getIcon("warning")) 54 itm.setIcon(column, EricPixmapCache.getIcon("warning"))

eric ide

mercurial