--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleStatisticsDialog.py Mon Jun 08 08:17:14 2020 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleStatisticsDialog.py Mon Jun 08 20:08:27 2020 +0200 @@ -8,12 +8,12 @@ style checker run. """ +import textwrap from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QDialog, QTreeWidgetItem -from .translations import _messages, _messages_sample_args -from .Security import translations as s_translations +from .translations import getTranslatedMessage from .Ui_CodeStyleStatisticsDialog import Ui_CodeStyleStatisticsDialog @@ -47,18 +47,15 @@ totalIssues = 0 + textWrapper = textwrap.TextWrapper(width=80) + for code in sorted(stats.keys()): - message = _messages.get(code) or s_translations._messages.get(code) + message = getTranslatedMessage(code, [], example=True) if message is None: continue - if code in _messages_sample_args: - message = message.format(*_messages_sample_args[code]) - elif code in s_translations._messages_sample_args: - message = message.format( - *s_translations._messages_sample_args[code]) - - self.__createItem(stats[code], code, message) + self.__createItem(stats[code], code, + "\n".join(textWrapper.wrap(message))) totalIssues += stats[code] self.totalIssues.setText( @@ -83,10 +80,8 @@ @param code of a code style issue message (string) @param message code style issue message to be shown (string) """ - itm = QTreeWidgetItem(self.statisticsList) - itm.setData(0, Qt.DisplayRole, count) - itm.setData(1, Qt.DisplayRole, code) - itm.setData(2, Qt.DisplayRole, message) + itm = QTreeWidgetItem(self.statisticsList, [ + "{0:6d}".format(count), code, message]) if code.startswith(("W", "C", "M")): itm.setIcon(1, UI.PixmapCache.getIcon("warning")) elif code.startswith("E"):