35 issues |
35 issues |
36 @type bool |
36 @type bool |
37 @param parent reference to the parent widget |
37 @param parent reference to the parent widget |
38 @type QWidget |
38 @type QWidget |
39 """ |
39 """ |
40 super(CodeStyleCodeSelectionDialog, self).__init__(parent) |
40 super().__init__(parent) |
41 self.setupUi(self) |
41 self.setupUi(self) |
42 |
42 |
43 textWrapper = textwrap.TextWrapper(width=60) |
43 textWrapper = textwrap.TextWrapper(width=60) |
44 |
44 |
45 self.codeTable.headerItem().setText(self.codeTable.columnCount(), "") |
45 self.codeTable.headerItem().setText(self.codeTable.columnCount(), "") |
46 codeList = [code.strip() for code in codes.split(",") if code.strip()] |
46 codeList = [code.strip() for code in codes.split(",") if code.strip()] |
47 if categories: |
47 if categories: |
48 codeList = [code for code in codeList if not code[0] in categories] |
48 codeList = [code for code in codeList if code[0] not in categories] |
49 |
49 |
50 if showFixCodes: |
50 if showFixCodes: |
51 from .CodeStyleFixer import FixableCodeStyleIssues |
51 from .CodeStyleFixer import FixableCodeStyleIssues |
52 selectableCodes = FixableCodeStyleIssues |
52 selectableCodes = FixableCodeStyleIssues |
53 else: |
53 else: |
55 [x for x in getMessageCodes() if not x.startswith('FIX')] |
55 [x for x in getMessageCodes() if not x.startswith('FIX')] |
56 ) |
56 ) |
57 if categories: |
57 if categories: |
58 # filter by category |
58 # filter by category |
59 selectableCodes = [x for x in selectableCodes |
59 selectableCodes = [x for x in selectableCodes |
60 if not x[0] in categories] |
60 if x[0] not in categories] |
61 for code in sorted(selectableCodes): |
61 for code in sorted(selectableCodes): |
62 message = getTranslatedMessage(code, [], example=True) |
62 message = getTranslatedMessage(code, [], example=True) |
63 if message is None: |
63 if message is None: |
64 # try with extension |
64 # try with extension |
65 for ext in ("L", "M", "H", "1"): |
65 for ext in ("L", "M", "H", "1"): |
81 itm.setIcon(0, UI.PixmapCache.getIcon("docstringError")) |
81 itm.setIcon(0, UI.PixmapCache.getIcon("docstringError")) |
82 elif code.startswith("S"): |
82 elif code.startswith("S"): |
83 itm.setIcon(0, UI.PixmapCache.getIcon("securityLow")) |
83 itm.setIcon(0, UI.PixmapCache.getIcon("securityLow")) |
84 elif code.startswith("P"): |
84 elif code.startswith("P"): |
85 itm.setIcon(0, UI.PixmapCache.getIcon("dirClosed")) |
85 itm.setIcon(0, UI.PixmapCache.getIcon("dirClosed")) |
|
86 elif code.startswith("Y"): |
|
87 itm.setIcon(0, UI.PixmapCache.getIcon("filePython")) |
86 else: |
88 else: |
87 # unknown category prefix => warning |
89 # unknown category prefix => warning |
88 itm.setIcon(0, UI.PixmapCache.getIcon("warning")) |
90 itm.setIcon(0, UI.PixmapCache.getIcon("warning")) |
89 itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) |
91 itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) |
90 if code in codeList: |
92 if code in codeList: |