6 """ |
6 """ |
7 Module implementing a Python code coverage dialog. |
7 Module implementing a Python code coverage dialog. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
|
11 import contextlib |
11 |
12 |
12 from PyQt5.QtCore import pyqtSlot, Qt |
13 from PyQt5.QtCore import pyqtSlot, Qt |
13 from PyQt5.QtWidgets import ( |
14 from PyQt5.QtWidgets import ( |
14 QDialog, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, |
15 QDialog, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, |
15 QApplication |
16 QApplication |
385 This method deletes all annotated files. These are files |
386 This method deletes all annotated files. These are files |
386 ending with ',cover'. |
387 ending with ',cover'. |
387 """ |
388 """ |
388 files = Utilities.direntries(self.path, True, '*,cover', False) |
389 files = Utilities.direntries(self.path, True, '*,cover', False) |
389 for file in files: |
390 for file in files: |
390 try: |
391 with contextlib.suppress(OSError): |
391 os.remove(file) |
392 os.remove(file) |
392 except OSError: |
|
393 pass |
|
394 |
393 |
395 @pyqtSlot() |
394 @pyqtSlot() |
396 def on_reloadButton_clicked(self): |
395 def on_reloadButton_clicked(self): |
397 """ |
396 """ |
398 Private slot to reload the coverage info. |
397 Private slot to reload the coverage info. |