Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py

branch
Py2 comp.
changeset 3485
f1cbc18f88b2
parent 3178
f25fc1364c88
child 3656
441956d8fce5
equal deleted inserted replaced
3484:645c12de6b0c 3485:f1cbc18f88b2
7 Module implementing a dialog to select code style message codes. 7 Module implementing a dialog to select code style message codes.
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt4.QtCore import QCoreApplication
13 from PyQt4.QtGui import QDialog, QTreeWidgetItem 12 from PyQt4.QtGui import QDialog, QTreeWidgetItem
14
15 from . import pep8
16 from .NamingStyleChecker import NamingStyleChecker
17 from .DocStyleChecker import DocStyleChecker
18 13
19 from .Ui_CodeStyleCodeSelectionDialog import Ui_CodeStyleCodeSelectionDialog 14 from .Ui_CodeStyleCodeSelectionDialog import Ui_CodeStyleCodeSelectionDialog
20 15
21 import UI.PixmapCache 16 import UI.PixmapCache
22 17
37 super(CodeStyleCodeSelectionDialog, self).__init__(parent) 32 super(CodeStyleCodeSelectionDialog, self).__init__(parent)
38 self.setupUi(self) 33 self.setupUi(self)
39 34
40 codeList = [code.strip() for code in codes.split(",") if code.strip()] 35 codeList = [code.strip() for code in codes.split(",") if code.strip()]
41 36
37 from .translations import _messages, _messages_sample_args
38
42 if showFixCodes: 39 if showFixCodes:
43 from .CodeStyleFixer import FixableCodeStyleIssues 40 from .CodeStyleFixer import FixableCodeStyleIssues
44 selectableCodes = FixableCodeStyleIssues 41 selectableCodes = FixableCodeStyleIssues
45 else: 42 else:
46 selectableCodes = list(pep8.pep8_messages.keys()) 43 selectableCodes = [x for x in list(_messages.keys())
47 selectableCodes.extend(NamingStyleChecker.Messages.keys()) 44 if not x.startswith('F')]
48 selectableCodes.extend(DocStyleChecker.Messages.keys())
49 for code in sorted(selectableCodes): 45 for code in sorted(selectableCodes):
50 if code in pep8.pep8_messages_sample_args: 46 if code in _messages_sample_args:
51 message = QCoreApplication.translate( 47 message = _messages[code].format(*_messages_sample_args[code])
52 "pep8", pep8.pep8_messages[code]).format( 48 elif code in _messages:
53 *pep8.pep8_messages_sample_args[code]) 49 message = _messages[code]
54 elif code in pep8.pep8_messages:
55 message = QCoreApplication.translate(
56 "pep8", pep8.pep8_messages[code])
57 elif code in NamingStyleChecker.Messages:
58 message = QCoreApplication.translate(
59 "NamingStyleChecker",
60 NamingStyleChecker.Messages[code])
61 elif code in DocStyleChecker.MessagesSampleArgs:
62 message = QCoreApplication.translate(
63 "DocStyleChecker",
64 DocStyleChecker.Messages[code].format(
65 *DocStyleChecker.MessagesSampleArgs[code]))
66 elif code in DocStyleChecker.Messages:
67 message = QCoreApplication.translate(
68 "DocStyleChecker", DocStyleChecker.Messages[code])
69 else: 50 else:
70 continue 51 continue
71 itm = QTreeWidgetItem(self.codeTable, [code, message]) 52 itm = QTreeWidgetItem(self.codeTable, [code, message])
72 if code.startswith("W"): 53 if code.startswith("W"):
73 itm.setIcon(0, UI.PixmapCache.getIcon("warning.png")) 54 itm.setIcon(0, UI.PixmapCache.getIcon("warning.png"))

eric ide

mercurial