5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to save a screenshot of a web page. |
7 Module implementing a dialog to save a screenshot of a web page. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtCore import pyqtSlot, Qt, QFile, QFileInfo, QSize |
10 from PyQt6.QtCore import pyqtSlot, Qt, QFile, QFileInfo, QSize, QIODevice |
11 from PyQt6.QtGui import QImage, QPainter, QPixmap |
11 from PyQt6.QtGui import QImage, QPainter, QPixmap |
12 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton |
12 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton |
13 |
13 |
14 from EricWidgets import EricFileDialog, EricMessageBox |
14 from EricWidgets import EricFileDialog, EricMessageBox |
15 |
15 |
84 icon=EricMessageBox.Warning) |
84 icon=EricMessageBox.Warning) |
85 if not res: |
85 if not res: |
86 return False |
86 return False |
87 |
87 |
88 file = QFile(fileName) |
88 file = QFile(fileName) |
89 if not file.open(QFile.WriteOnly): |
89 if not file.open(QIODevice.OpenModeFlag.WriteOnly): |
90 EricMessageBox.warning( |
90 EricMessageBox.warning( |
91 self, |
91 self, |
92 self.tr("Save Page Screen"), |
92 self.tr("Save Page Screen"), |
93 self.tr("Cannot write file '{0}:\n{1}.") |
93 self.tr("Cannot write file '{0}:\n{1}.") |
94 .format(fileName, file.errorString())) |
94 .format(fileName, file.errorString())) |