9 """ |
9 """ |
10 |
10 |
11 import os |
11 import os |
12 import functools |
12 import functools |
13 import contextlib |
13 import contextlib |
|
14 import pathlib |
14 |
15 |
15 from PyQt6.QtCore import ( |
16 from PyQt6.QtCore import ( |
16 pyqtSignal, pyqtSlot, Qt, QUrl, QFileInfo, QTimer, QEvent, QPoint, |
17 pyqtSignal, pyqtSlot, Qt, QUrl, QTimer, QEvent, QPoint, QPointF, QDateTime, |
17 QPointF, QDateTime, QStandardPaths, QByteArray, QIODevice, QDataStream |
18 QStandardPaths, QByteArray, QIODevice, QDataStream |
18 ) |
19 ) |
19 from PyQt6.QtGui import ( |
20 from PyQt6.QtGui import ( |
20 QDesktopServices, QClipboard, QIcon, QContextMenuEvent, QPixmap, QCursor |
21 QDesktopServices, QClipboard, QIcon, QContextMenuEvent, QPixmap, QCursor |
21 ) |
22 ) |
22 from PyQt6.QtWidgets import QStyle, QMenu, QApplication, QDialog |
23 from PyQt6.QtWidgets import QStyle, QMenu, QApplication, QDialog |
246 # name is a local file |
247 # name is a local file |
247 if name.scheme() and len(name.scheme()) == 1: |
248 if name.scheme() and len(name.scheme()) == 1: |
248 # it is a local path on win os |
249 # it is a local path on win os |
249 name = QUrl.fromLocalFile(name.toString()) |
250 name = QUrl.fromLocalFile(name.toString()) |
250 |
251 |
251 if not QFileInfo(name.toLocalFile()).exists(): |
252 if not pathlib.Path(name.toLocalFile()).exists(): |
252 EricMessageBox.critical( |
253 EricMessageBox.critical( |
253 self, |
254 self, |
254 self.tr("eric Web Browser"), |
255 self.tr("eric Web Browser"), |
255 self.tr( |
256 self.tr( |
256 """<p>The file <b>{0}</b> does not exist.</p>""") |
257 """<p>The file <b>{0}</b> does not exist.</p>""") |