eric6/UI/ErrorLogDialog.py

changeset 8243
cc717c2ae956
parent 8218
7c09585bd960
equal deleted inserted replaced
8242:aa713ac50c0d 8243:cc717c2ae956
6 """ 6 """
7 Module implementing a dialog to display an error log. 7 Module implementing a dialog to display an error log.
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 QDialog, QStyle 14 from PyQt5.QtWidgets import QDialog, QStyle
14 15
15 from .Ui_ErrorLogDialog import Ui_ErrorLogDialog 16 from .Ui_ErrorLogDialog import Ui_ErrorLogDialog
47 self.setWindowTitle(self.tr("Error Log")) 48 self.setWindowTitle(self.tr("Error Log"))
48 49
49 self.__ui = parent 50 self.__ui = parent
50 self.__logFile = logFile 51 self.__logFile = logFile
51 52
52 try: 53 with contextlib.suppress(OSError):
53 with open(logFile, "r", encoding="utf-8") as f: 54 with open(logFile, "r", encoding="utf-8") as f:
54 txt = f.read() 55 txt = f.read()
55 self.logEdit.setPlainText(txt) 56 self.logEdit.setPlainText(txt)
56 except OSError:
57 pass
58 57
59 @pyqtSlot() 58 @pyqtSlot()
60 def on_emailButton_clicked(self): 59 def on_emailButton_clicked(self):
61 """ 60 """
62 Private slot to send an email. 61 Private slot to send an email.

eric ide

mercurial