RadonMetrics/RawMetricsDialog.py

changeset 10
8b1920a22df3
parent 9
7f6e04213998
child 11
de8cadbd6a41
diff -r 7f6e04213998 -r 8b1920a22df3 RadonMetrics/RawMetricsDialog.py
--- a/RadonMetrics/RawMetricsDialog.py	Thu Sep 17 19:57:14 2015 +0200
+++ b/RadonMetrics/RawMetricsDialog.py	Fri Sep 18 19:46:57 2015 +0200
@@ -68,6 +68,7 @@
         self.__project = e5App().getObject("Project")
         self.__locale = QLocale()
         self.__finished = True
+        self.__errorItem = None
         
         self.__fileList = []
         self.filterFrame.setVisible(False)
@@ -133,13 +134,18 @@
         @param message error message
         @type str
         """
-        itm = QTreeWidgetItem(self.resultList, [
-            "{0} ({1})".format(self.__project.getRelativePath(filename),
-                               message)])
-        itm.setFirstColumnSpanned(True)
-        font = itm.font(0)
-        font.setItalic(True)
-        itm.setFont(0, font)
+        if self.__errorItem is None:
+            self.__errorItem = QTreeWidgetItem(self.resultList, [
+                self.tr("Errors")])
+            self.__errorItem.setExpanded(True)
+            self.__errorItem.setForeground(0, Qt.red)
+        
+        msg = "{0} ({1})".format(self.__project.getRelativePath(filename),
+                                 message)
+        if not self.resultList.findItems(msg, Qt.MatchExactly):
+            itm = QTreeWidgetItem(self.__errorItem, [msg])
+            itm.setForeground(0, Qt.red)
+            itm.setFirstColumnSpanned(True)
     
     def prepare(self, fileList, project):
         """
@@ -290,25 +296,32 @@
         self.__finished = False
         self.radonService.rawMetricsBatch(argumentsList)
     
-    def __batchFinished(self):
+    def __batchFinished(self, type_):
         """
         Private slot handling the completion of a batch job.
+        
+        @param type_ type of the calculated metrics
+        @type str, one of ["raw", "mi", "cc"]
         """
-        self.checkProgressLabel.setPath("")
-        self.checkProgress.setMaximum(1)
-        self.checkProgress.setValue(1)
-        self.__finish()
+        if type_ == "raw":
+            self.checkProgressLabel.setPath("")
+            self.checkProgress.setMaximum(1)
+            self.checkProgress.setValue(1)
+            self.__finish()
     
-    def __processError(self, fn, msg):
+    def __processError(self, type_, fn, msg):
         """
         Private slot to process an error indication from the service.
         
+        @param type_ type of the calculated metrics
+        @type str, one of ["raw", "mi", "cc"]
         @param fn filename of the file
         @type str
         @param msg error message
         @type str
         """
-        self.__createErrorItem(fn, msg)
+        if type_ == "raw":
+            self.__createErrorItem(fn, msg)
     
     def __processResult(self, fn, result):
         """
@@ -462,6 +475,7 @@
                 fileList = \
                     [f for f in fileList if not fnmatch.fnmatch(f, filter)]
         
+        self.__errorItem = None
         self.resultList.clear()
         self.cancelled = False
         self.start(fileList)

eric ide

mercurial