RadonMetrics/RawMetricsDialog.py

changeset 13
22bc345844e7
parent 11
de8cadbd6a41
child 14
5f206edea27e
equal deleted inserted replaced
12:32a3c9d62e90 13:22bc345844e7
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 try: 12 try:
13 str = unicode # __IGNORE_EXCEPTION __IGNORE_WARNING__ 13 str = unicode # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
14 except NameError: 14 except NameError:
15 pass 15 pass
16 16
17 import os 17 import os
18 import fnmatch 18 import fnmatch
117 data.append("{0:3.0%}".format( 117 data.append("{0:3.0%}".format(
118 values["comments"] / (float(values["loc"]) or 1))) 118 values["comments"] / (float(values["loc"]) or 1)))
119 data.append("{0:3.0%}".format( 119 data.append("{0:3.0%}".format(
120 values["comments"] / (float(values["sloc"]) or 1))) 120 values["comments"] / (float(values["sloc"]) or 1)))
121 data.append("{0:3.0%}".format( 121 data.append("{0:3.0%}".format(
122 (values["comments"] + values["multi"]) / 122 (values["comments"] + values["multi"]) /
123 (float(values["loc"]) or 1))) 123 (float(values["loc"]) or 1)))
124 itm = QTreeWidgetItem(self.resultList, data) 124 itm = QTreeWidgetItem(self.resultList, data)
125 for col in range(1, 10): 125 for col in range(1, 10):
126 itm.setTextAlignment(col, Qt.Alignment(Qt.AlignRight)) 126 itm.setTextAlignment(col, Qt.Alignment(Qt.AlignRight))
127 127
177 177
178 @param fn file or list of files or directory to show 178 @param fn file or list of files or directory to show
179 the code metrics for 179 the code metrics for
180 @type str or list of str 180 @type str or list of str
181 """ 181 """
182 self.__errorItem = None
183 self.resultList.clear()
182 self.cancelled = False 184 self.cancelled = False
183 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 185 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
184 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) 186 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True)
185 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 187 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
186 QApplication.processEvents() 188 QApplication.processEvents()
473 if filterList: 475 if filterList:
474 for filter in filterList: 476 for filter in filterList:
475 fileList = \ 477 fileList = \
476 [f for f in fileList if not fnmatch.fnmatch(f, filter)] 478 [f for f in fileList if not fnmatch.fnmatch(f, filter)]
477 479
478 self.__errorItem = None
479 self.resultList.clear()
480 self.cancelled = False
481 self.start(fileList) 480 self.start(fileList)

eric ide

mercurial