--- a/eric7/DataViews/PyCoverageDialog.py Mon May 23 16:49:08 2022 +0200 +++ b/eric7/DataViews/PyCoverageDialog.py Mon May 23 16:50:04 2022 +0200 @@ -173,12 +173,25 @@ @param fn file or list of files or directory to be checked @type str or list of str """ + # initialize the dialog + self.resultList.clear() + self.summaryList.clear() + self.cancelled = False + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) + self.__cfn = cfn self.__fn = fn - self.basename = os.path.splitext(cfn)[0] - - self.cfn = "{0}.coverage".format(self.basename) + self.cfn = ( + cfn + if cfn.endswith(".coverage") else + "{0}.coverage".format(os.path.splitext(cfn)[0]) + ) if isinstance(fn, list): files = fn @@ -441,20 +454,11 @@ """ Private slot to reload the coverage info. """ - self.resultList.clear() - self.summaryList.clear() self.reload = True excludePattern = self.excludeCombo.currentText() if excludePattern in self.excludeList: self.excludeList.remove(excludePattern) self.excludeList.insert(0, excludePattern) - self.cancelled = False - self.buttonBox.button( - QDialogButtonBox.StandardButton.Close).setEnabled(False) - self.buttonBox.button( - QDialogButtonBox.StandardButton.Cancel).setEnabled(True) - self.buttonBox.button( - QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.start(self.__cfn, self.__fn) @pyqtSlot(QTreeWidgetItem, int)