9 |
9 |
10 import contextlib |
10 import contextlib |
11 import os |
11 import os |
12 import pathlib |
12 import pathlib |
13 |
13 |
14 from PyQt6.QtCore import QBuffer, QByteArray, QIODevice, QPointF, QSize, Qt, pyqtSignal, pyqtSlot |
14 from PyQt6.QtCore import ( |
|
15 QBuffer, |
|
16 QByteArray, |
|
17 QIODevice, |
|
18 QPointF, |
|
19 QSize, |
|
20 Qt, |
|
21 pyqtSignal, |
|
22 pyqtSlot, |
|
23 ) |
15 from PyQt6.QtGui import QAction, QActionGroup, QClipboard, QGuiApplication, QKeySequence |
24 from PyQt6.QtGui import QAction, QActionGroup, QClipboard, QGuiApplication, QKeySequence |
16 from PyQt6.QtPdf import QPdfDocument, QPdfLink |
25 from PyQt6.QtPdf import QPdfDocument, QPdfLink |
17 from PyQt6.QtPdfWidgets import QPdfView |
26 from PyQt6.QtPdfWidgets import QPdfView |
18 from PyQt6.QtWidgets import ( |
27 from PyQt6.QtWidgets import ( |
19 QDialog, |
28 QDialog, |
79 self.setWindowIcon(EricPixmapCache.getIcon("ericPdf")) |
88 self.setWindowIcon(EricPixmapCache.getIcon("ericPdf")) |
80 |
89 |
81 if not self.__fromEric: |
90 if not self.__fromEric: |
82 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
91 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
83 |
92 |
84 self.__remotefsInterface =( |
93 self.__remotefsInterface = ( |
85 ericApp().getObject("EricServer").getServiceInterface("FileSystem") |
94 ericApp().getObject("EricServer").getServiceInterface("FileSystem") |
86 if self.__fromEric |
95 if self.__fromEric |
87 else None |
96 else None |
88 ) |
97 ) |
89 |
98 |
984 ).format(fileName, str(err)), |
993 ).format(fileName, str(err)), |
985 ) |
994 ) |
986 return |
995 return |
987 else: |
996 else: |
988 buffer = None |
997 buffer = None |
989 |
998 |
990 while not canceled and err == QPdfDocument.Error.IncorrectPassword: |
999 while not canceled and err == QPdfDocument.Error.IncorrectPassword: |
991 if FileSystemUtilities.isRemoteFileName(fileName): |
1000 if FileSystemUtilities.isRemoteFileName(fileName): |
992 buffer.open(QIODevice.OpenModeFlag.ReadOnly) |
1001 buffer.open(QIODevice.OpenModeFlag.ReadOnly) |
993 self.__pdfDocument.load(buffer) |
1002 self.__pdfDocument.load(buffer) |
994 err = QPdfDocument.Error.None_ |
1003 err = QPdfDocument.Error.None_ |