8239:59a9a658618c | 8240:93b8a353c4bf |
---|---|
8 """ | 8 """ |
9 | 9 |
10 import os | 10 import os |
11 import mimetypes | 11 import mimetypes |
12 import smtplib | 12 import smtplib |
13 import contextlib | |
13 | 14 |
14 from PyQt5.QtCore import Qt, pyqtSlot | 15 from PyQt5.QtCore import Qt, pyqtSlot |
15 from PyQt5.QtGui import QTextOption | 16 from PyQt5.QtGui import QTextOption |
16 from PyQt5.QtWidgets import ( | 17 from PyQt5.QtWidgets import ( |
17 QHeaderView, QLineEdit, QDialog, QInputDialog, QDialogButtonBox, | 18 QHeaderView, QLineEdit, QDialog, QInputDialog, QDialogButtonBox, |
182 def __deleteAttachedFiles(self): | 183 def __deleteAttachedFiles(self): |
183 """ | 184 """ |
184 Private method to delete attached files. | 185 Private method to delete attached files. |
185 """ | 186 """ |
186 for f in self.__deleteFiles: | 187 for f in self.__deleteFiles: |
187 try: | 188 with contextlib.suppress(OSError): |
188 os.remove(f) | 189 os.remove(f) |
189 except OSError: | |
190 pass | |
191 | 190 |
192 def __encodedText(self, txt): | 191 def __encodedText(self, txt): |
193 """ | 192 """ |
194 Private method to create a MIMEText message with correct encoding. | 193 Private method to create a MIMEText message with correct encoding. |
195 | 194 |