15 import re |
15 import re |
16 import contextlib |
16 import contextlib |
17 |
17 |
18 from PyQt6.QtCore import ( |
18 from PyQt6.QtCore import ( |
19 pyqtSlot, Qt, QFile, QFileInfo, QTimer, QPoint, QMimeData, QLocale, |
19 pyqtSlot, Qt, QFile, QFileInfo, QTimer, QPoint, QMimeData, QLocale, |
20 QStandardPaths |
20 QStandardPaths, QIODevice |
21 ) |
21 ) |
22 from PyQt6.QtGui import QImageWriter, QPixmap, QDrag, QKeySequence, QShortcut |
22 from PyQt6.QtGui import QImageWriter, QPixmap, QDrag, QKeySequence, QShortcut |
23 from PyQt6.QtWidgets import QWidget, QApplication |
23 from PyQt6.QtWidgets import QWidget, QApplication |
24 |
24 |
25 from EricWidgets import EricFileDialog, EricMessageBox |
25 from EricWidgets import EricFileDialog, EricMessageBox |
238 icon=EricMessageBox.Warning) |
238 icon=EricMessageBox.Warning) |
239 if not res: |
239 if not res: |
240 return False |
240 return False |
241 |
241 |
242 file = QFile(fileName) |
242 file = QFile(fileName) |
243 if not file.open(QFile.WriteOnly): |
243 if not file.open(QIODevice.OpenModeFlag.WriteOnly): |
244 EricMessageBox.warning( |
244 EricMessageBox.warning( |
245 self, self.tr("Save Snapshot"), |
245 self, self.tr("Save Snapshot"), |
246 self.tr("Cannot write file '{0}:\n{1}.") |
246 self.tr("Cannot write file '{0}:\n{1}.") |
247 .format(fileName, file.errorString())) |
247 .format(fileName, file.errorString())) |
248 return False |
248 return False |