DataViews/CodeMetricsDialog.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1112
8a7d1b9d18db
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
17 from . import CodeMetrics 17 from . import CodeMetrics
18 18
19 import Utilities 19 import Utilities
20 20
21 import UI.PixmapCache 21 import UI.PixmapCache
22
22 23
23 class CodeMetricsDialog(QDialog, Ui_CodeMetricsDialog): 24 class CodeMetricsDialog(QDialog, Ui_CodeMetricsDialog):
24 """ 25 """
25 Class implementing a dialog to display the code metrics. 26 Class implementing a dialog to display the code metrics.
26 """ 27 """
27 def __init__(self, parent = None): 28 def __init__(self, parent=None):
28 """ 29 """
29 Constructor 30 Constructor
30 31
31 @param parent parent widget (QWidget) 32 @param parent parent widget (QWidget)
32 """ 33 """
69 @param parent parent of the new item (QTreeWidget or QTreeWidgetItem) 70 @param parent parent of the new item (QTreeWidget or QTreeWidgetItem)
70 @param strings strings to be displayed (list of strings) 71 @param strings strings to be displayed (list of strings)
71 @return the generated item 72 @return the generated item
72 """ 73 """
73 itm = QTreeWidgetItem(parent, strings) 74 itm = QTreeWidgetItem(parent, strings)
74 for col in range(1,7): 75 for col in range(1, 7):
75 itm.setTextAlignment(col, Qt.Alignment(Qt.AlignRight)) 76 itm.setTextAlignment(col, Qt.Alignment(Qt.AlignRight))
76 return itm 77 return itm
77 78
78 def __resizeSummaryColumns(self): 79 def __resizeSummaryColumns(self):
79 """ 80 """
109 110
110 self.filterFrame.setVisible(True) 111 self.filterFrame.setVisible(True)
111 112
112 self.__data = self.__project.getData("OTHERTOOLSPARMS", "CodeMetrics") 113 self.__data = self.__project.getData("OTHERTOOLSPARMS", "CodeMetrics")
113 if self.__data is None or "ExcludeFiles" not in self.__data: 114 if self.__data is None or "ExcludeFiles" not in self.__data:
114 self.__data = {"ExcludeFiles" : ""} 115 self.__data = {"ExcludeFiles": ""}
115 self.excludeFilesEdit.setText(self.__data["ExcludeFiles"]) 116 self.excludeFilesEdit.setText(self.__data["ExcludeFiles"])
116 117
117 def start(self, fn): 118 def start(self, fn):
118 """ 119 """
119 Public slot to start the code metrics determination. 120 Public slot to start the code metrics determination.
184 total['empty lines'] - total['non-commentary lines'] 185 total['empty lines'] - total['non-commentary lines']
185 self.__createSummaryItem(self.trUtf8("files"), loc.toString(total['files'])) 186 self.__createSummaryItem(self.trUtf8("files"), loc.toString(total['files']))
186 self.__createSummaryItem(self.trUtf8("lines"), loc.toString(total['lines'])) 187 self.__createSummaryItem(self.trUtf8("lines"), loc.toString(total['lines']))
187 self.__createSummaryItem(self.trUtf8("bytes"), loc.toString(total['bytes'])) 188 self.__createSummaryItem(self.trUtf8("bytes"), loc.toString(total['bytes']))
188 self.__createSummaryItem(self.trUtf8("comments"), loc.toString(total['comments'])) 189 self.__createSummaryItem(self.trUtf8("comments"), loc.toString(total['comments']))
189 self.__createSummaryItem(self.trUtf8("empty lines"), 190 self.__createSummaryItem(self.trUtf8("empty lines"),
190 loc.toString(total['empty lines'])) 191 loc.toString(total['empty lines']))
191 self.__createSummaryItem(self.trUtf8("non-commentary lines"), 192 self.__createSummaryItem(self.trUtf8("non-commentary lines"),
192 loc.toString(total['non-commentary lines'])) 193 loc.toString(total['non-commentary lines']))
193 self.__createSummaryItem(self.trUtf8("documentation lines"), 194 self.__createSummaryItem(self.trUtf8("documentation lines"),
194 loc.toString(docstrings)) 195 loc.toString(docstrings))
195 self.__resizeSummaryColumns() 196 self.__resizeSummaryColumns()
196 self.__finish() 197 self.__finish()
197 198
198 def __getValues(self, loc, stats, identifier): 199 def __getValues(self, loc, stats, identifier):

eric ide

mercurial