--- a/RadonMetrics/RawMetricsDialog.py Sun Sep 20 12:17:19 2015 +0200 +++ b/RadonMetrics/RawMetricsDialog.py Sun Sep 20 13:49:22 2015 +0200 @@ -35,6 +35,8 @@ """ Class implementing a dialog to show raw code metrics. """ + FilePathRole = Qt.UserRole + 1 + def __init__(self, radonService, parent=None): """ Constructor @@ -124,6 +126,7 @@ itm = QTreeWidgetItem(self.resultList, data) for col in range(1, 10): itm.setTextAlignment(col, Qt.Alignment(Qt.AlignRight)) + itm.setData(0, self.FilePathRole, filename) def __createErrorItem(self, filename, message): """ @@ -181,7 +184,10 @@ """ self.__errorItem = None self.resultList.clear() + self.summaryList.clear() self.cancelled = False + QApplication.processEvents() + self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) @@ -386,6 +392,7 @@ # reenable updates of the list self.resultList.setSortingEnabled(True) + self.resultList.sortItems(0, Qt.AscendingOrder) self.resultList.setUpdatesEnabled(True) self.__createSummary() @@ -480,3 +487,20 @@ [f for f in fileList if not fnmatch.fnmatch(f, filter)] self.start(fileList) + + def clear(self): + """ + Public method to clear all results. + """ + self.resultList.clear() + self.summaryList.clear() + + @pyqtSlot(QTreeWidgetItem, int) + def on_resultList_itemActivated(self, item, column): + """ + Private slot to handle the activation of a result item. + """ + filename = item.data(0, self.FilePathRole) + if filename: + vm = e5App().getObject("ViewManager") + vm.openSourceFile(filename)