66 self.cancelled = False |
66 self.cancelled = False |
67 |
67 |
68 self.__project = e5App().getObject("Project") |
68 self.__project = e5App().getObject("Project") |
69 self.__locale = QLocale() |
69 self.__locale = QLocale() |
70 self.__finished = True |
70 self.__finished = True |
|
71 self.__errorItem = None |
71 |
72 |
72 self.__fileList = [] |
73 self.__fileList = [] |
73 self.filterFrame.setVisible(False) |
74 self.filterFrame.setVisible(False) |
74 |
75 |
75 self.explanationLabel.setText(self.tr( |
76 self.explanationLabel.setText(self.tr( |
131 @param filename name of the file |
132 @param filename name of the file |
132 @type str |
133 @type str |
133 @param message error message |
134 @param message error message |
134 @type str |
135 @type str |
135 """ |
136 """ |
136 itm = QTreeWidgetItem(self.resultList, [ |
137 if self.__errorItem is None: |
137 "{0} ({1})".format(self.__project.getRelativePath(filename), |
138 self.__errorItem = QTreeWidgetItem(self.resultList, [ |
138 message)]) |
139 self.tr("Errors")]) |
139 itm.setFirstColumnSpanned(True) |
140 self.__errorItem.setExpanded(True) |
140 font = itm.font(0) |
141 self.__errorItem.setForeground(0, Qt.red) |
141 font.setItalic(True) |
142 |
142 itm.setFont(0, font) |
143 msg = "{0} ({1})".format(self.__project.getRelativePath(filename), |
|
144 message) |
|
145 if not self.resultList.findItems(msg, Qt.MatchExactly): |
|
146 itm = QTreeWidgetItem(self.__errorItem, [msg]) |
|
147 itm.setForeground(0, Qt.red) |
|
148 itm.setFirstColumnSpanned(True) |
143 |
149 |
144 def prepare(self, fileList, project): |
150 def prepare(self, fileList, project): |
145 """ |
151 """ |
146 Public method to prepare the dialog with a list of filenames. |
152 Public method to prepare the dialog with a list of filenames. |
147 |
153 |
288 QApplication.processEvents() |
294 QApplication.processEvents() |
289 |
295 |
290 self.__finished = False |
296 self.__finished = False |
291 self.radonService.rawMetricsBatch(argumentsList) |
297 self.radonService.rawMetricsBatch(argumentsList) |
292 |
298 |
293 def __batchFinished(self): |
299 def __batchFinished(self, type_): |
294 """ |
300 """ |
295 Private slot handling the completion of a batch job. |
301 Private slot handling the completion of a batch job. |
296 """ |
302 |
297 self.checkProgressLabel.setPath("") |
303 @param type_ type of the calculated metrics |
298 self.checkProgress.setMaximum(1) |
304 @type str, one of ["raw", "mi", "cc"] |
299 self.checkProgress.setValue(1) |
305 """ |
300 self.__finish() |
306 if type_ == "raw": |
301 |
307 self.checkProgressLabel.setPath("") |
302 def __processError(self, fn, msg): |
308 self.checkProgress.setMaximum(1) |
|
309 self.checkProgress.setValue(1) |
|
310 self.__finish() |
|
311 |
|
312 def __processError(self, type_, fn, msg): |
303 """ |
313 """ |
304 Private slot to process an error indication from the service. |
314 Private slot to process an error indication from the service. |
305 |
315 |
|
316 @param type_ type of the calculated metrics |
|
317 @type str, one of ["raw", "mi", "cc"] |
306 @param fn filename of the file |
318 @param fn filename of the file |
307 @type str |
319 @type str |
308 @param msg error message |
320 @param msg error message |
309 @type str |
321 @type str |
310 """ |
322 """ |
311 self.__createErrorItem(fn, msg) |
323 if type_ == "raw": |
|
324 self.__createErrorItem(fn, msg) |
312 |
325 |
313 def __processResult(self, fn, result): |
326 def __processResult(self, fn, result): |
314 """ |
327 """ |
315 Private slot called after perfoming a code metrics calculation on one |
328 Private slot called after perfoming a code metrics calculation on one |
316 file. |
329 file. |
460 if filterList: |
473 if filterList: |
461 for filter in filterList: |
474 for filter in filterList: |
462 fileList = \ |
475 fileList = \ |
463 [f for f in fileList if not fnmatch.fnmatch(f, filter)] |
476 [f for f in fileList if not fnmatch.fnmatch(f, filter)] |
464 |
477 |
|
478 self.__errorItem = None |
465 self.resultList.clear() |
479 self.resultList.clear() |
466 self.cancelled = False |
480 self.cancelled = False |
467 self.start(fileList) |
481 self.start(fileList) |