Plugins/CheckerPlugins/Pep8/Pep8StatisticsDialog.py

changeset 945
8cd4d08fa9f6
parent 857
613ded9c3b69
child 1131
7781e396c903
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
14 14
15 from .Ui_Pep8StatisticsDialog import Ui_Pep8StatisticsDialog 15 from .Ui_Pep8StatisticsDialog import Ui_Pep8StatisticsDialog
16 16
17 import UI.PixmapCache 17 import UI.PixmapCache
18 18
19
19 class Pep8StatisticsDialog(QDialog, Ui_Pep8StatisticsDialog): 20 class Pep8StatisticsDialog(QDialog, Ui_Pep8StatisticsDialog):
20 """ 21 """
21 Class implementing a dialog showing statistical data for the last 22 Class implementing a dialog showing statistical data for the last
22 PEP 8 run. 23 PEP 8 run.
23 """ 24 """
24 def __init__(self, statistics, parent = None): 25 def __init__(self, statistics, parent=None):
25 """ 26 """
26 Constructor 27 Constructor
27 28
28 @param dictionary with the statistical data 29 @param dictionary with the statistical data
29 @param parent reference to the parent widget (QWidget) 30 @param parent reference to the parent widget (QWidget)
41 42
42 totalIssues = 0 43 totalIssues = 0
43 44
44 for code in sorted(stats.keys(), key=lambda a: a[1:]): 45 for code in sorted(stats.keys(), key=lambda a: a[1:]):
45 if code in pep8.pep8_messages_sample_args: 46 if code in pep8.pep8_messages_sample_args:
46 message = QCoreApplication.translate("pep8", 47 message = QCoreApplication.translate("pep8",
47 pep8.pep8_messages[code]).format( 48 pep8.pep8_messages[code]).format(
48 *pep8.pep8_messages_sample_args[code]) 49 *pep8.pep8_messages_sample_args[code])
49 else: 50 else:
50 message = QCoreApplication.translate("pep8", 51 message = QCoreApplication.translate("pep8",
51 pep8.pep8_messages[code]) 52 pep8.pep8_messages[code])
52 self.__createItem(stats[code], code, message) 53 self.__createItem(stats[code], code, message)
53 totalIssues += stats[code] 54 totalIssues += stats[code]
54 55
55 self.totalIssues.setText( 56 self.totalIssues.setText(
70 71
71 @param count occurrences of the issue (integer) 72 @param count occurrences of the issue (integer)
72 @param code of a PEP 8 message (string) 73 @param code of a PEP 8 message (string)
73 @param message PEP 8 message to be shown (string) 74 @param message PEP 8 message to be shown (string)
74 """ 75 """
75 itm = QTreeWidgetItem(self.statisticsList, 76 itm = QTreeWidgetItem(self.statisticsList,
76 ["{0:6}".format(count), code, message]) 77 ["{0:6}".format(count), code, message])
77 if code.startswith("W"): 78 if code.startswith("W"):
78 itm.setIcon(1, UI.PixmapCache.getIcon("warning.png")) 79 itm.setIcon(1, UI.PixmapCache.getIcon("warning.png"))
79 elif code.startswith("E"): 80 elif code.startswith("E"):
80 itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError.png")) 81 itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError.png"))

eric ide

mercurial