RadonMetrics/MaintainabilityIndexDialog.py

changeset 13
22bc345844e7
parent 11
de8cadbd6a41
child 15
62ffe3d426e5
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
76 "<tr><td><b>C</b></td><td>score &le; 9</td></tr>" 76 "<tr><td><b>C</b></td><td>score &le; 9</td></tr>"
77 "</table>" 77 "</table>"
78 )) 78 ))
79 self.__rankColors = { 79 self.__rankColors = {
80 "A": Qt.green, 80 "A": Qt.green,
81 "B": Qt.yellow, #QColor("orange"), 81 "B": Qt.yellow,
82 "C": Qt.red, 82 "C": Qt.red,
83 } 83 }
84 84
85 def __resizeResultColumns(self): 85 def __resizeResultColumns(self):
86 """ 86 """
166 166
167 @param fn file or list of files or directory to show 167 @param fn file or list of files or directory to show
168 the maintainability index for 168 the maintainability index for
169 @type str or list of str 169 @type str or list of str
170 """ 170 """
171 self.__errorItem = None
172 self.resultList.clear()
171 self.cancelled = False 173 self.cancelled = False
172 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 174 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
173 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) 175 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True)
174 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 176 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
175 QApplication.processEvents() 177 QApplication.processEvents()
246 self.source = Utilities.normalizeCode(self.source) 248 self.source = Utilities.normalizeCode(self.source)
247 except (UnicodeError, IOError) as msg: 249 except (UnicodeError, IOError) as msg:
248 self.__createErrorItem(self.filename, str(msg).rstrip()) 250 self.__createErrorItem(self.filename, str(msg).rstrip())
249 self.progress += 1 251 self.progress += 1
250 # Continue with next file 252 # Continue with next file
251 self.rawMetrics() 253 self.maintainabilityIndex()
252 return 254 return
253 255
254 self.__finished = False 256 self.__finished = False
255 self.radonService.maintainabilityIndex( 257 self.radonService.maintainabilityIndex(
256 None, self.filename, self.source) 258 None, self.filename, self.source)
422 if filterList: 424 if filterList:
423 for filter in filterList: 425 for filter in filterList:
424 fileList = \ 426 fileList = \
425 [f for f in fileList if not fnmatch.fnmatch(f, filter)] 427 [f for f in fileList if not fnmatch.fnmatch(f, filter)]
426 428
427 self.__errorItem = None
428 self.resultList.clear()
429 self.cancelled = False
430 self.start(fileList) 429 self.start(fileList)

eric ide

mercurial