Changed logic to ensure, that some element are cleared when the data processing is initiated. unittest

Mon, 23 May 2022 16:50:04 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 23 May 2022 16:50:04 +0200
branch
unittest
changeset 9091
4231a14a89d7
parent 9090
224c634a1808
child 9092
043848f65726

Changed logic to ensure, that some element are cleared when the data processing is initiated.

eric7/DataViews/PyCoverageDialog.py file | annotate | diff | comparison | revisions
--- 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)

eric ide

mercurial