11 |
11 |
12 from PyQt5.QtCore import Qt |
12 from PyQt5.QtCore import Qt |
13 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem |
13 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem |
14 |
14 |
15 from .translations import _messages, _messages_sample_args |
15 from .translations import _messages, _messages_sample_args |
|
16 from .Security import translations as s_translations |
16 |
17 |
17 from .Ui_CodeStyleStatisticsDialog import Ui_CodeStyleStatisticsDialog |
18 from .Ui_CodeStyleStatisticsDialog import Ui_CodeStyleStatisticsDialog |
18 |
19 |
19 import UI.PixmapCache |
20 import UI.PixmapCache |
20 |
21 |
45 del stats["_IgnoredErrors"] |
46 del stats["_IgnoredErrors"] |
46 |
47 |
47 totalIssues = 0 |
48 totalIssues = 0 |
48 |
49 |
49 for code in sorted(stats.keys()): |
50 for code in sorted(stats.keys()): |
50 message = _messages.get(code) |
51 message = _messages.get(code) or s_translations._messages.get(code) |
51 if message is None: |
52 if message is None: |
52 continue |
53 continue |
53 |
54 |
54 if code in _messages_sample_args: |
55 if code in _messages_sample_args: |
55 message = message.format(*_messages_sample_args[code]) |
56 message = message.format(*_messages_sample_args[code]) |
|
57 elif code in s_translations._messages_sample_args: |
|
58 message = message.format( |
|
59 *s_translations._messages_sample_args[code]) |
56 |
60 |
57 self.__createItem(stats[code], code, message) |
61 self.__createItem(stats[code], code, message) |
58 totalIssues += stats[code] |
62 totalIssues += stats[code] |
59 |
63 |
60 self.totalIssues.setText( |
64 self.totalIssues.setText( |
89 itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError")) |
93 itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError")) |
90 elif code.startswith("N"): |
94 elif code.startswith("N"): |
91 itm.setIcon(1, UI.PixmapCache.getIcon("namingError")) |
95 itm.setIcon(1, UI.PixmapCache.getIcon("namingError")) |
92 elif code.startswith("D"): |
96 elif code.startswith("D"): |
93 itm.setIcon(1, UI.PixmapCache.getIcon("docstringError")) |
97 itm.setIcon(1, UI.PixmapCache.getIcon("docstringError")) |
|
98 elif code.startswith("S"): |
|
99 itm.setIcon(1, UI.PixmapCache.getIcon("securityLow")) |
94 |
100 |
95 itm.setTextAlignment(0, Qt.AlignRight) |
101 itm.setTextAlignment(0, Qt.AlignRight) |
96 itm.setTextAlignment(1, Qt.AlignHCenter) |
102 itm.setTextAlignment(1, Qt.AlignHCenter) |