diff -r b99e7fd55fd3 -r 15743bae8a50 src/eric7/DataViews/CodeMetricsDialog.py --- a/src/eric7/DataViews/CodeMetricsDialog.py Thu Jul 07 11:23:56 2022 +0200 +++ b/src/eric7/DataViews/CodeMetricsDialog.py Thu Jul 07 15:02:00 2022 +0200 @@ -18,6 +18,8 @@ QApplication ) +from EricWidgets.EricApplication import ericApp + from .Ui_CodeMetricsDialog import Ui_CodeMetricsDialog from . import CodeMetrics @@ -62,7 +64,7 @@ self.__showContextMenu) self.__fileList = [] - self.__project = None + self.__project = ericApp().getObject("Project") self.filterFrame.setVisible(False) def __resizeResultColumns(self): @@ -111,15 +113,14 @@ itm = QTreeWidgetItem(self.summaryList, [col0, col1]) itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight) - def prepare(self, fileList, project): + def prepare(self, fileList): """ Public method to prepare the dialog with a list of filenames. - @param fileList list of filenames (list of strings) - @param project reference to the project object (Project) + @param fileList list of filenames + @type list of str """ self.__fileList = fileList[:] - self.__project = project self.buttonBox.button( QDialogButtonBox.StandardButton.Close).setEnabled(True) @@ -184,7 +185,11 @@ stats = CodeMetrics.analyze(file, total) v = self.__getValues(loc, stats, 'TOTAL ') - fitm = self.__createResultItem(self.resultList, [file] + v) + # make the file name project relative + fitm = self.__createResultItem( + self.resultList, + [self.__project.getRelativePath(file)] + v + ) identifiers = stats.identifiers for identifier in identifiers: